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

static ProcessorNEW ()

Static Public Attributes

static 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 5880 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 5893 of file processor.h.

05894                         {
05895                                 return "Make an image consisting various objects, useful for tomographic testing";
05896                         }

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

References NAME.

05889                         {
05890                                 return NAME;
05891                         }

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 8742 of file processor.cpp.

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

Referenced by process_inplace().

08743 {
08744         int startx = (int)region.origin[0] - (int)region.size[0]/2;
08745         int starty = (int)region.origin[1] - (int)region.size[1]/2;
08746         int startz = (int)region.origin[2] - (int)region.size[2]/2;
08747 
08748         int endx  = (int)region.origin[0] + (int)region.size[0]/2;
08749         int endy  = (int)region.origin[1] + (int)region.size[1]/2;
08750         int endz  = (int)region.origin[2] + (int)region.size[2]/2;
08751 
08752         if ( ! t3d.is_identity() ) {
08753                 float xt, yt, zt;
08754                 for ( float z = (float)startz; z < (float)endz; z += 0.25f ) {
08755                         for ( float y = (float)starty; y < (float)endy; y += 0.25f ) {
08756                                 for ( float x = (float)startx; x < (float)endx; x += 0.25f ) {
08757                                         xt = (float) x - region.origin[0];
08758                                         yt = (float) y - region.origin[1];
08759                                         zt = (float) z - region.origin[2];
08760                                         Vec3f v((float)xt,(float)yt,(float)zt);
08761                                         v = t3d*v;
08762                                         image->set_value_at((int)(v[0]+region.origin[0]),(int)(v[1]+region.origin[1]),(int)(v[2]+region.origin[2]), value);
08763                                 }
08764                         }
08765                 }
08766         } else {
08767                 for ( int z = startz; z < endz; ++z ) {
08768                         for ( int y = starty; y < endy; ++y ) {
08769                                 for ( int x = startx; x < endx; ++x ) {
08770                                         image->set_value_at(x,y,z, value);
08771                                 }
08772                         }
08773                 }
08774         }
08775 }

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

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

Definition at line 5898 of file processor.h.

05899                         {
05900                                 return new TestTomoImage();
05901                         }

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 8777 of file processor.cpp.

References EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), insert_rectangle(), EMAN::EMData::process_inplace(), and t.

