EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
EMAN::TransposeProcessor Class Reference

Transpose a 2D image. More...

#include <processor.h>

Inheritance diagram for EMAN::TransposeProcessor:
Inheritance graph
[legend]
Collaboration diagram for EMAN::TransposeProcessor:
Collaboration graph
[legend]

Public Member Functions

virtual void process_inplace (EMData *image)
 See Processor comments for more details. More...
 
virtual EMDataprocess (const EMData *const image)
 See Processor comments for more details. More...
 
virtual string get_name () const
 Get the processor's name. More...
 
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
 
virtual string get_desc () const
 Get the descrition of this specific processor. More...
 
- Public Member Functions inherited from EMAN::Processor
virtual ~Processor ()
 
virtual void process_list_inplace (vector< EMData * > &images)
 To process multiple images using the same algorithm. More...
 
virtual Dict get_params () const
 Get the processor parameters in a key/value dictionary. More...
 
virtual void set_params (const Dict &new_params)
 Set the processor parameters using a key/value dictionary. More...
 

Static Public Member Functions

static ProcessorNEW ()
 
- Static Public Member Functions inherited from EMAN::Processor
static string get_group_desc ()
 Get the description of this group of processors. More...
 
static void EMFourierFilterInPlace (EMData *fimage, Dict params)
 Compute a Fourier-filter processed image in place. More...
 
static EMDataEMFourierFilter (EMData *fimage, Dict params)
 Compute a Fourier-processor processed image without altering the original image. More...
 

Static Public Attributes

static const string NAME = "xform.transpose"
 

Additional Inherited Members

- Public Types inherited from EMAN::Processor
enum  fourier_filter_types {
  TOP_HAT_LOW_PASS , TOP_HAT_HIGH_PASS , TOP_HAT_BAND_PASS , TOP_HOMOMORPHIC ,
  GAUSS_LOW_PASS , GAUSS_HIGH_PASS , GAUSS_BAND_PASS , GAUSS_INVERSE ,
  GAUSS_HOMOMORPHIC , BUTTERWORTH_LOW_PASS , BUTTERWORTH_HIGH_PASS , BUTTERWORTH_HOMOMORPHIC ,
  KAISER_I0 , KAISER_SINH , KAISER_I0_INVERSE , KAISER_SINH_INVERSE ,
  SHIFT , TANH_LOW_PASS , TANH_HIGH_PASS , TANH_HOMOMORPHIC ,
  TANH_BAND_PASS , RADIAL_TABLE , CTF_
}
 Fourier filter Processor type enum. More...
 
- Protected Attributes inherited from EMAN::Processor
Dict params
 

Detailed Description

Transpose a 2D image.

Author
David Woolford
Date
April 27th 2009

Definition at line 6353 of file processor.h.

Member Function Documentation

◆ get_desc()

virtual string EMAN::TransposeProcessor::get_desc ( ) const
inlinevirtual

Get the descrition of this specific processor.

This function must be overwritten by a subclass.

Returns
The description of this processor.

Implements EMAN::Processor.

Definition at line 6385 of file processor.h.

6386 {
6387 return "Get the transpose of an image. Works for 2D only";
6388 }

◆ get_name()

virtual string EMAN::TransposeProcessor::get_name ( ) const
inlinevirtual

Get the processor's name.

Each processor is identified by a unique name.

Returns
The processor's name.

Implements EMAN::Processor.

Definition at line 6369 of file processor.h.

6370 {
6371 return NAME;
6372 }
static const string NAME
Definition: processor.h:6390

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::TransposeProcessor::get_param_types ( ) const
inlinevirtual

Get processor parameter information in a dictionary.

Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.

Returns
A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 6379 of file processor.h.

6380 {
6381 TypeDict d;
6382 return d;
6383 }
TypeDict is a dictionary to store <string, EMObject::ObjectType> pair.
Definition: emobject.h:305

◆ NEW()

static Processor * EMAN::TransposeProcessor::NEW ( )
inlinestatic

Definition at line 6374 of file processor.h.

6375 {
6376 return new TransposeProcessor();
6377 }
Transpose a 2D image.
Definition: processor.h:6354

◆ process()

EMData * TransposeProcessor::process ( const EMData *const  image)
virtual

See Processor comments for more details.

Exceptions
UnexpectedBehaviorExceptionif the image is not 2D
UnexpectedBehaviorExceptionif the image is complex

Reimplemented from EMAN::Processor.

Definition at line 5722 of file processor.cpp.

5722 {
5723 if (image->get_ndim() != 2) throw UnexpectedBehaviorException("Transpose processor only works with 2D images");
5724 if (image->is_complex()) throw UnexpectedBehaviorException("Transpose processor only works with real images");
5725
5726 EMData* ret = new EMData(image->get_ysize(),image->get_xsize(),1); // transpose dimensions
5727
5728 for(int j = 0; j< image->get_ysize();++j) {
5729 for(int i = 0; i< image->get_xsize();++i) {
5730 ret->set_value_at(j,i,image->get_value_at(i,j));
5731 }
5732 }
5733
5734 return ret;
5735
5736}
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
#define UnexpectedBehaviorException(desc)
Definition: exception.h:400

References UnexpectedBehaviorException.

◆ process_inplace()

void TransposeProcessor::process_inplace ( EMData image)
virtual

See Processor comments for more details.

Exceptions
UnexpectedBehaviorExceptionif the image is not 2D
UnexpectedBehaviorExceptionif the image is complex

Implements EMAN::Processor.

Definition at line 5738 of file processor.cpp.

5738 {
5739 if (image->get_ndim() != 2) throw UnexpectedBehaviorException("Transpose processor only works with 2D images");
5740 if (image->is_complex()) throw UnexpectedBehaviorException("Transpose processor only works with real images");
5741
5742 float* data = (float*)malloc(image->get_ysize()*image->get_xsize()*sizeof(float));
5743
5744 int nx = image->get_ysize(); // note tranpose
5745 for(int j = 0; j< image->get_ysize();++j) {
5746 for(int i = 0; i< image->get_xsize();++i) {
5747 data[i*nx+j] = image->get_value_at(i,j);
5748 }
5749 }
5750
5751 image->set_data(data,image->get_ysize(),image->get_xsize(),1);
5752
5753}

References UnexpectedBehaviorException.

Member Data Documentation

◆ NAME

const string TransposeProcessor::NAME = "xform.transpose"
static

Definition at line 6390 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files: