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

06022                         {
06023                                 return "Make an image consisting various objects, useful for tomographic testing";
06024                         }

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

References NAME.

06017                         {
06018                                 return NAME;
06019                         }

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

08785 {
08786         int startx = (int)region.origin[0] - (int)region.size[0]/2;
08787         int starty = (int)region.origin[1] - (int)region.size[1]/2;
08788         int startz = (int)region.origin[2] - (int)region.size[2]/2;
08789 
08790         int endx  = (int)region.origin[0] + (int)region.size[0]/2;
08791         int endy  = (int)region.origin[1] + (int)region.size[1]/2;
08792         int endz  = (int)region.origin[2] + (int)region.size[2]/2;
08793 
08794         if ( ! t3d.is_identity() ) {
08795                 float xt, yt, zt;
08796                 for ( float z = (float)startz; z < (float)endz; z += 0.25f ) {
08797                         for ( float y = (float)starty; y < (float)endy; y += 0.25f ) {
08798                                 for ( float x = (float)startx; x < (float)endx; x += 0.25f ) {
08799                                         xt = (float) x - region.origin[0];
08800                                         yt = (float) y - region.origin[1];
08801                                         zt = (float) z - region.origin[2];
08802                                         Vec3f v((float)xt,(float)yt,(float)zt);
08803                                         v = t3d*v;
08804                                         image->set_value_at((int)(v[0]+region.origin[0]),(int)(v[1]+region.origin[1]),(int)(v[2]+region.origin[2]), value);
08805                                 }
08806                         }
08807                 }
08808         } else {
08809                 for ( int z = startz; z < endz; ++z ) {
08810                         for ( int y = starty; y < endy; ++y ) {
08811                                 for ( int x = startx; x < endx; ++x ) {
08812                                         image->set_value_at(x,y,z, value);
08813                                 }
08814                         }
08815                 }
08816         }
08817 }

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

06027                         {
06028                                 return new TestTomoImage();
06029                         }

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

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


Member Data Documentation

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

Definition at line 6031 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon Jul 19 12:44:06 2010 for EMAN2 by  doxygen 1.4.7