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

05982                         {
05983                                 return "Make an image consisting various objects, useful for tomographic testing";
05984                         }

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

References NAME.

05977                         {
05978                                 return NAME;
05979                         }

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

08678 {
08679         int startx = (int)region.origin[0] - (int)region.size[0]/2;
08680         int starty = (int)region.origin[1] - (int)region.size[1]/2;
08681         int startz = (int)region.origin[2] - (int)region.size[2]/2;
08682 
08683         int endx  = (int)region.origin[0] + (int)region.size[0]/2;
08684         int endy  = (int)region.origin[1] + (int)region.size[1]/2;
08685         int endz  = (int)region.origin[2] + (int)region.size[2]/2;
08686 
08687         if ( ! t3d.is_identity() ) {
08688                 float xt, yt, zt;
08689                 for ( float z = (float)startz; z < (float)endz; z += 0.25f ) {
08690                         for ( float y = (float)starty; y < (float)endy; y += 0.25f ) {
08691                                 for ( float x = (float)startx; x < (float)endx; x += 0.25f ) {
08692                                         xt = (float) x - region.origin[0];
08693                                         yt = (float) y - region.origin[1];
08694                                         zt = (float) z - region.origin[2];
08695                                         Vec3f v((float)xt,(float)yt,(float)zt);
08696                                         v = t3d*v;
08697                                         image->set_value_at((int)(v[0]+region.origin[0]),(int)(v[1]+region.origin[1]),(int)(v[2]+region.origin[2]), value);
08698                                 }
08699                         }
08700                 }
08701         } else {
08702                 for ( int z = startz; z < endz; ++z ) {
08703                         for ( int y = starty; y < endy; ++y ) {
08704                                 for ( int x = startx; x < endx; ++x ) {
08705                                         image->set_value_at(x,y,z, value);
08706                                 }
08707                         }
08708                 }
08709         }
08710 }

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

05987                         {
05988                                 return new TestTomoImage();
05989                         }

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

