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

05950                         {
05951                                 return "Make an image consisting various objects, useful for tomographic testing";
05952                         }

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

References NAME.

05945                         {
05946                                 return NAME;
05947                         }

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

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

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

05955                         {
05956                                 return new TestTomoImage();
05957                         }

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

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


Member Data Documentation

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

Definition at line 5959 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon May 2 13:31:01 2011 for EMAN2 by  doxygen 1.4.7