Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::TestTomoImage Class Reference

Make an image useful for tomographic reconstruction testing this is a 3D phantom image based on the 2D phantom described in Delaney and Bresler, "Globally convergent edge-preserving regularized reconstruction: An application to limited-angle tomography". More...

#include <processor.h>

Inheritance diagram for EMAN::TestTomoImage:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual void process_inplace (EMData *image)
 Make a useful tomographic phantom image.
virtual string get_name () const
 Get the processor's name.
virtual string get_desc () const
 Get the descrition of this specific processor.

Static Public Member Functions

ProcessorNEW ()

Static Public Attributes

const string NAME = "testimage.tomo.objects"

Private Member Functions

void insert_solid_ellipse (EMData *image, const Region &region, const float &value, const Transform &t3d=Transform())
void insert_hollow_ellipse (EMData *image, const Region &region, const float &value, const int &radius, const Transform &t3d=Transform())
void insert_rectangle (EMData *image, const Region &region, const float &value, const Transform &t3d=Transform())

Detailed Description

Make an image useful for tomographic reconstruction testing this is a 3D phantom image based on the 2D phantom described in Delaney and Bresler, "Globally convergent edge-preserving regularized reconstruction: An application to limited-angle tomography".

IEEE Transactions on Image Processing, 7(2), Feb 1998, 204-221.

Author:
David Woolford
Date:
November 2007

Definition at line 6091 of file processor.h.


Member Function Documentation

virtual string EMAN::TestTomoImage::get_desc  )  const [inline, virtual]
 

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 6104 of file processor.h.

06105                         {
06106                                 return "Make an image consisting various objects, useful for tomographic testing";
06107                         }

virtual string EMAN::TestTomoImage::get_name  )  const [inline, virtual]
 

Get the processor's name.

Each processor is identified by a unique name.

Returns:
The processor's name.

Implements EMAN::Processor.

Definition at line 6099 of file processor.h.

06100                         {
06101                                 return NAME;
06102                         }

void EMAN::TestTomoImage::insert_hollow_ellipse EMData image,
const Region region,
const float &  value,
const int &  radius,
const Transform t3d = Transform()
[private]
 

void TestTomoImage::insert_rectangle EMData image,
const Region region,
const float &  value,
const Transform t3d = Transform()
[private]
 

Definition at line 9007 of file processor.cpp.

References EMAN::Transform::is_identity(), EMAN::Region::origin, EMAN::EMData::set_value_at(), EMAN::Region::size, v, EMAN::Vec3f, x, and y.

Referenced by process_inplace().

09008 {
09009         int startx = (int)region.origin[0] - (int)region.size[0]/2;
09010         int starty = (int)region.origin[1] - (int)region.size[1]/2;
09011         int startz = (int)region.origin[2] - (int)region.size[2]/2;
09012 
09013         int endx  = (int)region.origin[0] + (int)region.size[0]/2;
09014         int endy  = (int)region.origin[1] + (int)region.size[1]/2;
09015         int endz  = (int)region.origin[2] + (int)region.size[2]/2;
09016 
09017         if ( ! t3d.is_identity() ) {
09018                 float xt, yt, zt;
09019                 for ( float z = (float)startz; z < (float)endz; z += 0.25f ) {
09020                         for ( float y = (float)starty; y < (float)endy; y += 0.25f ) {
09021                                 for ( float x = (float)startx; x < (float)endx; x += 0.25f ) {
09022                                         xt = (float) x - region.origin[0];
09023                                         yt = (float) y - region.origin[1];
09024                                         zt = (float) z - region.origin[2];
09025                                         Vec3f v((float)xt,(float)yt,(float)zt);
09026                                         v = t3d*v;
09027                                         image->set_value_at((int)(v[0]+region.origin[0]),(int)(v[1]+region.origin[1]),(int)(v[2]+region.origin[2]), value);
09028                                 }
09029                         }
09030                 }
09031         } else {
09032                 for ( int z = startz; z < endz; ++z ) {
09033                         for ( int y = starty; y < endy; ++y ) {
09034                                 for ( int x = startx; x < endx; ++x ) {
09035                                         image->set_value_at(x,y,z, value);
09036                                 }
09037                         }
09038                 }
09039         }
09040 }

