#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 | |||||||
static Processor * | NEW () | ||||||
Static Public Attributes | |||||||
static const string | NAME = "xform.transpose" |
Definition at line 4496 of file processor.h.
virtual string EMAN::TransposeProcessor::get_desc | ( | ) | const [inline, virtual] |
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
Implements EMAN::Processor.
Definition at line 4528 of file processor.h.
virtual string EMAN::TransposeProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 4512 of file processor.h.
References NAME.
04513 { 04514 return NAME; 04515 }
virtual TypeDict EMAN::TransposeProcessor::get_param_types | ( | ) | const [inline, virtual] |
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 4522 of file processor.h.
04523 { 04524 TypeDict d; 04525 return d; 04526 }
static Processor* EMAN::TransposeProcessor::NEW | ( | ) | [inline, static] |
See Processor comments for more details
UnexpectedBehaviorException | if the image is not 2D | |
UnexpectedBehaviorException | if the image is complex. |
Reimplemented from EMAN::Processor.
Definition at line 4320 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.
04320 { 04321 if (image->get_ndim() != 2) throw UnexpectedBehaviorException("Transpose processor only works with 2D images"); 04322 if (image->is_complex()) throw UnexpectedBehaviorException("Transpose processor only works with real images"); 04323 04324 EMData* ret = new EMData(image->get_ysize(),image->get_xsize(),1); // transpose dimensions 04325 04326 for(int j = 0; j< image->get_ysize();++j) { 04327 for(int i = 0; i< image->get_xsize();++i) { 04328 ret->set_value_at(j,i,image->get_value_at(i,j)); 04329 } 04330 } 04331 04332 return ret; 04333 04334 }
void TransposeProcessor::process_inplace | ( | EMData * | image | ) | [virtual] |
See Processor comments for more details
UnexpectedBehaviorException | if the image is not 2D | |
UnexpectedBehaviorException | if the image is complex. |
Implements EMAN::Processor.
Definition at line 4336 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_data(), and UnexpectedBehaviorException.
04336 { 04337 if (image->get_ndim() != 2) throw UnexpectedBehaviorException("Transpose processor only works with 2D images"); 04338 if (image->is_complex()) throw UnexpectedBehaviorException("Transpose processor only works with real images"); 04339 04340 float* data = (float*)malloc(image->get_ysize()*image->get_xsize()*sizeof(float)); 04341 04342 int nx = image->get_ysize(); // note tranpose 04343 for(int j = 0; j< image->get_ysize();++j) { 04344 for(int i = 0; i< image->get_xsize();++i) { 04345 data[i*nx+j] = image->get_value_at(i,j); 04346 } 04347 } 04348 04349 image->set_data(data,image->get_ysize(),image->get_xsize(),1); 04350 04351 }
const string TransposeProcessor::NAME = "xform.transpose" [static] |