#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 5872 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 5886 of file processor.h. 05887 { 05888 return "Make an image consisting of a single cross"; 05889 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5881 of file processor.h. 05882 {
05883 return NAME;
05884 }
|
|
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 5896 of file processor.h. References EMAN::TypeDict::put(). 05897 { 05898 TypeDict d; 05899 d.put("int", EMObject::FLOAT, "radius of the lines emanating from the origin"); 05900 d.put("fill", EMObject::FLOAT, "value to make non-zero pixels"); 05901 return d; 05902 }
|
|
Definition at line 5891 of file processor.h. 05892 { 05893 return new TestImageAxes(); 05894 }
|
|
Make an image where the axes (where x,y and z=0) are some nono zero value.
Implements EMAN::Processor. Definition at line 7026 of file processor.cpp. References min, nx, ny, EMAN::TestImageProcessor::preprocess(), EMAN::Dict::set_default(), and EMAN::EMData::update(). 07027 { 07028 preprocess(image); 07029 07030 float fill = params.set_default("fill", 1.0f); 07031 // get the central coordinates 07032 int cx = nx/2; 07033 int cy = ny/2; 07034 int cz = nz/2; 07035 07036 // Offsets are used to detect when "the extra pixel" needs to be filled in 07037 // They are implemented on the assumption that for odd dimensions 07038 // the "center pixel" is the center pixel, but for even dimensions the "center 07039 // pixel" is displaced in the positive direction by 1 07040 int xoffset = (nx % 2 == 0? 1:0); 07041 int yoffset = (ny % 2 == 0? 1:0); 07042 int zoffset = (nz % 2 == 0? 1:0); 07043 07044 // This should never occur - but if indeed it did occur, the code in this function 07045 // would break - the function would proceed into the final "else" and seg fault 07046 // It is commented out but left for clarity 07047 // if ( nx < 1 || ny < 1 || nz < 1 ) throw ImageDimensionException("Error: one of the image dimensions was less than zero"); 07048 07049 if ( nx == 1 && ny == 1 && nz == 1 ) 07050 { 07051 (*image)(0) = fill; 07052 } 07053 else if ( ny == 1 && nz == 1 ) 07054 { 07055 int radius = params.set_default("radius", cx ); 07056 if ( radius > cx ) radius = cx; 07057 07058 (*image)(cx) = fill; 07059 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i) = fill; 07060 for ( int i = 1; i <= radius; ++i ) (*image)(cx-i) = fill; 07061 } 07062 else if ( nz == 1 ) 07063 { 07064 int min = ( nx < ny ? nx : ny ); 07065 min /= 2; 07066 07067 int radius = params.set_default("radius", min ); 07068 if ( radius > min ) radius = min; 07069 07070 (*image)(cx,cy) = fill; 07071 07072 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i,cy) = fill; 07073 for ( int i = 1; i <= radius-yoffset; ++i )(*image)(cx,cy+i) = fill; 07074 07075 for ( int i = 1; i <= radius; ++i ) 07076 { 07077 (*image)(cx-i,cy) = fill; 07078 (*image)(cx,cy-i) = fill; 07079 } 07080 07081 } 07082 else 07083 { 07084 // nx > 1 && ny > 1 && nz > 1 07085 int min = ( nx < ny ? nx : ny ); 07086 if (nz < min ) min = nz; 07087 min /= 2; 07088 07089 int radius = params.set_default("radius", min); 07090 if ( radius > min ) radius = min; 07091 07092 07093 (*image)(cx,cy,cz) = fill; 07094 for ( int i = 1; i <=radius-xoffset; ++i ) (*image)(cx+i,cy,cz) = fill; 07095 for ( int i = 1; i <=radius-yoffset; ++i ) (*image)(cx,cy+i,cz) = fill; 07096 for ( int i = 1; i <=radius-zoffset; ++i ) (*image)(cx,cy,cz+i) = fill; 07097 for ( int i = 1; i <= radius; ++i ) 07098 { 07099 (*image)(cx-i,cy,cz) = fill; 07100 (*image)(cx,cy-i,cz) = fill; 07101 (*image)(cx,cy,cz-i) = fill; 07102 } 07103 } 07104 07105 image->update(); 07106 }
|
|
Definition at line 192 of file processor.cpp. |