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

06019                         {
06020                                 return "Make an image consisting various objects, useful for tomographic testing";
06021                         }

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

06014                         {
06015                                 return NAME;
06016                         }

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 8857 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().

08858 {
08859         int startx = (int)region.origin[0] - (int)region.size[0]/2;
08860         int starty = (int)region.origin[1] - (int)region.size[1]/2;
08861         int startz = (int)region.origin[2] - (int)region.size[2]/2;
08862 
08863         int endx  = (int)region.origin[0] + (int)region.size[0]/2;
08864         int endy  = (int)region.origin[1] + (int)region.size[1]/2;
08865         int endz  = (int)region.origin[2] + (int)region.size[2]/2;
08866 
08867         if ( ! t3d.is_identity() ) {
08868                 float xt, yt, zt;
08869                 for ( float z = (float)startz; z < (float)endz; z += 0.25f ) {
08870                         for ( float y = (float)starty; y < (float)endy; y += 0.25f ) {
08871                                 for ( float x = (float)startx; x < (float)endx; x += 0.25f ) {
08872                                         xt = (float) x - region.origin[0];
08873                                         yt = (float) y - region.origin[1];
08874                                         zt = (float) z - region.origin[2];
08875                                         Vec3f v((float)xt,(float)yt,(float)zt);
08876                                         v = t3d*v;
08877                                         image->set_value_at((int)(v[0]+region.origin[0]),(int)(v[1]+region.origin[1]),(int)(v[2]+region.origin[2]), value);
08878                                 }
08879                         }
08880                 }
08881         } else {
08882                 for ( int z = startz; z < endz; ++z ) {
08883                         for ( int y = starty; y < endy; ++y ) {
08884                                 for ( int x = startx; x < endx; ++x ) {
08885                                         image->set_value_at(x,y,z, value);
08886                                 }
08887                         }
08888                 }
08889         }
08890 }

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

06024                         {
06025                                 return new TestTomoImage();
06026                         }

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 8892 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.