08778 {
08779         //float nx = 240;
08780         //float ny = 240;
08781         //float nz = 60;
08782 
08783         //image->set_size((int)nx,(int)ny,(int)nz);
08784         float nx = (float) image->get_xsize();
08785         float ny = (float) image->get_ysize();
08786         float nz = (float) image->get_zsize();
08787 
08788         // This increment is used to simplified positioning
08789         // It's an incremental factor that matches the grid size of the paper
08790         // that I drew this design on before implementing it in code
08791         float inc = 1.0f/22.0f;
08792         float xinc = inc;
08793         float yinc = inc;
08794         float zinc = inc;
08795 
08796         Dict d;
08797         d["a"] = (float) .4*nx+3;
08798         d["b"] = (float) .4*ny+3;
08799         d["c"] = (float) .4*nz+3;
08800         d["fill"] = 0.2;
08801         image->process_inplace("testimage.ellipsoid",d);
08802 
08803         d["a"] = (float) .4*nx;
08804         d["b"] = (float) .4*ny;
08805         d["c"] = (float) .4*nz;
08806         d["fill"] = 0.1;
08807         image->process_inplace("testimage.ellipsoid",d);
08808 
08809         // Center x, center z, bottom y ellipsoids that grow progessively smaller
08810         {
08811                 Transform t;
08812                 t.set_trans(0.,ny*4.0f*yinc-ny/2,0);
08813                 Dict d;
08814                 d["transform"] = &t;
08815                 d["a"] = (float) 2.*xinc*nx;
08816                 d["b"] = (float)0.5*yinc*ny;
08817                 d["c"] = (float) 1.*zinc*nz;
08818                 d["fill"] = 0.3;
08819                 image->process_inplace("testimage.ellipsoid",d);
08820         }
08821 
08822         {
08823                 Transform t;
08824                 t.set_trans(0.,ny*5.5f*yinc-ny/2,0);
08825                 Dict d;
08826                 d["transform"] = &t;
08827                 d["a"] = (float) 1.5*xinc*nx;
08828                 d["b"] = (float)0.5*yinc*ny;
08829                 d["c"] = (float) 1.*zinc*nz;
08830                 d["fill"] = 0.0;
08831                 image->process_inplace("testimage.ellipsoid",d);
08832         }
08833         {
08834                 Transform t;
08835                 t.set_trans(0.,ny*7*yinc-ny/2,0);
08836                 Dict d;
08837                 d["transform"] = &t;
08838                 d["a"] = (float) 1.*xinc*nx;
08839                 d["b"] = (float)0.5*yinc*ny;
08840                 d["c"] = (float) 1.*zinc*nz;
08841                 d["fill"] = 0.3;
08842                 image->process_inplace("testimage.ellipsoid",d);
08843         }
08844 
08845 
08846         {
08847                 Transform t;
08848                 t.set_trans(0.,ny*8.5f*yinc-ny/2,0);
08849                 Dict d;
08850                 d["transform"] = &t;
08851                 d["a"] = (float) .75*xinc*nx;
08852                 d["b"] = (float)0.5*yinc*ny;
08853                 d["c"] = (float) 1.*zinc*nz;
08854                 d["fill"] = 0.0;
08855                 image->process_inplace("testimage.ellipsoid",d);
08856         }
08857 
08858         // Center x, center z, bottom y ellipsoids that grow progessively smaller
08859         {
08860                 Transform t;
08861                 t.set_trans(0.,ny*18*yinc-ny/2,0);
08862                 Dict d;
08863                 d["transform"] = &t;
08864                 d["a"] = (float) 2*xinc*nx;
08865                 d["b"] = (float)0.5*yinc*ny;
08866                 d["c"] = (float) 1.*zinc*nz;
08867                 d["fill"] = 0.3;
08868                 image->process_inplace("testimage.ellipsoid",d);
08869         }
08870 
08871         {
08872                 Transform t;
08873                 t.set_trans(0.,ny*16.5f*yinc-ny/2,0);
08874                 Dict d;
08875                 d["transform"] = &t;
08876                 d["a"] = (float) 1.5*xinc*nx;
08877                 d["b"] = (float)0.5*yinc*ny;
08878                 d["c"] = (float) 1.*zinc*nz;
08879                 d["fill"] = 0.3;
08880                 image->process_inplace("testimage.ellipsoid",d);
08881         }
08882 
08883         {
08884                 Transform t;
08885                 t.set_trans(0.,ny*15*yinc-ny/2,0);
08886                 Dict d;
08887                 d["transform"] = &t;
08888                 d["a"] = (float) 1*xinc*nx;
08889                 d["b"] = (float)0.5*yinc*ny;
08890                 d["c"] = (float) 1.*zinc*nz;
08891                 d["fill"] = 0.3f;
08892                 image->process_inplace("testimage.ellipsoid",d);
08893         }
08894 
08895         {
08896                 Transform t;
08897                 t.set_trans(0.,ny*13.5f*yinc-ny/2,0);
08898                 Dict d;
08899                 d["transform"] = &t;
08900                 d["a"] = (float).75*xinc*nx;
08901                 d["b"] = (float)0.5*yinc*ny;
08902                 d["c"] = (float) 1.*zinc*nz;
08903                 d["fill"] = 0.3;
08904                 image->process_inplace("testimage.ellipsoid",d);
08905         }
08906 
08907         // Left ellipsoids from the bottom up
08908         {
08909 
08910                 Transform t;
08911                 t.set_trans(nx*6*xinc-nx/2,ny*5*yinc-ny/2,0);
08912                 Dict d;
08913                 d["transform"] = &t;
08914                 d["a"] = (float)1*xinc*nx;
08915                 d["b"] = (float).75*yinc*ny;
08916                 d["c"] = (float) .75*zinc*nz;
08917                 d["fill"] = 0.25;
08918                 image->process_inplace("testimage.ellipsoid",d);
08919         }
08920 
08921         {
08922                 Transform t;
08923                 t.set_trans(nx*6*xinc-nx/2,ny*7*yinc-ny/2,0);
08924                 Dict d;
08925                 d["transform"] = &t;
08926                 d["a"] = (float)1.5*xinc*nx;
08927                 d["b"] = (float).75*yinc*ny;
08928                 d["c"] = (float) .75*zinc*nz;
08929                 d["fill"] = 0.25;
08930                 image->process_inplace("testimage.ellipsoid",d);
08931         }
08932 
08933         {
08934                 Transform t;
08935                 t.set_trans(nx*6*xinc-nx/2,ny*9*yinc-ny/2,0);
08936                 Dict d;
08937                 d["transform"] = &t;
08938                 d["a"] = (float)2*xinc*nx;
08939                 d["b"] = (float).75*yinc*ny;
08940                 d["c"] = (float) .75*zinc*nz;
08941                 d["fill"] = 0.25;
08942                 image->process_inplace("testimage.ellipsoid",d);
08943         }
08944 
08945         {
08946                 Transform t;
08947                 t.set_trans(nx*6*xinc-nx/2,ny*11*yinc-ny/2,0);
08948                 Dict d;
08949                 d["transform"] = &t;
08950                 d["a"] = (float)2.5*xinc*nx;
08951                 d["b"] = (float).75*yinc*ny;
08952                 d["c"] = (float) 1*zinc*nz;
08953                 d["fill"] = 0.25;
08954                 image->process_inplace("testimage.ellipsoid",d);
08955         }
08956 
08957         {
08958                 Transform t;
08959                 t.set_trans(nx*6*xinc-nx/2,ny*13*yinc-ny/2,0);
08960                 Dict d;
08961                 d["transform"] = &t;
08962                 d["a"] = (float) 3*xinc*nx;
08963                 d["b"] = (float).75*yinc*ny;
08964                 d["c"] = (float) 1*zinc*nz;
08965                 d["fill"] = 0.25;
08966                 image->process_inplace("testimage.ellipsoid",d);
08967         }
08968 
08969         // Right rectangle from the top down
08970         {
08971                 Region region(nx*15.*inc,ny*17.*inc,nz/2.,1.*inc*nx,1.5*inc*ny,1.5*inc*nz);
08972                 insert_rectangle(image, region, 0.25);
08973         }
08974         {
08975                 Region region(nx*15.*inc,ny*15.*inc,nz/2.,1.5*inc*nx,1.5*inc*ny,1.5*inc*nz);
08976                 insert_rectangle(image, region, 0.25);
08977         }
08978         {
08979                 Region region(nx*15.*inc,ny*13.*inc,nz/2.,2.*inc*nx,1.5*inc*ny,1.5*inc*nz);
08980                 insert_rectangle(image, region, 0.25);
08981         }
08982         {
08983                 Region region(nx*15.*inc,ny*11.*inc,nz/2.,2.5*inc*nx,1.5*inc*ny,1.5*inc*nz);
08984                 insert_rectangle(image, region, 0.25);
08985         }
08986         {
08987                 Region region(nx*15.*inc,ny*9.*inc,nz/2.,3.*inc*nx,1.5*inc*ny,1.5*inc*nz);
08988                 insert_rectangle(image, region, 0.25);
08989         }
08990 
08991         // Center rotated rectangle
08992         {
08993                 Region region(nx/2.,ny/2.,nz/2.,2.*inc*nx,2.5*inc*ny,1.*inc*nz);
08994                 Transform t3d(Dict("type","eman","az",(float)-25.0));
08995                 insert_rectangle(image, region, 0.4f, t3d);
08996         }
08997 
08998         // Rotated ellipsoids
08999         {
09000                 Transform t;
09001                 t.set_trans(nx*6.8f*xinc-nx/2,ny*16*yinc-ny/2,0);
09002                 Dict rot;
09003                 rot["type"] = "eman";
09004                 rot["az"] = 43.0f;
09005                 t.set_rotation(rot);
09006                 Dict d;
09007                 d["transform"] = &t;
09008                 d["a"] = (float) 1.5*xinc*nx;
09009                 d["b"] = (float) .5*yinc*ny;
09010                 d["c"] = (float) .5*zinc*nz;
09011                 d["fill"] = 0.2;
09012                 image->process_inplace("testimage.ellipsoid",d);
09013         }
09014         {
09015                 Transform t;
09016                 t.set_trans(nx*7.2f*xinc-nx/2,ny*16*yinc-ny/2,0);
09017                 Dict rot;
09018                 rot["type"] = "eman";
09019                 rot["az"] = 135.0f;
09020                 t.set_rotation(rot);
09021                 Dict d;
09022                 d["transform"] = &t;
09023                 d["a"] = (float) 1.5*xinc*nx;
09024                 d["b"] = (float) .5*yinc*ny;
09025                 d["c"] = (float) .5*zinc*nz;
09026                 d["fill"] = 0.3;
09027                 image->process_inplace("testimage.ellipsoid",d);
09028         }
09029 
09030         // Dense small ellipsoids
09031         {
09032                 Transform t;
09033                 t.set_trans(nx*3.5f*xinc-nx/2,ny*8*yinc-ny/2,0);
09034                 Dict d;
09035                 d["transform"] = &t;
09036                 d["a"] = (float) .5*xinc*nx;
09037                 d["b"] = (float) .5*yinc*ny;
09038                 d["c"] = (float) .5*zinc*nz;
09039                 d["fill"] = 2.05;
09040                 image->process_inplace("testimage.ellipsoid",d);
09041 
09042                 t.set_trans(nx*8*xinc-nx/2,ny*18*yinc-ny/2,0);
09043                 image->process_inplace("testimage.ellipsoid",d);
09044 
09045                 t.set_trans(nx*14*xinc-nx/2,ny*18.2f*yinc-ny/2,0);
09046                 image->process_inplace("testimage.ellipsoid",d);
09047 
09048                 t.set_trans(nx*18*xinc-nx/2,ny*14*yinc-ny/2,0);
09049                 image->process_inplace("testimage.ellipsoid",d);
09050 
09051                 t.set_trans(nx*17*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
09052                 image->process_inplace("testimage.ellipsoid",d);
09053         }
09054 
09055 
09056         // Dense small rectangles
09057         {
09058                 Region region(nx*18.*inc,ny*11.5*inc,nz/2.,1.*inc*nx,1.*inc*ny,1.*inc*nz);
09059                 Transform t3d(Dict("type","eman","az",(float)45.0));
09060                 insert_rectangle(image, region, 1.45f, t3d);
09061         }
09062         {
09063                 Region region(nx*3.*inc,ny*10.5*inc,nz/2.,1.*inc*nx,1.*inc*ny,1.*inc*nz);
09064                 Transform t3d(Dict("type","eman","az",(float)45.0));
09065                 insert_rectangle(image, region, 1.45f, t3d);
09066         }
09067 
09068         // Insert small cluster of spheres
09069         {
09070                 Transform t;
09071                 t.set_trans(nx*14*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
09072                 Dict d;
09073                 d["transform"] = &t;
09074                 d["a"] = (float) .5*xinc*nx;
09075                 d["b"] = (float) .5*yinc*ny;
09076                 d["c"] = (float) .5*zinc*nz;
09077                 d["fill"] = .35;
09078                 image->process_inplace("testimage.ellipsoid",d);
09079         }
09080         {
09081                 Transform t;
09082                 t.set_trans(nx*15*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
09083                 Dict d;
09084                 d["transform"] = &t;
09085                 d["a"] = (float) .25*xinc*nx;
09086                 d["b"] = (float) .25*yinc*ny;
09087                 d["c"] = (float) .25*zinc*nz;
09088                 d["fill"] = .35;
09089                 image->process_inplace("testimage.ellipsoid",d);
09090 
09091                 t.set_trans(nx*13.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
09092                 image->process_inplace("testimage.ellipsoid",d);
09093 
09094                 t.set_trans(nx*14.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
09095                 image->process_inplace("testimage.ellipsoid",d);
09096 
09097                 t.set_trans(nx*15.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
09098                 image->process_inplace("testimage.ellipsoid",d);
09099 
09100                 t.set_trans(nx*14*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09101                 image->process_inplace("testimage.ellipsoid",d);
09102 
09103                 t.set_trans(nx*14*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09104                 image->process_inplace("testimage.ellipsoid",d);
09105 
09106                 t.set_trans(nx*15*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09107                 image->process_inplace("testimage.ellipsoid",d);
09108 
09109                 t.set_trans(nx*16*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09110                 image->process_inplace("testimage.ellipsoid",d);
09111 
09112                 t.set_trans(nx*14.5f*xinc-nx/2,ny*4.5f*yinc-ny/2,0);
09113                 image->process_inplace("testimage.ellipsoid",d);
09114 
09115                 t.set_trans(nx*15.5f*xinc-nx/2,ny*4.5f*yinc-ny/2,0);
09116                 image->process_inplace("testimage.ellipsoid",d);
09117         }
09118         // Insert feducials around the outside of the "cell"
09119 //      for ( float i = 0.; i < 3.; i += 1. ) {
09120 //              for ( float j = 0.; j < 3.; j += 1. ) {
09121 //                      Region region(nx*2.+i*inc,ny*2.+j*inc,nz/2.,0.05*inc*nx,0.05*inc*ny,0.05*inc*nz);
09122 //                      insert_solid_ellipse(image, region, 2.0);
09123 //              }
09124 //      }
09125 
09126 }


Member Data Documentation

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

Definition at line 5903 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon Mar 7 18:03:19 2011 for EMAN2 by  doxygen 1.4.7