08713 {
08714         //float nx = 240;
08715         //float ny = 240;
08716         //float nz = 60;
08717 
08718         //image->set_size((int)nx,(int)ny,(int)nz);
08719         float nx = (float) image->get_xsize();
08720         float ny = (float) image->get_ysize();
08721         float nz = (float) image->get_zsize();
08722 
08723         // This increment is used to simplified positioning
08724         // It's an incremental factor that matches the grid size of the paper
08725         // that I drew this design on before implementing it in code
08726         float inc = 1.0f/22.0f;
08727         float xinc = inc;
08728         float yinc = inc;
08729         float zinc = inc;
08730 
08731         Dict d;
08732         d["a"] = (float) .4*nx+3;
08733         d["b"] = (float) .4*ny+3;
08734         d["c"] = (float) .4*nz+3;
08735         d["fill"] = 0.2;
08736         image->process_inplace("testimage.ellipsoid",d);
08737 
08738         d["a"] = (float) .4*nx;
08739         d["b"] = (float) .4*ny;
08740         d["c"] = (float) .4*nz;
08741         d["fill"] = 0.1;
08742         image->process_inplace("testimage.ellipsoid",d);
08743 
08744         // Center x, center z, bottom y ellipsoids that grow progessively smaller
08745         {
08746                 Transform t;
08747                 t.set_trans(0.,ny*4.0f*yinc-ny/2,0);
08748                 Dict d;
08749                 d["transform"] = &t;
08750                 d["a"] = (float) 2.*xinc*nx;
08751                 d["b"] = (float)0.5*yinc*ny;
08752                 d["c"] = (float) 1.*zinc*nz;
08753                 d["fill"] = 0.3;
08754                 image->process_inplace("testimage.ellipsoid",d);
08755         }
08756 
08757         {
08758                 Transform t;
08759                 t.set_trans(0.,ny*5.5f*yinc-ny/2,0);
08760                 Dict d;
08761                 d["transform"] = &t;
08762                 d["a"] = (float) 1.5*xinc*nx;
08763                 d["b"] = (float)0.5*yinc*ny;
08764                 d["c"] = (float) 1.*zinc*nz;
08765                 d["fill"] = 0.0;
08766                 image->process_inplace("testimage.ellipsoid",d);
08767         }
08768         {
08769                 Transform t;
08770                 t.set_trans(0.,ny*7*yinc-ny/2,0);
08771                 Dict d;
08772                 d["transform"] = &t;
08773                 d["a"] = (float) 1.*xinc*nx;
08774                 d["b"] = (float)0.5*yinc*ny;
08775                 d["c"] = (float) 1.*zinc*nz;
08776                 d["fill"] = 0.3;
08777                 image->process_inplace("testimage.ellipsoid",d);
08778         }
08779 
08780 
08781         {
08782                 Transform t;
08783                 t.set_trans(0.,ny*8.5f*yinc-ny/2,0);
08784                 Dict d;
08785                 d["transform"] = &t;
08786                 d["a"] = (float) .75*xinc*nx;
08787                 d["b"] = (float)0.5*yinc*ny;
08788                 d["c"] = (float) 1.*zinc*nz;
08789                 d["fill"] = 0.0;
08790                 image->process_inplace("testimage.ellipsoid",d);
08791         }
08792 
08793         // Center x, center z, bottom y ellipsoids that grow progessively smaller
08794         {
08795                 Transform t;
08796                 t.set_trans(0.,ny*18*yinc-ny/2,0);
08797                 Dict d;
08798                 d["transform"] = &t;
08799                 d["a"] = (float) 2*xinc*nx;
08800                 d["b"] = (float)0.5*yinc*ny;
08801                 d["c"] = (float) 1.*zinc*nz;
08802                 d["fill"] = 0.3;
08803                 image->process_inplace("testimage.ellipsoid",d);
08804         }
08805 
08806         {
08807                 Transform t;
08808                 t.set_trans(0.,ny*16.5f*yinc-ny/2,0);
08809                 Dict d;
08810                 d["transform"] = &t;
08811                 d["a"] = (float) 1.5*xinc*nx;
08812                 d["b"] = (float)0.5*yinc*ny;
08813                 d["c"] = (float) 1.*zinc*nz;
08814                 d["fill"] = 0.3;
08815                 image->process_inplace("testimage.ellipsoid",d);
08816         }
08817 
08818         {
08819                 Transform t;
08820                 t.set_trans(0.,ny*15*yinc-ny/2,0);
08821                 Dict d;
08822                 d["transform"] = &t;
08823                 d["a"] = (float) 1*xinc*nx;
08824                 d["b"] = (float)0.5*yinc*ny;
08825                 d["c"] = (float) 1.*zinc*nz;
08826                 d["fill"] = 0.3f;
08827                 image->process_inplace("testimage.ellipsoid",d);
08828         }
08829 
08830         {
08831                 Transform t;
08832                 t.set_trans(0.,ny*13.5f*yinc-ny/2,0);
08833                 Dict d;
08834                 d["transform"] = &t;
08835                 d["a"] = (float).75*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         // Left ellipsoids from the bottom up
08843         {
08844 
08845                 Transform t;
08846                 t.set_trans(nx*6*xinc-nx/2,ny*5*yinc-ny/2,0);
08847                 Dict d;
08848                 d["transform"] = &t;
08849                 d["a"] = (float)1*xinc*nx;
08850                 d["b"] = (float).75*yinc*ny;
08851                 d["c"] = (float) .75*zinc*nz;
08852                 d["fill"] = 0.25;
08853                 image->process_inplace("testimage.ellipsoid",d);
08854         }
08855 
08856         {
08857                 Transform t;
08858                 t.set_trans(nx*6*xinc-nx/2,ny*7*yinc-ny/2,0);
08859                 Dict d;
08860                 d["transform"] = &t;
08861                 d["a"] = (float)1.5*xinc*nx;
08862                 d["b"] = (float).75*yinc*ny;
08863                 d["c"] = (float) .75*zinc*nz;
08864                 d["fill"] = 0.25;
08865                 image->process_inplace("testimage.ellipsoid",d);
08866         }
08867 
08868         {
08869                 Transform t;
08870                 t.set_trans(nx*6*xinc-nx/2,ny*9*yinc-ny/2,0);
08871                 Dict d;
08872                 d["transform"] = &t;
08873                 d["a"] = (float)2*xinc*nx;
08874                 d["b"] = (float).75*yinc*ny;
08875                 d["c"] = (float) .75*zinc*nz;
08876                 d["fill"] = 0.25;
08877                 image->process_inplace("testimage.ellipsoid",d);
08878         }
08879 
08880         {
08881                 Transform t;
08882                 t.set_trans(nx*6*xinc-nx/2,ny*11*yinc-ny/2,0);
08883                 Dict d;
08884                 d["transform"] = &t;
08885                 d["a"] = (float)2.5*xinc*nx;
08886                 d["b"] = (float).75*yinc*ny;
08887                 d["c"] = (float) 1*zinc*nz;
08888                 d["fill"] = 0.25;
08889                 image->process_inplace("testimage.ellipsoid",d);
08890         }
08891 
08892         {
08893                 Transform t;
08894                 t.set_trans(nx*6*xinc-nx/2,ny*13*yinc-ny/2,0);
08895                 Dict d;
08896                 d["transform"] = &t;
08897                 d["a"] = (float) 3*xinc*nx;
08898                 d["b"] = (float).75*yinc*ny;
08899                 d["c"] = (float) 1*zinc*nz;
08900                 d["fill"] = 0.25;
08901                 image->process_inplace("testimage.ellipsoid",d);
08902         }
08903 
08904         // Right rectangle from the top down
08905         {
08906                 Region region(nx*15.*inc,ny*17.*inc,nz/2.,1.*inc*nx,1.5*inc*ny,1.5*inc*nz);
08907                 insert_rectangle(image, region, 0.25);
08908         }
08909         {
08910                 Region region(nx*15.*inc,ny*15.*inc,nz/2.,1.5*inc*nx,1.5*inc*ny,1.5*inc*nz);
08911                 insert_rectangle(image, region, 0.25);
08912         }
08913         {
08914                 Region region(nx*15.*inc,ny*13.*inc,nz/2.,2.*inc*nx,1.5*inc*ny,1.5*inc*nz);
08915                 insert_rectangle(image, region, 0.25);
08916         }
08917         {
08918                 Region region(nx*15.*inc,ny*11.*inc,nz/2.,2.5*inc*nx,1.5*inc*ny,1.5*inc*nz);
08919                 insert_rectangle(image, region, 0.25);
08920         }
08921         {
08922                 Region region(nx*15.*inc,ny*9.*inc,nz/2.,3.*inc*nx,1.5*inc*ny,1.5*inc*nz);
08923                 insert_rectangle(image, region, 0.25);
08924         }
08925 
08926         // Center rotated rectangle
08927         {
08928                 Region region(nx/2.,ny/2.,nz/2.,2.*inc*nx,2.5*inc*ny,1.*inc*nz);
08929                 Transform t3d(Dict("type","eman","az",(float)-25.0));
08930                 insert_rectangle(image, region, 0.4f, t3d);
08931         }
08932 
08933         // Rotated ellipsoids
08934         {
08935                 Transform t;
08936                 t.set_trans(nx*6.8f*xinc-nx/2,ny*16*yinc-ny/2,0);
08937                 Dict rot;
08938                 rot["type"] = "eman";
08939                 rot["az"] = 43.0f;
08940                 t.set_rotation(rot);
08941                 Dict d;
08942                 d["transform"] = &t;
08943                 d["a"] = (float) 1.5*xinc*nx;
08944                 d["b"] = (float) .5*yinc*ny;
08945                 d["c"] = (float) .5*zinc*nz;
08946                 d["fill"] = 0.2;
08947                 image->process_inplace("testimage.ellipsoid",d);
08948         }
08949         {
08950                 Transform t;
08951                 t.set_trans(nx*7.2f*xinc-nx/2,ny*16*yinc-ny/2,0);
08952                 Dict rot;
08953                 rot["type"] = "eman";
08954                 rot["az"] = 135.0f;
08955                 t.set_rotation(rot);
08956                 Dict d;
08957                 d["transform"] = &t;
08958                 d["a"] = (float) 1.5*xinc*nx;
08959                 d["b"] = (float) .5*yinc*ny;
08960                 d["c"] = (float) .5*zinc*nz;
08961                 d["fill"] = 0.3;
08962                 image->process_inplace("testimage.ellipsoid",d);
08963         }
08964 
08965         // Dense small ellipsoids
08966         {
08967                 Transform t;
08968                 t.set_trans(nx*3.5f*xinc-nx/2,ny*8*yinc-ny/2,0);
08969                 Dict d;
08970                 d["transform"] = &t;
08971                 d["a"] = (float) .5*xinc*nx;
08972                 d["b"] = (float) .5*yinc*ny;
08973                 d["c"] = (float) .5*zinc*nz;
08974                 d["fill"] = 2.05;
08975                 image->process_inplace("testimage.ellipsoid",d);
08976 
08977                 t.set_trans(nx*8*xinc-nx/2,ny*18*yinc-ny/2,0);
08978                 image->process_inplace("testimage.ellipsoid",d);
08979 
08980                 t.set_trans(nx*14*xinc-nx/2,ny*18.2f*yinc-ny/2,0);
08981                 image->process_inplace("testimage.ellipsoid",d);
08982 
08983                 t.set_trans(nx*18*xinc-nx/2,ny*14*yinc-ny/2,0);
08984                 image->process_inplace("testimage.ellipsoid",d);
08985 
08986                 t.set_trans(nx*17*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
08987                 image->process_inplace("testimage.ellipsoid",d);
08988         }
08989 
08990 
08991         // Dense small rectangles
08992         {
08993                 Region region(nx*18.*inc,ny*11.5*inc,nz/2.,1.*inc*nx,1.*inc*ny,1.*inc*nz);
08994                 Transform t3d(Dict("type","eman","az",(float)45.0));
08995                 insert_rectangle(image, region, 1.45f, t3d);
08996         }
08997         {
08998                 Region region(nx*3.*inc,ny*10.5*inc,nz/2.,1.*inc*nx,1.*inc*ny,1.*inc*nz);
08999                 Transform t3d(Dict("type","eman","az",(float)45.0));
09000                 insert_rectangle(image, region, 1.45f, t3d);
09001         }
09002 
09003         // Insert small cluster of spheres
09004         {
09005                 Transform t;
09006                 t.set_trans(nx*14*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
09007                 Dict d;
09008                 d["transform"] = &t;
09009                 d["a"] = (float) .5*xinc*nx;
09010                 d["b"] = (float) .5*yinc*ny;
09011                 d["c"] = (float) .5*zinc*nz;
09012                 d["fill"] = .35;
09013                 image->process_inplace("testimage.ellipsoid",d);
09014         }
09015         {
09016                 Transform t;
09017                 t.set_trans(nx*15*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
09018                 Dict d;
09019                 d["transform"] = &t;
09020                 d["a"] = (float) .25*xinc*nx;
09021                 d["b"] = (float) .25*yinc*ny;
09022                 d["c"] = (float) .25*zinc*nz;
09023                 d["fill"] = .35;
09024                 image->process_inplace("testimage.ellipsoid",d);
09025 
09026                 t.set_trans(nx*13.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
09027                 image->process_inplace("testimage.ellipsoid",d);
09028 
09029                 t.set_trans(nx*14.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
09030                 image->process_inplace("testimage.ellipsoid",d);
09031 
09032                 t.set_trans(nx*15.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
09033                 image->process_inplace("testimage.ellipsoid",d);
09034 
09035                 t.set_trans(nx*14*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09036                 image->process_inplace("testimage.ellipsoid",d);
09037 
09038                 t.set_trans(nx*14*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09039                 image->process_inplace("testimage.ellipsoid",d);
09040 
09041                 t.set_trans(nx*15*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09042                 image->process_inplace("testimage.ellipsoid",d);
09043 
09044                 t.set_trans(nx*16*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
09045                 image->process_inplace("testimage.ellipsoid",d);
09046 
09047                 t.set_trans(nx*14.5f*xinc-nx/2,ny*4.5f*yinc-ny/2,0);
09048                 image->process_inplace("testimage.ellipsoid",d);
09049 
09050                 t.set_trans(nx*15.5f*xinc-nx/2,ny*4.5f*yinc-ny/2,0);
09051                 image->process_inplace("testimage.ellipsoid",d);
09052         }
09053         // Insert feducials around the outside of the "cell"
09054 //      for ( float i = 0.; i < 3.; i += 1. ) {
09055 //              for ( float j = 0.; j < 3.; j += 1. ) {
09056 //                      Region region(nx*2.+i*inc,ny*2.+j*inc,nz/2.,0.05*inc*nx,0.05*inc*ny,0.05*inc*nz);
09057 //                      insert_solid_ellipse(image, region, 2.0);
09058 //              }
09059 //      }
09060 
09061 }


Member Data Documentation

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

Definition at line 5991 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Tue May 25 17:17:32 2010 for EMAN2 by  doxygen 1.4.7