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:

[legend]
Collaboration diagram for EMAN::TestTomoImage:
[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 5967 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 5980 of file processor.h.

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

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

05976                         {
05977                                 return NAME;
05978                         }

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

08647 {
08648         int startx = (int)region.origin[0] - (int)region.size[0]/2;
08649         int starty = (int)region.origin[1] - (int)region.size[1]/2;
08650         int startz = (int)region.origin[2] - (int)region.size[2]/2;
08651 
08652         int endx  = (int)region.origin[0] + (int)region.size[0]/2;
08653         int endy  = (int)region.origin[1] + (int)region.size[1]/2;
08654         int endz  = (int)region.origin[2] + (int)region.size[2]/2;
08655 
08656         if ( ! t3d.is_identity() ) {
08657                 float xt, yt, zt;
08658                 for ( float z = (float)startz; z < (float)endz; z += 0.25f ) {
08659                         for ( float y = (float)starty; y < (float)endy; y += 0.25f ) {
08660                                 for ( float x = (float)startx; x < (float)endx; x += 0.25f ) {
08661                                         xt = (float) x - region.origin[0];
08662                                         yt = (float) y - region.origin[1];
08663                                         zt = (float) z - region.origin[2];
08664                                         Vec3f v((float)xt,(float)yt,(float)zt);
08665                                         v = t3d*v;
08666                                         image->set_value_at((int)(v[0]+region.origin[0]),(int)(v[1]+region.origin[1]),(int)(v[2]+region.origin[2]), value);
08667                                 }
08668                         }
08669                 }
08670         } else {
08671                 for ( int z = startz; z < endz; ++z ) {
08672                         for ( int y = starty; y < endy; ++y ) {
08673                                 for ( int x = startx; x < endx; ++x ) {
08674                                         image->set_value_at(x,y,z, value);
08675                                 }
08676                         }
08677                 }
08678         }
08679 }

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

05986                         {
05987                                 return new TestTomoImage();
05988                         }

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

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


Member Data Documentation

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

Definition at line 195 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Fri Apr 30 15:39:28 2010 for EMAN2 by  doxygen 1.3.9.1