#include <processor.h>
Inheritance diagram for EMAN::TransposeProcessor:
Public Member Functions | |
virtual void | process_inplace (EMData *image) |
See Processor comments for more details. | |
virtual EMData * | process (const EMData *const image) |
See Processor comments for more details. | |
virtual string | get_name () const |
Get the processor's name. | |
virtual TypeDict | get_param_types () const |
Get processor parameter information in a dictionary. | |
virtual string | get_desc () const |
Get the descrition of this specific processor. | |
Static Public Member Functions | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "xform.transpose" |
Definition at line 4421 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 4453 of file processor.h. 04454 { 04455 return "Get the transpose of an image. Works for 2D only"; 04456 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 4437 of file processor.h. 04438 {
04439 return NAME;
04440 }
|
|
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 4447 of file processor.h. 04448 { 04449 TypeDict d; 04450 return d; 04451 }
|
|
Definition at line 4442 of file processor.h. 04443 { 04444 return new TransposeProcessor(); 04445 }
|
|
See Processor comments for more details.
Reimplemented from EMAN::Processor. Definition at line 4239 of file processor.cpp. References EMAN::EMData::get_ndim(), EMAN::EMData::get_value_at(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::is_complex(), EMAN::EMData::set_value_at(), and UnexpectedBehaviorException. 04239 { 04240 if (image->get_ndim() != 2) throw UnexpectedBehaviorException("Transpose processor only works with 2D images"); 04241 if (image->is_complex()) throw UnexpectedBehaviorException("Transpose processor only works with real images"); 04242 04243 EMData* ret = new EMData(image->get_ysize(),image->get_xsize(),1); // transpose dimensions 04244 04245 for(int j = 0; j< image->get_ysize();++j) { 04246 for(int i = 0; i< image->get_xsize();++i) { 04247 ret->set_value_at(j,i,image->get_value_at(i,j)); 04248 } 04249 } 04250 04251 return ret; 04252 04253 }
|
|
See Processor comments for more details.
Implements EMAN::Processor. Definition at line 4255 of file processor.cpp. References data, EMAN::EMData::get_ndim(), EMAN::EMData::get_value_at(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::is_complex(), nx, EMAN::EMData::set_data(), and UnexpectedBehaviorException. 04255 { 04256 if (image->get_ndim() != 2) throw UnexpectedBehaviorException("Transpose processor only works with 2D images"); 04257 if (image->is_complex()) throw UnexpectedBehaviorException("Transpose processor only works with real images"); 04258 04259 float* data = (float*)malloc(image->get_ysize()*image->get_xsize()*sizeof(float)); 04260 04261 int nx = image->get_ysize(); // note tranpose 04262 for(int j = 0; j< image->get_ysize();++j) { 04263 for(int i = 0; i< image->get_xsize();++i) { 04264 data[i*nx+j] = image->get_value_at(i,j); 04265 } 04266 } 04267 04268 image->set_data(data,image->get_ysize(),image->get_xsize(),1); 04269 04270 }
|
|
Definition at line 156 of file processor.cpp. |