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

Generate an ellipse/ellipsoid image with an inner hollow ellipse/ellipsoid. More...

#include <processor.h>

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

Public Member Functions

virtual void process_inplace (EMData *image)
 To process an image in-place. More...
 
virtual string get_name () const
 Get the processor's name. More...
 
virtual string get_desc () const
 Get the descrition of this specific processor. More...
 
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
 
- Public Member Functions inherited from EMAN::Processor
virtual ~Processor ()
 
virtual EMDataprocess (const EMData *const image)
 To proccess an image out-of-place. More...
 
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::TestImageProcessor
static string get_group_desc ()
 
- 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 = "testimage.ellipsoid.hollow"
 

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 Member Functions inherited from EMAN::TestImageProcessor
void preprocess (EMData *image)
 
- Protected Attributes inherited from EMAN::TestImageProcessor
int nx
 
int ny
 
int nz
 
- Protected Attributes inherited from EMAN::Processor
Dict params
 

Detailed Description

Generate an ellipse/ellipsoid image with an inner hollow ellipse/ellipsoid.

Parameters
xwidthinner equatorial radii along x axes
ywidthinner equatorial radii along y axes
zwidthinner polar radius
aoutter equatorial radii along x axes
boutter equatorial radii along y axes
coutter polar radius
widthspecify the width or specify each width explicitly - xwidth, ywidth, zwidth
transformOptionally transform the ellipse
fillvalue you want to fill in hollow ellipse, default to 1.0

Definition at line 8689 of file processor.h.

Member Function Documentation

◆ get_desc()

virtual string EMAN::TestImageHollowEllipse::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 8699 of file processor.h.

8700 {
8701 return "Insert a hollow ellipse into the image.";
8702 }

◆ get_name()

virtual string EMAN::TestImageHollowEllipse::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 8694 of file processor.h.

8695 {
8696 return NAME;
8697 }
static const string NAME
Definition: processor.h:8724

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::TestImageHollowEllipse::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 8709 of file processor.h.

8710 {
8711 TypeDict d;
8712 d.put("xwidth", EMObject::FLOAT, "inner equatorial radii along x axes");
8713 d.put("ywidth", EMObject::FLOAT, "inner equatorial radii along y axes");
8714 d.put("zwidth", EMObject::FLOAT, "inner polar radius");
8715 d.put("a", EMObject::FLOAT, "outter equatorial radii along x axes");
8716 d.put("b", EMObject::FLOAT, "outter equatorial radii along y axes");
8717 d.put("c", EMObject::FLOAT, "outter polar radius");
8718 d.put("width",EMObject::FLOAT, "width - specify the width or specify each width explicitly - xwidth, ywidth, zwidth");
8719 d.put("transform", EMObject::TRANSFORM, "Optionally transform the ellipse");
8720 d.put("fill", EMObject::FLOAT, "value you want to fill in hollow ellipse, default to 1.0");
8721 return d;
8722 }
TypeDict is a dictionary to store <string, EMObject::ObjectType> pair.
Definition: emobject.h:305
void put(const string &key, EMObject::ObjectType o, const string &desc="")
Definition: emobject.h:330

References EMAN::EMObject::FLOAT, EMAN::TypeDict::put(), and EMAN::EMObject::TRANSFORM.

◆ NEW()

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

Definition at line 8704 of file processor.h.

8705 {
8706 return new TestImageHollowEllipse();
8707 }
Generate an ellipse/ellipsoid image with an inner hollow ellipse/ellipsoid.
Definition: processor.h:8690

◆ process_inplace()

void TestImageHollowEllipse::process_inplace ( EMData image)
virtual

To process an image in-place.

For those processors which can only be processed out-of-place, override this function to just print out some error message to remind user call the out-of-place version.

Parameters
imageThe image to be processed.

Implements EMAN::Processor.

Definition at line 9881 of file processor.cpp.

