#include <processor.h>
Inheritance diagram for EMAN::TestImageAxes:
Public Member Functions | |
virtual void | process_inplace (EMData *image) |
Make an image where the axes (where x,y and z=0) are some nono zero value. | |
virtual string | get_name () const |
Get the processor's name. | |
virtual string | get_desc () const |
Get the descrition of this specific processor. | |
virtual TypeDict | get_param_types () const |
Get processor parameter information in a dictionary. | |
Static Public Member Functions | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "testimage.axes" |
radius | the radial length of the lines from the origin | |
fill | the value to assign to pixels made non zero |
Definition at line 6168 of file processor.h.
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 6182 of file processor.h. 06183 { 06184 return "Make an image consisting of a single cross"; 06185 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6177 of file processor.h. 06178 {
06179 return NAME;
06180 }
|
|
Get processor parameter information in a dictionary. Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.
Reimplemented from EMAN::Processor. Definition at line 6192 of file processor.h. References EMAN::TypeDict::put(). 06193 { 06194 TypeDict d; 06195 d.put("int", EMObject::FLOAT, "radius of the lines emanating from the origin"); 06196 d.put("fill", EMObject::FLOAT, "value to make non-zero pixels"); 06197 return d; 06198 }
|
|
Definition at line 6187 of file processor.h. 06188 { 06189 return new TestImageAxes(); 06190 }
|
|
Make an image where the axes (where x,y and z=0) are some nono zero value.
Implements EMAN::Processor. Definition at line 7358 of file processor.cpp. References min, nx, ny, EMAN::TestImageProcessor::preprocess(), EMAN::Dict::set_default(), and EMAN::EMData::update(). 07359 { 07360 preprocess(image); 07361 07362 float fill = params.set_default("fill", 1.0f); 07363 // get the central coordinates 07364 int cx = nx/2; 07365 int cy = ny/2; 07366 int cz = nz/2; 07367 07368 // Offsets are used to detect when "the extra pixel" needs to be filled in 07369 // They are implemented on the assumption that for odd dimensions 07370 // the "center pixel" is the center pixel, but for even dimensions the "center 07371 // pixel" is displaced in the positive direction by 1 07372 int xoffset = (nx % 2 == 0? 1:0); 07373 int yoffset = (ny % 2 == 0? 1:0); 07374 int zoffset = (nz % 2 == 0? 1:0); 07375 07376 // This should never occur - but if indeed it did occur, the code in this function 07377 // would break - the function would proceed into the final "else" and seg fault 07378 // It is commented out but left for clarity 07379 // if ( nx < 1 || ny < 1 || nz < 1 ) throw ImageDimensionException("Error: one of the image dimensions was less than zero"); 07380 07381 if ( nx == 1 && ny == 1 && nz == 1 ) 07382 { 07383 (*image)(0) = fill; 07384 } 07385 else if ( ny == 1 && nz == 1 ) 07386 { 07387 int radius = params.set_default("radius", cx ); 07388 if ( radius > cx ) radius = cx; 07389 07390 (*image)(cx) = fill; 07391 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i) = fill; 07392 for ( int i = 1; i <= radius; ++i ) (*image)(cx-i) = fill; 07393 } 07394 else if ( nz == 1 ) 07395 { 07396 int min = ( nx < ny ? nx : ny ); 07397 min /= 2; 07398 07399 int radius = params.set_default("radius", min ); 07400 if ( radius > min ) radius = min; 07401 07402 (*image)(cx,cy) = fill; 07403 07404 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i,cy) = fill; 07405 for ( int i = 1; i <= radius-yoffset; ++i )(*image)(cx,cy+i) = fill; 07406 07407 for ( int i = 1; i <= radius; ++i ) 07408 { 07409 (*image)(cx-i,cy) = fill; 07410 (*image)(cx,cy-i) = fill; 07411 } 07412 07413 } 07414 else 07415 { 07416 // nx > 1 && ny > 1 && nz > 1 07417 int min = ( nx < ny ? nx : ny ); 07418 if (nz < min ) min = nz; 07419 min /= 2; 07420 07421 int radius = params.set_default("radius", min); 07422 if ( radius > min ) radius = min; 07423 07424 07425 (*image)(cx,cy,cz) = fill; 07426 for ( int i = 1; i <=radius-xoffset; ++i ) (*image)(cx+i,cy,cz) = fill; 07427 for ( int i = 1; i <=radius-yoffset; ++i ) (*image)(cx,cy+i,cz) = fill; 07428 for ( int i = 1; i <=radius-zoffset; ++i ) (*image)(cx,cy,cz+i) = fill; 07429 for ( int i = 1; i <= radius; ++i ) 07430 { 07431 (*image)(cx-i,cy,cz) = fill; 07432 (*image)(cx,cy-i,cz) = fill; 07433 (*image)(cx,cy,cz-i) = fill; 07434 } 07435 } 07436 07437 image->update(); 07438 }
|
|
Definition at line 198 of file processor.cpp. |