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

05988                         {
05989                                 return "Make an image consisting various objects, useful for tomographic testing";
05990                         }

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

05983                         {
05984                                 return NAME;
05985                         }

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

08772 {
08773         int startx = (int)region.origin[0] - (int)region.size[0]/2;
08774         int starty = (int)region.origin[1] - (int)region.size[1]/2;
08775         int startz = (int)region.origin[2] - (int)region.size[2]/2;
08776 
08777         int endx  = (int)region.origin[0] + (int)region.size[0]/2;
08778         int endy  = (int)region.origin[1] + (int)region.size[1]/2;
08779         int endz  = (int)region.origin[2] + (int)region.size[2]/2;
08780 
08781         if ( ! t3d.is_identity() ) {
08782                 float xt, yt, zt;
08783                 for ( float z = (float)startz; z < (float)endz; z += 0.25f ) {
08784                         for ( float y = (float)starty; y < (float)endy; y += 0.25f ) {
08785                                 for ( float x = (float)startx; x < (float)endx; x += 0.25f ) {
08786                                         xt = (float) x - region.origin[0];
08787                                         yt = (float) y - region.origin[1];
08788                                         zt = (float) z - region.origin[2];
08789                                         Vec3f v((float)xt,(float)yt,(float)zt);
08790                                         v = t3d*v;
08791                                         image->set_value_at((int)(v[0]+region.origin[0]),(int)(v[1]+region.origin[1]),(int)(v[2]+region.origin[2]), value);
08792                                 }
08793                         }
08794                 }
08795         } else {
08796                 for ( int z = startz; z < endz; ++z ) {
08797                         for ( int y = starty; y < endy; ++y ) {
08798                                 for ( int x = startx; x < endx; ++x ) {
08799                                         image->set_value_at(x,y,z, value);
08800                                 }
08801                         }
08802                 }
08803         }
08804 }

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

05993                         {
05994                                 return new TestTomoImage();
05995                         }

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

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


Member Data Documentation

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

Definition at line 200 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jul 12 13:51:28 2011 for EMAN2 by  doxygen 1.3.9.1