#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 4459 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 4491 of file processor.h. 04492 { 04493 return "Get the transpose of an image. Works for 2D only"; 04494 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 4475 of file processor.h. 04476 {
04477 return NAME;
04478 }
|
|
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 4485 of file processor.h. 04486 { 04487 TypeDict d; 04488 return d; 04489 }
|
|
Definition at line 4480 of file processor.h. 04481 { 04482 return new TransposeProcessor(); 04483 }
|
|
See Processor comments for more details.
Reimplemented from EMAN::Processor. Definition at line 4267 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. 04267 { 04268 if (image->get_ndim() != 2) throw UnexpectedBehaviorException("Transpose processor only works with 2D images"); 04269 if (image->is_complex()) throw UnexpectedBehaviorException("Transpose processor only works with real images"); 04270 04271 EMData* ret = new EMData(image->get_ysize(),image->get_xsize(),1); // transpose dimensions 04272 04273 for(int j = 0; j< image->get_ysize();++j) { 04274 for(int i = 0; i< image->get_xsize();++i) { 04275 ret->set_value_at(j,i,image->get_value_at(i,j)); 04276 } 04277 } 04278 04279 return ret; 04280 04281 }
|
|
See Processor comments for more details.
Implements EMAN::Processor. Definition at line 4283 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. 04283 { 04284 if (image->get_ndim() != 2) throw UnexpectedBehaviorException("Transpose processor only works with 2D images"); 04285 if (image->is_complex()) throw UnexpectedBehaviorException("Transpose processor only works with real images"); 04286 04287 float* data = (float*)malloc(image->get_ysize()*image->get_xsize()*sizeof(float)); 04288 04289 int nx = image->get_ysize(); // note tranpose 04290 for(int j = 0; j< image->get_ysize();++j) { 04291 for(int i = 0; i< image->get_xsize();++i) { 04292 data[i*nx+j] = image->get_value_at(i,j); 04293 } 04294 } 04295 04296 image->set_data(data,image->get_ysize(),image->get_xsize(),1); 04297 04298 }
|
|
Definition at line 162 of file processor.cpp. |