9882{
9883 preprocess(image);
9884 image->to_zero(); // The testimage processors are supposed to replace the image contents
9885
9886 float width = params.set_default("width",2.0f);
9887
9888 float a2 = params.set_default("a",nx/2.0f-1.0f);
9889 float b2 = params.set_default("b",ny/2.0f-1.0f);
9890 float c2 = params.set_default("c",nz/2.0f-1.0f);
9891
9892 float a1 = params.set_default("xwidth",a2-width);
9893 float b1 = params.set_default("ywidth",b2-width);
9894 float c1 = params.set_default("zwidth",c2-width);
9895
9896 float fill = params.set_default("fill",1.0f);
9897 Transform* t;
9898 if (params.has_key("transform")) {
9899 t = params["transform"];
9900 } else {
9901 t = new Transform;
9902 }
9903
9904
9905 int mz = 2*(int)c2+1;
9906 if ( nz < mz ) mz = nz;
9907 int my = 2*(int)b2+1;
9908 if ( ny < my ) my = ny;
9909 int mx = 2*(int)a2+1;
9910 if ( nx < mx ) mx = nx;
9911
9912 float ai1 = 1/(a1*a1);
9913 float bi1 = 1/(b1*b1);
9914 float ci1 = 1/(c1*c1);
9915
9916 float ai2 = 1/(a2*a2);
9917 float bi2 = 1/(b2*b2);
9918 float ci2 = 1/(c2*c2);
9919
9920 Vec3f origin(nx/2,ny/2,nz/2);
9921
9922 float x2, y2, z2, r1,r2;
9923 int xl, yl, zl;
9924 for (int k = 0; k < mz; ++k) {
9925 for (int j = 0; j < my; ++j) {
9926 for (int i = 0; i < mx; ++i) {
9927 x2 = (float)(i - mx/2);
9928 y2 = (float)(j - my/2);
9929 z2 = (float)(k - mz/2);
9930 r1 = (x2*x2)*ai1 + (y2*y2)*bi1 + (z2*z2)*ci1;
9931 r2 = (x2*x2)*ai2 + (y2*y2)*bi2 + (z2*z2)*ci2;
9932 if (r2 <= 1 && r1 >= 1) {
9933
9934 if (t != 0) {
9935 Vec3f v(x2,y2,z2);
9936 v = (*t)*v;
9937 v += origin;
9938
9939 // THIS ISN'T THE BEST STRATEGY BUT IT'S A STOP GAP. A FLOOD FILL IS PROBABLY BETTER
9940 // I fill in 3x3 cubes to make sure there are no gaps...
9941
9942 for( int kk = -1; kk <= 1; ++kk)
9943 for( int jj = -1; jj <= 1; ++jj)
9944 for( int ii = -1; ii <= 1; ++ii) {
9945 xl = (int)v[0]+ii;
9946 yl = (int)v[1]+jj;
9947 zl = (int)v[2]+kk;
9948 if (xl >= 0 && xl < nx && yl >= 0 && yl < ny && zl >= 0 && zl < nz)
9949 image->set_value_at(xl,yl,zl,1.0);
9950 }
9951 } else {
9952 image->set_value_at((int)x2+nx/2,(int)y2+ny/2,(int)z2+nz/2,fill);
9953 }
9954 }
9955 }
9956 }
9957 }
9958
9959 delete t;
9960
9961 image->update();
9962}
type set_default(const string &key, type val)
Default setting behavior This can be achieved using a template - d.woolford Jan 2008 (before there wa...
Definition: emobject.h:569
bool has_key(const string &key) const
Ask the Dictionary if it as a particular key.
Definition: emobject.h:511
void preprocess(EMData *image)
Definition: processor.cpp:8923
A Transform object is a somewhat specialized object designed specifically for EMAN2/Sparx storage of ...
Definition: transform.h:75

References EMAN::Dict::has_key(), EMAN::TestImageProcessor::nx, EMAN::TestImageProcessor::ny, EMAN::TestImageProcessor::nz, EMAN::Processor::params, EMAN::TestImageProcessor::preprocess(), and EMAN::Dict::set_default().

Member Data Documentation

◆ NAME

const string TestImageHollowEllipse::NAME = "testimage.ellipsoid.hollow"
static

Definition at line 8724 of file processor.h.

Referenced by get_name().


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