void EMAN::TestTomoImage::insert_solid_ellipse EMData image,
const Region region,
const float &  value,
const Transform t3d = Transform()
[private]
 

Processor* EMAN::TestTomoImage::NEW  )  [inline, static]
 

Definition at line 6109 of file processor.h.

06110                         {
06111                                 return new TestTomoImage();
06112                         }

void TestTomoImage::process_inplace EMData image  )  [virtual]
 

Make a useful tomographic phantom image.

Parameters:
image the image to operate upon

Implements EMAN::Processor.

Definition at line 9042 of file processor.cpp.

References EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), insert_rectangle(), nx, ny, EMAN::EMData::process_inplace(), EMAN::Transform::set_rotation(), EMAN::Transform::set_trans(), and t.

09043 {
09044         //float nx = 240;
09045         //float ny = 240;
09046         //float nz = 60;
09047 
09048         //image->set_size((int)nx,(int)ny,(int)nz);
09049         float nx = (float) image->get_xsize();
09050         float ny = (float) image->get_ysize();
09051         float nz = (float) image->get_zsize();
09052 
09053         // This increment is used to simplified positioning
09054         // It's an incremental factor that matches the grid size of the paper
09055         // that I drew this design on before implementing it in code
09056         float inc = 1.0f/22.0f;
09057         float xinc = inc;
09058         float yinc = inc;
09059         float zinc = inc;
09060 
09061         Dict d;
09062         d["a"] = (float) .4*nx+3;
09063         d["b"] = (float) .4*ny+3;
09064         d["c"] = (float) .4*nz+3;
09065         d["fill"] = 0.2;
09066         image->process_inplace("testimage.ellipsoid",d);
09067 
09068         d["a"] = (float) .4*nx;
09069         d["b"] = (float) .4*ny;
09070         d["c"] = (float) .4*nz;
09071         d["fill"] = 0.1;
09072         image->process_inplace("testimage.ellipsoid",d);
09073 
09074         // Center x, center z, bottom y ellipsoids that grow progessively smaller
09075         {
09076                 Transform t;
09077                 t.set_trans(0.,ny*4.0f*yinc-ny/2,0);
09078                 Dict d;
09079                 d["transform"] = &t;
09080                 d["a"] = (float) 2.*xinc*nx;
09081                 d["b"] = (float)0.5*yinc*ny;
09082                 d["c"] = (float) 1.*zinc*nz;
09083                 d["fill"] = 0.3;
09084                 image->process_inplace("testimage.ellipsoid",d);
09085         }
09086 
09087         {
09088                 Transform t;
09089                 t.set_trans(0.,ny*5.5f*yinc-ny/2,0);
09090                 Dict d;
09091                 d["transform"] = &t;
09092                 d["a"] = (float) 1.5*xinc*nx;
09093                 d["b"] = (float)0.5*yinc*ny;
09094                 d["c"] = (float) 1.*zinc*nz;
09095                 d["fill"] = 0.0;
09096                 image->process_inplace("testimage.ellipsoid",d);
09097         }
09098         {
09099                 Transform t;
09100                 t.set_trans(0.,ny*7*yinc-ny/2,0);
09101                 Dict d;
09102                 d["transform"] = &t;
09103                 d["a"] = (float) 1.*xinc*nx;
09104                 d["b"] = (float)0.5*yinc*ny;
09105                 d["c"] = (float) 1.*zinc*nz;
09106                 d["fill"] = 0.3;
09107                 image->process_inplace("testimage.ellipsoid",d);
09108         }
09109 
09110 
09111         {
09112                 Transform t;
09113                 t.set_trans(0.,ny*8.5f*yinc-ny/2,0);
09114                 Dict d;
09115                 d["transform"] = &t;
09116                 d["a"] = (float) .75*xinc*nx;
09117                 d["b"] = (float)0.5*yinc*ny;
09118                 d["c"] = (float) 1.*zinc*nz;
09119                 d["fill"] = 0.0;
09120                 image->process_inplace("testimage.ellipsoid",d);
09121         }
09122 
09123         // Center x, center z, bottom y ellipsoids that grow progessively smaller
09124         {
09125                 Transform t;
09126                 t.set_trans(0.,ny*18*yinc-ny/2,0);
09127                 Dict d;
09128                 d["transform"] = &t;
09129                 d["a"] = (float) 2*xinc*nx;
09130                 d["b"] = (float)0.5*yinc*ny;
09131                 d["c"] = (float) 1.*zinc*nz;
09132                 d["fill"] = 0.3;
09133                 image->process_inplace("testimage.ellipsoid",d);
09134         }
09135 
09136         {
09137                 Transform t;
09138                 t.set_trans(0.,ny*16.5f*yinc-ny/2,0);
09139                 Dict d;
09140                 d["transform"] = &t;
09141                 d["a"] = (float) 1.5*xinc*nx;
09142                 d["b"] = (float)0.5*yinc*ny;
09143                 d["c"] = (float) 1.*zinc*nz;
09144                 d["fill"] = 0.3;
09145                 image->process_inplace("testimage.ellipsoid",d);
09146         }
09147 
09148         {
09149                 Transform t;
09150                 t.set_trans(0.,ny*15*yinc-ny/2,0);
09151                 Dict d;
09152                 d["transform"] = &t;
09153                 d["a"] = (float) 1*xinc*nx;
09154                 d["b"] = (float)0.5*yinc*ny;
09155                 d["c"] = (float) 1.*zinc*nz;
09156                 d["fill"] = 0.3f;
09157                 image->process_inplace("testimage.ellipsoid",d);
09158         }
09159 
09160         {
09161                 Transform t;
09162                 t.set_trans(0.,ny*13.5f*yinc-ny/2,0);
09163                 Dict d;
09164                 d["transform"] = &t;
09165                 d["a"] = (float).75*xinc*nx;
09166                 d["b"] = (float)0.5*yinc*ny;
09167                 d["c"] = (float) 1.*zinc*nz;
09168                 d["fill"] = 0.3;
09169                 image->process_inplace("testimage.ellipsoid",d);
09170         }
09171 
09172         // Left ellipsoids from the bottom up
09173         {
09174 
09175                 Transform t;
09176                 t.set_trans(nx*6*xinc-nx/2,ny*5*yinc-ny/2,0);
09177                 Dict d;
09178                 d["transform"] = &t;
09179                 d["a"] = (float)1*xinc*nx;
09180                 d["b"] = (float).75*yinc*ny;
09181                 d["c"] = (float) .75*zinc*nz;
09182                 d["fill"] = 0.25;
09183                 image->process_inplace("testimage.ellipsoid",d);
09184         }
09185 
09186         {
09187                 Transform t;
09188                 t.set_trans(nx*6*xinc-nx/2,ny*7*yinc-ny/2,0);
09189                 Dict d;
09190                 d["transform"] = &t;
09191                 d["a"] = (float)1.5*xinc*nx;
09192                 d["b"] = (float).75*yinc*ny;
09193                 d["c"] = (float) .75*zinc*nz;
09194                 d["fill"] = 0.25;
09195                 image->process_inplace("testimage.ellipsoid",d);
09196         }
09197 
09198         {
09199                 Transform t;
09200                 t.set_trans(nx*6*xinc-nx/2,ny*9*yinc-ny/2,0);
09201                 Dict d;
09202                 d["transform"] = &t;
09203                 d["a"] = (float)2*xinc*nx;
09204                 d["b"] = (float).75*yinc*ny;
09205                 d["c"] = (float) .75*zinc*nz;
09206                 d["fill"] = 0.25;
09207                 image->process_inplace("testimage.ellipsoid",d);
09208         }
09209 
09210         {
09211                 Transform t;
09212                 t.set_trans(nx*6*xinc-nx/2,ny*11*yinc-ny/2,0);
09213                 Dict d;
09214                 d["transform"] = &t;
09215                 d["a"] = (float)2.5*xinc*nx;
09216                 d["b"] = (float).75*yinc*ny;
09217                 d["c"] = (float) 1*zinc*nz;
09218                 d["fill"] = 0.25;
09219                 image->process_inplace("testimage.ellipsoid",d);
09220         }
09221 
09222         {
09223                 Transform t;
09224                 t.set_trans(nx*6*xinc-nx/2,ny*13*yinc-ny/2,0);
09225                 Dict d;
09226                 d["transform"] = &t;
09227                 d["a"] = (float) 3*xinc*nx;
09228                 d["b"] = (float).75*yinc*ny;
09229                 d["c"] = (float) 1*zinc*nz;
09230                 d["fill"] = 0.25;
09231                 image->process_inplace("testimage.ellipsoid",d);
09232         }
09233 
09234         // Right rectangle from the top down
09235         {
09236                 Region region(nx*15.*inc,ny*17.*inc,nz/2.,1.*inc*nx,1.5*inc*ny,1.5*inc*nz);
09237                 insert_rectangle(image, region, 0.25);
09238         }
09239         {
09240                 Region region(nx*15.*inc,ny*15.*inc,nz/2.,1.5*inc*nx,1.5*inc*ny,1.5*inc*nz);
09241                 insert_rectangle(image, region, 0.25);
09242         }
09243         {
09244                 Region region(nx*15.*inc,ny*13.*inc,nz/2.,2.*inc*nx,1.5*inc*ny,1.5*inc*nz);
09245                 insert_rectangle(image, region, 0.25);
09246         }
09247         {
09248                 Region region(nx*15.*inc,ny*11.*inc,nz/2.,2.5*inc*nx,1.5*inc*ny,1.5*inc*nz);
09249                 insert_rectangle(image, region, 0.25);
09250         }
09251         {
09252                 Region region(nx*15.*inc,ny*9.*inc,nz/2.,3.*inc*nx,1.5*inc*ny,1.5*inc*nz);
09253                 insert_rectangle(image, region, 0.25);
09254         }
09255 
09256         // Center rotated rectangle
09257         {
09258                 Region region(nx/2.,ny/2.,nz/2.,2.*inc*nx,2.5*inc*ny,1.*inc*nz);
09259                 Transform t3d(Dict("type","eman","az",(float)-25.0));
09260                 insert_rectangle(image, region, 0.4f, t3d);
09261         }
09262 
09263         // Rotated ellipsoids
09264         {
09265                 Transform t;
09266                 t.set_trans(nx*6.8f*xinc-nx/2,ny*16*yinc-ny/2,0);
09267                 Dict rot;
09268                 rot["type"] = "eman";
09269                 rot["az"] = 43.0f;
09270                 t.set_rotation(rot);
09271                 Dict d;
09272                 d["transform"] = &t;
09273                 d["a"] = (float) 1.5*xinc*nx;
09274                 d["b"] = (float) .5*yinc*ny;
09275                 d["c"] = (float) .5*zinc*nz;
09276                 d["fill"] = 0.2;
09277                 image->process_inplace("testimage.ellipsoid",d);
09278         }
09279         {
09280                 Transform t;
09281                 t.set_trans(nx*7.2f*xinc-nx/2,ny*16*yinc-ny/2,0);
09282                 Dict rot;
09283                 rot["type"] = "eman";
09284                 rot["az"] = 135.0f;
09285                 t.set_rotation(rot);
09286                 Dict d;
09287                 d["transform"] = &t;
09288                 d["a"] = (float) 1.5*xinc*nx;
09289                 d["b"] = (float) .5*yinc*ny;
09290                 d["c"] = (float) .5*zinc*nz;
09291                 d["fill"] = 0.3;
09292                 image->process_inplace("testimage.ellipsoid",d);
09293         }
09294 
09295         // Dense small ellipsoids
09296         {
09297                 Transform t;
09298                 t.set_trans(nx*3.5f*xinc-nx/2,ny*8*yinc-ny/2,0);
09299                 Dict d;
09300                 d["transform"] = &t;
09301                 d["a"] = (float) .5*xinc*nx;
09302                 d["b"] = (float) .5*yinc*ny;
09303                 d["c"] = (float) .5*zinc*nz;
09304                 d["fill"] = 2.05;
09305                 image->process_inplace("testimage.ellipsoid",d);
09306 
09307                 t.set_trans(nx*8*xinc-nx/2,ny*18*yinc-ny/2,0);
09308                 image->process_inplace("testimage.ellipsoid",d);
09309 
09310                 t.set_trans(nx*14*xinc-nx/2,ny*18.2f*yinc-ny/2,0);
09311                 image->process_inplace("testimage.ellipsoid",d);
09312 
09313                 t.set_trans(nx*18*xinc-nx/2,ny*14*yinc-ny/2,0);
09314                 image->process_inplace("testimage.ellipsoid",d);
09315 
09316                 t.set_trans(nx*17*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
09317                 image->process_inplace("testimage.ellipsoid",d);
09318         }
09319 
09320 
09321         // Dense small rectangles
09322         {
09323                 Region region(nx*18.*inc,ny*11.5*inc,nz/2.,1.*inc*nx,1.*inc*ny,1.*inc*nz);
09324                 Transform t3d(Dict("type","eman","az",(float)45.0));
09325                 insert_rectangle(image, region, 1.45f, t3d);
09326         }
09327         {
09328                 Region region(nx*3.*inc,ny*10.5*inc,nz/2.,1.*inc*nx,1.*inc*ny,1.*inc*nz);
09329                 Transform t3d(Dict("type","eman","az",(float)45.0));
09330                 insert_rectangle(image, region, 1.45f, t3d);
09331         }
09332 
09333         // Insert small cluster of spheres
09334         {
09335                 Transform t;
09336                 t.set_trans(nx*14*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
09337                 Dict d;
09338                 d["transform"] = &t;
09339                 d["a"] = (float) .5*xinc*nx;
09340                 d["b"] = (float) .5*yinc*ny;
09341                 d["c"] = (float) .5*zinc*nz;
09342                 d["fill"] = .35;
09343                 image->process_inplace("testimage.ellipsoid",d);
09344         }
09345         {
09346                 Transform t;
09347                 t.set_trans(nx*15*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
09348                 Dict d;
09349                 d["transform"] = &t;
09350                 d["a"] = (float) .25*xinc*nx;
09351                 d["b"] = (float) .25*yinc*ny;
09352                 d["c"] = (float) .25*zinc*nz;
09353                 d["fill"] = .35;
09354                 image->process_inplace("testimage.ellipsoid",d);
09355 
09356                 t.set_trans(nx*13.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
09357                 image->process_inplace("testimage.ellipsoid",d);
09358 
09359                 t.set_trans(nx*14.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
09360                 image->process_inplace("testimage.ellipsoid",d);
09361 
09362                 t.set_trans(nx*15.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
09363                 image->process_inplace("testimage.ellipsoid",d);
09364 
09365                 t.set_trans(nx*14*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09366                 image->process_inplace("testimage.ellipsoid",d);
09367 
09368                 t.set_trans(nx*14*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09369                 image->process_inplace("testimage.ellipsoid",d);
09370 
09371                 t.set_trans(nx*15*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09372                 image->process_inplace("testimage.ellipsoid",d);
09373 
09374                 t.set_trans(nx*16*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09375                 image->process_inplace("testimage.ellipsoid",d);
09376 
09377                 t.set_trans(nx*14.5f*xinc-nx/2,ny*4.5f*yinc-ny/2,0);
09378                 image->process_inplace("testimage.ellipsoid",d);
09379 
09380                 t.set_trans(nx*15.5f*xinc-nx/2,ny*4.5f*yinc-ny/2,0);
09381                 image->process_inplace("testimage.ellipsoid",d);
09382         }
09383         // Insert feducials around the outside of the "cell"
09384 //      for ( float i = 0.; i < 3.; i += 1. ) {
09385 //              for ( float j = 0.; j < 3.; j += 1. ) {
09386 //                      Region region(nx*2.+i*inc,ny*2.+j*inc,nz/2.,0.05*inc*nx,0.05*inc*ny,0.05*inc*nz);
09387 //                      insert_solid_ellipse(image, region, 2.0);
09388 //              }
09389 //      }
09390 
09391 }


Member Data Documentation

const string TestTomoImage::NAME = "testimage.tomo.objects" [static]
 

Definition at line 196 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jun 11 13:42:45 2013 for EMAN2 by  doxygen 1.3.9.1