08893 {
08894         //float nx = 240;
08895         //float ny = 240;
08896         //float nz = 60;
08897 
08898         //image->set_size((int)nx,(int)ny,(int)nz);
08899         float nx = (float) image->get_xsize();
08900         float ny = (float) image->get_ysize();
08901         float nz = (float) image->get_zsize();
08902 
08903         // This increment is used to simplified positioning
08904         // It's an incremental factor that matches the grid size of the paper
08905         // that I drew this design on before implementing it in code
08906         float inc = 1.0f/22.0f;
08907         float xinc = inc;
08908         float yinc = inc;
08909         float zinc = inc;
08910 
08911         Dict d;
08912         d["a"] = (float) .4*nx+3;
08913         d["b"] = (float) .4*ny+3;
08914         d["c"] = (float) .4*nz+3;
08915         d["fill"] = 0.2;
08916         image->process_inplace("testimage.ellipsoid",d);
08917 
08918         d["a"] = (float) .4*nx;
08919         d["b"] = (float) .4*ny;
08920         d["c"] = (float) .4*nz;
08921         d["fill"] = 0.1;
08922         image->process_inplace("testimage.ellipsoid",d);
08923 
08924         // Center x, center z, bottom y ellipsoids that grow progessively smaller
08925         {
08926                 Transform t;
08927                 t.set_trans(0.,ny*4.0f*yinc-ny/2,0);
08928                 Dict d;
08929                 d["transform"] = &t;
08930                 d["a"] = (float) 2.*xinc*nx;
08931                 d["b"] = (float)0.5*yinc*ny;
08932                 d["c"] = (float) 1.*zinc*nz;
08933                 d["fill"] = 0.3;
08934                 image->process_inplace("testimage.ellipsoid",d);
08935         }
08936 
08937         {
08938                 Transform t;
08939                 t.set_trans(0.,ny*5.5f*yinc-ny/2,0);
08940                 Dict d;
08941                 d["transform"] = &t;
08942                 d["a"] = (float) 1.5*xinc*nx;
08943                 d["b"] = (float)0.5*yinc*ny;
08944                 d["c"] = (float) 1.*zinc*nz;
08945                 d["fill"] = 0.0;
08946                 image->process_inplace("testimage.ellipsoid",d);
08947         }
08948         {
08949                 Transform t;
08950                 t.set_trans(0.,ny*7*yinc-ny/2,0);
08951                 Dict d;
08952                 d["transform"] = &t;
08953                 d["a"] = (float) 1.*xinc*nx;
08954                 d["b"] = (float)0.5*yinc*ny;
08955                 d["c"] = (float) 1.*zinc*nz;
08956                 d["fill"] = 0.3;
08957                 image->process_inplace("testimage.ellipsoid",d);
08958         }
08959 
08960 
08961         {
08962                 Transform t;
08963                 t.set_trans(0.,ny*8.5f*yinc-ny/2,0);
08964                 Dict d;
08965                 d["transform"] = &t;
08966                 d["a"] = (float) .75*xinc*nx;
08967                 d["b"] = (float)0.5*yinc*ny;
08968                 d["c"] = (float) 1.*zinc*nz;
08969                 d["fill"] = 0.0;
08970                 image->process_inplace("testimage.ellipsoid",d);
08971         }
08972 
08973         // Center x, center z, bottom y ellipsoids that grow progessively smaller
08974         {
08975                 Transform t;
08976                 t.set_trans(0.,ny*18*yinc-ny/2,0);
08977                 Dict d;
08978                 d["transform"] = &t;
08979                 d["a"] = (float) 2*xinc*nx;
08980                 d["b"] = (float)0.5*yinc*ny;
08981                 d["c"] = (float) 1.*zinc*nz;
08982                 d["fill"] = 0.3;
08983                 image->process_inplace("testimage.ellipsoid",d);
08984         }
08985 
08986         {
08987                 Transform t;
08988                 t.set_trans(0.,ny*16.5f*yinc-ny/2,0);
08989                 Dict d;
08990                 d["transform"] = &t;
08991                 d["a"] = (float) 1.5*xinc*nx;
08992                 d["b"] = (float)0.5*yinc*ny;
08993                 d["c"] = (float) 1.*zinc*nz;
08994                 d["fill"] = 0.3;
08995                 image->process_inplace("testimage.ellipsoid",d);
08996         }
08997 
08998         {
08999                 Transform t;
09000                 t.set_trans(0.,ny*15*yinc-ny/2,0);
09001                 Dict d;
09002                 d["transform"] = &t;
09003                 d["a"] = (float) 1*xinc*nx;
09004                 d["b"] = (float)0.5*yinc*ny;
09005                 d["c"] = (float) 1.*zinc*nz;
09006                 d["fill"] = 0.3f;
09007                 image->process_inplace("testimage.ellipsoid",d);
09008         }
09009 
09010         {
09011                 Transform t;
09012                 t.set_trans(0.,ny*13.5f*yinc-ny/2,0);
09013                 Dict d;
09014                 d["transform"] = &t;
09015                 d["a"] = (float).75*xinc*nx;
09016                 d["b"] = (float)0.5*yinc*ny;
09017                 d["c"] = (float) 1.*zinc*nz;
09018                 d["fill"] = 0.3;
09019                 image->process_inplace("testimage.ellipsoid",d);
09020         }
09021 
09022         // Left ellipsoids from the bottom up
09023         {
09024 
09025                 Transform t;
09026                 t.set_trans(nx*6*xinc-nx/2,ny*5*yinc-ny/2,0);
09027                 Dict d;
09028                 d["transform"] = &t;
09029                 d["a"] = (float)1*xinc*nx;
09030                 d["b"] = (float).75*yinc*ny;
09031                 d["c"] = (float) .75*zinc*nz;
09032                 d["fill"] = 0.25;
09033                 image->process_inplace("testimage.ellipsoid",d);
09034         }
09035 
09036         {
09037                 Transform t;
09038                 t.set_trans(nx*6*xinc-nx/2,ny*7*yinc-ny/2,0);
09039                 Dict d;
09040                 d["transform"] = &t;
09041                 d["a"] = (float)1.5*xinc*nx;
09042                 d["b"] = (float).75*yinc*ny;
09043                 d["c"] = (float) .75*zinc*nz;
09044                 d["fill"] = 0.25;
09045                 image->process_inplace("testimage.ellipsoid",d);
09046         }
09047 
09048         {
09049                 Transform t;
09050                 t.set_trans(nx*6*xinc-nx/2,ny*9*yinc-ny/2,0);
09051                 Dict d;
09052                 d["transform"] = &t;
09053                 d["a"] = (float)2*xinc*nx;
09054                 d["b"] = (float).75*yinc*ny;
09055                 d["c"] = (float) .75*zinc*nz;
09056                 d["fill"] = 0.25;
09057                 image->process_inplace("testimage.ellipsoid",d);
09058         }
09059 
09060         {
09061                 Transform t;
09062                 t.set_trans(nx*6*xinc-nx/2,ny*11*yinc-ny/2,0);
09063                 Dict d;
09064                 d["transform"] = &t;
09065                 d["a"] = (float)2.5*xinc*nx;
09066                 d["b"] = (float).75*yinc*ny;
09067                 d["c"] = (float) 1*zinc*nz;
09068                 d["fill"] = 0.25;
09069                 image->process_inplace("testimage.ellipsoid",d);
09070         }
09071 
09072         {
09073                 Transform t;
09074                 t.set_trans(nx*6*xinc-nx/2,ny*13*yinc-ny/2,0);
09075                 Dict d;
09076                 d["transform"] = &t;
09077                 d["a"] = (float) 3*xinc*nx;
09078                 d["b"] = (float).75*yinc*ny;
09079                 d["c"] = (float) 1*zinc*nz;
09080                 d["fill"] = 0.25;
09081                 image->process_inplace("testimage.ellipsoid",d);
09082         }
09083 
09084         // Right rectangle from the top down
09085         {
09086                 Region region(nx*15.*inc,ny*17.*inc,nz/2.,1.*inc*nx,1.5*inc*ny,1.5*inc*nz);
09087                 insert_rectangle(image, region, 0.25);
09088         }
09089         {
09090                 Region region(nx*15.*inc,ny*15.*inc,nz/2.,1.5*inc*nx,1.5*inc*ny,1.5*inc*nz);
09091                 insert_rectangle(image, region, 0.25);
09092         }
09093         {
09094                 Region region(nx*15.*inc,ny*13.*inc,nz/2.,2.*inc*nx,1.5*inc*ny,1.5*inc*nz);
09095                 insert_rectangle(image, region, 0.25);
09096         }
09097         {
09098                 Region region(nx*15.*inc,ny*11.*inc,nz/2.,2.5*inc*nx,1.5*inc*ny,1.5*inc*nz);
09099                 insert_rectangle(image, region, 0.25);
09100         }
09101         {
09102                 Region region(nx*15.*inc,ny*9.*inc,nz/2.,3.*inc*nx,1.5*inc*ny,1.5*inc*nz);
09103                 insert_rectangle(image, region, 0.25);
09104         }
09105 
09106         // Center rotated rectangle
09107         {
09108                 Region region(nx/2.,ny/2.,nz/2.,2.*inc*nx,2.5*inc*ny,1.*inc*nz);
09109                 Transform t3d(Dict("type","eman","az",(float)-25.0));
09110                 insert_rectangle(image, region, 0.4f, t3d);
09111         }
09112 
09113         // Rotated ellipsoids
09114         {
09115                 Transform t;
09116                 t.set_trans(nx*6.8f*xinc-nx/2,ny*16*yinc-ny/2,0);
09117                 Dict rot;
09118                 rot["type"] = "eman";
09119                 rot["az"] = 43.0f;
09120                 t.set_rotation(rot);
09121                 Dict d;
09122                 d["transform"] = &t;
09123                 d["a"] = (float) 1.5*xinc*nx;
09124                 d["b"] = (float) .5*yinc*ny;
09125                 d["c"] = (float) .5*zinc*nz;
09126                 d["fill"] = 0.2;
09127                 image->process_inplace("testimage.ellipsoid",d);
09128         }
09129         {
09130                 Transform t;
09131                 t.set_trans(nx*7.2f*xinc-nx/2,ny*16*yinc-ny/2,0);
09132                 Dict rot;
09133                 rot["type"] = "eman";
09134                 rot["az"] = 135.0f;
09135                 t.set_rotation(rot);
09136                 Dict d;
09137                 d["transform"] = &t;
09138                 d["a"] = (float) 1.5*xinc*nx;
09139                 d["b"] = (float) .5*yinc*ny;
09140                 d["c"] = (float) .5*zinc*nz;
09141                 d["fill"] = 0.3;
09142                 image->process_inplace("testimage.ellipsoid",d);
09143         }
09144 
09145         // Dense small ellipsoids
09146         {
09147                 Transform t;
09148                 t.set_trans(nx*3.5f*xinc-nx/2,ny*8*yinc-ny/2,0);
09149                 Dict d;
09150                 d["transform"] = &t;
09151                 d["a"] = (float) .5*xinc*nx;
09152                 d["b"] = (float) .5*yinc*ny;
09153                 d["c"] = (float) .5*zinc*nz;
09154                 d["fill"] = 2.05;
09155                 image->process_inplace("testimage.ellipsoid",d);
09156 
09157                 t.set_trans(nx*8*xinc-nx/2,ny*18*yinc-ny/2,0);
09158                 image->process_inplace("testimage.ellipsoid",d);
09159 
09160                 t.set_trans(nx*14*xinc-nx/2,ny*18.2f*yinc-ny/2,0);
09161                 image->process_inplace("testimage.ellipsoid",d);
09162 
09163                 t.set_trans(nx*18*xinc-nx/2,ny*14*yinc-ny/2,0);
09164                 image->process_inplace("testimage.ellipsoid",d);
09165 
09166                 t.set_trans(nx*17*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
09167                 image->process_inplace("testimage.ellipsoid",d);
09168         }
09169 
09170 
09171         // Dense small rectangles
09172         {
09173                 Region region(nx*18.*inc,ny*11.5*inc,nz/2.,1.*inc*nx,1.*inc*ny,1.*inc*nz);
09174                 Transform t3d(Dict("type","eman","az",(float)45.0));
09175                 insert_rectangle(image, region, 1.45f, t3d);
09176         }
09177         {
09178                 Region region(nx*3.*inc,ny*10.5*inc,nz/2.,1.*inc*nx,1.*inc*ny,1.*inc*nz);
09179                 Transform t3d(Dict("type","eman","az",(float)45.0));
09180                 insert_rectangle(image, region, 1.45f, t3d);
09181         }
09182 
09183         // Insert small cluster of spheres
09184         {
09185                 Transform t;
09186                 t.set_trans(nx*14*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
09187                 Dict d;
09188                 d["transform"] = &t;
09189                 d["a"] = (float) .5*xinc*nx;
09190                 d["b"] = (float) .5*yinc*ny;
09191                 d["c"] = (float) .5*zinc*nz;
09192                 d["fill"] = .35;
09193                 image->process_inplace("testimage.ellipsoid",d);
09194         }
09195         {
09196                 Transform t;
09197                 t.set_trans(nx*15*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
09198                 Dict d;
09199                 d["transform"] = &t;
09200                 d["a"] = (float) .25*xinc*nx;
09201                 d["b"] = (float) .25*yinc*ny;
09202                 d["c"] = (float) .25*zinc*nz;
09203                 d["fill"] = .35;
09204                 image->process_inplace("testimage.ellipsoid",d);
09205 
09206                 t.set_trans(nx*13.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
09207                 image->process_inplace("testimage.ellipsoid",d);
09208 
09209                 t.set_trans(nx*14.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
09210                 image->process_inplace("testimage.ellipsoid",d);
09211 
09212                 t.set_trans(nx*15.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
09213                 image->process_inplace("testimage.ellipsoid",d);
09214 
09215                 t.set_trans(nx*14*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09216                 image->process_inplace("testimage.ellipsoid",d);
09217 
09218                 t.set_trans(nx*14*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09219                 image->process_inplace("testimage.ellipsoid",d);
09220 
09221                 t.set_trans(nx*15*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09222                 image->process_inplace("testimage.ellipsoid",d);
09223 
09224                 t.set_trans(nx*16*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09225                 image->process_inplace("testimage.ellipsoid",d);
09226 
09227                 t.set_trans(nx*14.5f*xinc-nx/2,ny*4.5f*yinc-ny/2,0);
09228                 image->process_inplace("testimage.ellipsoid",d);
09229 
09230                 t.set_trans(nx*15.5f*xinc-nx/2,ny*4.5f*yinc-ny/2,0);
09231                 image->process_inplace("testimage.ellipsoid",d);
09232         }
09233         // Insert feducials around the outside of the "cell"
09234 //      for ( float i = 0.; i < 3.; i += 1. ) {
09235 //              for ( float j = 0.; j < 3.; j += 1. ) {
09236 //                      Region region(nx*2.+i*inc,ny*2.+j*inc,nz/2.,0.05*inc*nx,0.05*inc*ny,0.05*inc*nz);
09237 //                      insert_solid_ellipse(image, region, 2.0);
09238 //              }
09239 //      }
09240 
09241 }


Member Data Documentation

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

Definition at line 195 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Nov 17 12:46:36 2011 for EMAN2 by  doxygen 1.3.9.1