EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | List of all 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]

Public Member Functions

virtual void process_inplace (EMData *image)
 Make a useful tomographic phantom image. More...
 
virtual string get_name () const
 Get the processor's name. More...
 
virtual string get_desc () const
 Get the descrition of this specific processor. More...
 
- Public Member Functions inherited from EMAN::Processor
virtual ~Processor ()
 
virtual EMDataprocess (const EMData *const image)
 To proccess an image out-of-place. More...
 
virtual void process_list_inplace (vector< EMData * > &images)
 To process multiple images using the same algorithm. More...
 
virtual Dict get_params () const
 Get the processor parameters in a key/value dictionary. More...
 
virtual void set_params (const Dict &new_params)
 Set the processor parameters using a key/value dictionary. More...
 
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
 

Static Public Member Functions

static ProcessorNEW ()
 
- Static Public Member Functions inherited from EMAN::TestImageProcessor
static string get_group_desc ()
 
- Static Public Member Functions inherited from EMAN::Processor
static string get_group_desc ()
 Get the description of this group of processors. More...
 
static void EMFourierFilterInPlace (EMData *fimage, Dict params)
 Compute a Fourier-filter processed image in place. More...
 
static EMDataEMFourierFilter (EMData *fimage, Dict params)
 Compute a Fourier-processor processed image without altering the original image. More...
 

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

Additional Inherited Members

- Public Types inherited from EMAN::Processor
enum  fourier_filter_types {
  TOP_HAT_LOW_PASS , TOP_HAT_HIGH_PASS , TOP_HAT_BAND_PASS , TOP_HOMOMORPHIC ,
  GAUSS_LOW_PASS , GAUSS_HIGH_PASS , GAUSS_BAND_PASS , GAUSS_INVERSE ,
  GAUSS_HOMOMORPHIC , BUTTERWORTH_LOW_PASS , BUTTERWORTH_HIGH_PASS , BUTTERWORTH_HOMOMORPHIC ,
  KAISER_I0 , KAISER_SINH , KAISER_I0_INVERSE , KAISER_SINH_INVERSE ,
  SHIFT , TANH_LOW_PASS , TANH_HIGH_PASS , TANH_HOMOMORPHIC ,
  TANH_BAND_PASS , RADIAL_TABLE , CTF_
}
 Fourier filter Processor type enum. More...
 
- Protected Member Functions inherited from EMAN::TestImageProcessor
void preprocess (EMData *image)
 
- Protected Attributes inherited from EMAN::TestImageProcessor
int nx
 
int ny
 
int nz
 
- Protected Attributes inherited from EMAN::Processor
Dict params
 

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

Member Function Documentation

◆ get_desc()

virtual string EMAN::TestTomoImage::get_desc ( ) const
inlinevirtual

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

8307 {
8308 return "Make an image consisting various objects, useful for tomographic testing";
8309 }

◆ get_name()

virtual string EMAN::TestTomoImage::get_name ( ) const
inlinevirtual

Get the processor's name.

Each processor is identified by a unique name.

Returns
The processor's name.

Implements EMAN::Processor.

Definition at line 8301 of file processor.h.

8302 {
8303 return NAME;
8304 }
static const string NAME
Definition: processor.h:8316

References NAME.

◆ insert_hollow_ellipse()

void EMAN::TestTomoImage::insert_hollow_ellipse ( EMData image,
const Region region,
const float &  value,
const int &  radius,
const Transform t3d = Transform() 
)
private

◆ insert_rectangle()

void TestTomoImage::insert_rectangle ( EMData image,
const Region region,
const float &  value,
const Transform t3d = Transform() 
)
private

Definition at line 12238 of file processor.cpp.

12239{
12240 int startx = (int)region.origin[0] - (int)region.size[0]/2;
12241 int starty = (int)region.origin[1] - (int)region.size[1]/2;
12242 int startz = (int)region.origin[2] - (int)region.size[2]/2;
12243
12244 int endx = (int)region.origin[0] + (int)region.size[0]/2;
12245 int endy = (int)region.origin[1] + (int)region.size[1]/2;
12246 int endz = (int)region.origin[2] + (int)region.size[2]/2;
12247
12248 if ( ! t3d.is_identity() ) {
12249 float xt, yt, zt;
12250 for ( float z = (float)startz; z < (float)endz; z += 0.25f ) {
12251 for ( float y = (float)starty; y < (float)endy; y += 0.25f ) {
12252 for ( float x = (float)startx; x < (float)endx; x += 0.25f ) {
12253 xt = (float) x - region.origin[0];
12254 yt = (float) y - region.origin[1];
12255 zt = (float) z - region.origin[2];
12256 Vec3f v((float)xt,(float)yt,(float)zt);
12257 v = t3d*v;
12258 image->set_value_at((int)(v[0]+region.origin[0]),(int)(v[1]+region.origin[1]),(int)(v[2]+region.origin[2]), value);
12259 }
12260 }
12261 }
12262 } else {
12263 for ( int z = startz; z < endz; ++z ) {
12264 for ( int y = starty; y < endy; ++y ) {
12265 for ( int x = startx; x < endx; ++x ) {
12266 image->set_value_at(x,y,z, value);
12267 }
12268 }
12269 }
12270 }
12271}
FloatSize size
Definition: geometry.h:655
FloatPoint origin
Definition: geometry.h:654
bool is_identity() const
Returns whethers or this matrix is the identity.
Definition: transform.cpp:222
#define y(i, j)
Definition: projector.cpp:1516
#define x(i)
Definition: projector.cpp:1517

References EMAN::Transform::is_identity(), EMAN::Region::origin, EMAN::Region::size, x, and y.

Referenced by process_inplace().

◆ insert_solid_ellipse()

void EMAN::TestTomoImage::insert_solid_ellipse ( EMData image,
const Region region,
const float &  value,
const Transform t3d = Transform() 
)
private

◆ NEW()

static Processor * EMAN::TestTomoImage::NEW ( )
inlinestatic

Definition at line 8311 of file processor.h.

8312 {
8313 return new TestTomoImage();
8314 }
Make an image useful for tomographic reconstruction testing this is a 3D phantom image based on the 2...
Definition: processor.h:8294

◆ process_inplace()

void TestTomoImage::process_inplace ( EMData image)
virtual

Make a useful tomographic phantom image.

Parameters
imagethe image to operate upon

Implements EMAN::Processor.

Definition at line 12273 of file processor.cpp.

12274{
12275 //float nx = 240;
12276 //float ny = 240;
12277 //float nz = 60;
12278
12279 //image->set_size((int)nx,(int)ny,(int)nz);
12280 float nx = (float) image->get_xsize();
12281 float ny = (float) image->get_ysize();
12282 float nz = (float) image->get_zsize();
12283
12284 // This increment is used to simplified positioning
12285 // It's an incremental factor that matches the grid size of the paper
12286 // that I drew this design on before implementing it in code
12287 float inc = 1.0f/22.0f;
12288 float xinc = inc;
12289 float yinc = inc;
12290 float zinc = inc;
12291
12292 Dict d;
12293 d["a"] = (float) .4*nx+3;
12294 d["b"] = (float) .4*ny+3;
12295 d["c"] = (float) .4*nz+3;
12296 d["fill"] = 0.2;
12297 image->process_inplace("testimage.ellipsoid",d);
12298
12299 d["a"] = (float) .4*nx;
12300 d["b"] = (float) .4*ny;
12301 d["c"] = (float) .4*nz;
12302 d["fill"] = 0.1;
12303 image->process_inplace("testimage.ellipsoid",d);
12304
12305 // Center x, center z, bottom y ellipsoids that grow progessively smaller
12306 {
12307 Transform t;
12308 t.set_trans(0.,ny*4.0f*yinc-ny/2,0);
12309 Dict d;
12310 d["transform"] = &t;
12311 d["a"] = (float) 2.*xinc*nx;
12312 d["b"] = (float)0.5*yinc*ny;
12313 d["c"] = (float) 1.*zinc*nz;
12314 d["fill"] = 0.3;
12315 image->process_inplace("testimage.ellipsoid",d);
12316 }
12317
12318 {
12319 Transform t;
12320 t.set_trans(0.,ny*5.5f*yinc-ny/2,0);
12321 Dict d;
12322 d["transform"] = &t;
12323 d["a"] = (float) 1.5*xinc*nx;
12324 d["b"] = (float)0.5*yinc*ny;
12325 d["c"] = (float) 1.*zinc*nz;
12326 d["fill"] = 0.0;
12327 image->process_inplace("testimage.ellipsoid",d);
12328 }
12329 {
12330 Transform t;
12331 t.set_trans(0.,ny*7*yinc-ny/2,0);
12332 Dict d;
12333 d["transform"] = &t;
12334 d["a"] = (float) 1.*xinc*nx;
12335 d["b"] = (float)0.5*yinc*ny;
12336 d["c"] = (float) 1.*zinc*nz;
12337 d["fill"] = 0.3;
12338 image->process_inplace("testimage.ellipsoid",d);
12339 }
12340
12341
12342 {
12343 Transform t;
12344 t.set_trans(0.,ny*8.5f*yinc-ny/2,0);
12345 Dict d;
12346 d["transform"] = &t;
12347 d["a"] = (float) .75*xinc*nx;
12348 d["b"] = (float)0.5*yinc*ny;
12349 d["c"] = (float) 1.*zinc*nz;
12350 d["fill"] = 0.0;
12351 image->process_inplace("testimage.ellipsoid",d);
12352 }
12353
12354 // Center x, center z, bottom y ellipsoids that grow progessively smaller
12355 {
12356 Transform t;
12357 t.set_trans(0.,ny*18*yinc-ny/2,0);
12358 Dict d;
12359 d["transform"] = &t;
12360 d["a"] = (float) 2*xinc*nx;
12361 d["b"] = (float)0.5*yinc*ny;
12362 d["c"] = (float) 1.*zinc*nz;
12363 d["fill"] = 0.3;
12364 image->process_inplace("testimage.ellipsoid",d);
12365 }
12366
12367 {
12368 Transform t;
12369 t.set_trans(0.,ny*16.5f*yinc-ny/2,0);
12370 Dict d;
12371 d["transform"] = &t;
12372 d["a"] = (float) 1.5*xinc*nx;
12373 d["b"] = (float)0.5*yinc*ny;
12374 d["c"] = (float) 1.*zinc*nz;
12375 d["fill"] = 0.3;
12376 image->process_inplace("testimage.ellipsoid",d);
12377 }
12378
12379 {
12380 Transform t;
12381 t.set_trans(0.,ny*15*yinc-ny/2,0);
12382 Dict d;
12383 d["transform"] = &t;
12384 d["a"] = (float) 1*xinc*nx;
12385 d["b"] = (float)0.5*yinc*ny;
12386 d["c"] = (float) 1.*zinc*nz;
12387 d["fill"] = 0.3f;
12388 image->process_inplace("testimage.ellipsoid",d);
12389 }
12390
12391 {
12392 Transform t;
12393 t.set_trans(0.,ny*13.5f*yinc-ny/2,0);
12394 Dict d;
12395 d["transform"] = &t;
12396 d["a"] = (float).75*xinc*nx;
12397 d["b"] = (float)0.5*yinc*ny;
12398 d["c"] = (float) 1.*zinc*nz;
12399 d["fill"] = 0.3;
12400 image->process_inplace("testimage.ellipsoid",d);
12401 }
12402
12403 // Left ellipsoids from the bottom up
12404 {
12405
12406 Transform t;
12407 t.set_trans(nx*6*xinc-nx/2,ny*5*yinc-ny/2,0);
12408 Dict d;
12409 d["transform"] = &t;
12410 d["a"] = (float)1*xinc*nx;
12411 d["b"] = (float).75*yinc*ny;
12412 d["c"] = (float) .75*zinc*nz;
12413 d["fill"] = 0.25;
12414 image->process_inplace("testimage.ellipsoid",d);
12415 }
12416
12417 {
12418 Transform t;
12419 t.set_trans(nx*6*xinc-nx/2,ny*7*yinc-ny/2,0);
12420 Dict d;
12421 d["transform"] = &t;
12422 d["a"] = (float)1.5*xinc*nx;
12423 d["b"] = (float).75*yinc*ny;
12424 d["c"] = (float) .75*zinc*nz;
12425 d["fill"] = 0.25;
12426 image->process_inplace("testimage.ellipsoid",d);
12427 }
12428
12429 {
12430 Transform t;
12431 t.set_trans(nx*6*xinc-nx/2,ny*9*yinc-ny/2,0);
12432 Dict d;
12433 d["transform"] = &t;
12434 d["a"] = (float)2*xinc*nx;
12435 d["b"] = (float).75*yinc*ny;
12436 d["c"] = (float) .75*zinc*nz;
12437 d["fill"] = 0.25;
12438 image->process_inplace("testimage.ellipsoid",d);
12439 }
12440
12441 {
12442 Transform t;
12443 t.set_trans(nx*6*xinc-nx/2,ny*11*yinc-ny/2,0);
12444 Dict d;
12445 d["transform"] = &t;
12446 d["a"] = (float)2.5*xinc*nx;
12447 d["b"] = (float).75*yinc*ny;
12448 d["c"] = (float) 1*zinc*nz;
12449 d["fill"] = 0.25;
12450 image->process_inplace("testimage.ellipsoid",d);
12451 }
12452
12453 {
12454 Transform t;
12455 t.set_trans(nx*6*xinc-nx/2,ny*13*yinc-ny/2,0);
12456 Dict d;
12457 d["transform"] = &t;
12458 d["a"] = (float) 3*xinc*nx;
12459 d["b"] = (float).75*yinc*ny;
12460 d["c"] = (float) 1*zinc*nz;
12461 d["fill"] = 0.25;
12462 image->process_inplace("testimage.ellipsoid",d);
12463 }
12464
12465 // Right rectangle from the top down
12466 {
12467 Region region(nx*15.*inc,ny*17.*inc,nz/2.,1.*inc*nx,1.5*inc*ny,1.5*inc*nz);
12468 insert_rectangle(image, region, 0.25);
12469 }
12470 {
12471 Region region(nx*15.*inc,ny*15.*inc,nz/2.,1.5*inc*nx,1.5*inc*ny,1.5*inc*nz);
12472 insert_rectangle(image, region, 0.25);
12473 }
12474 {
12475 Region region(nx*15.*inc,ny*13.*inc,nz/2.,2.*inc*nx,1.5*inc*ny,1.5*inc*nz);
12476 insert_rectangle(image, region, 0.25);
12477 }
12478 {
12479 Region region(nx*15.*inc,ny*11.*inc,nz/2.,2.5*inc*nx,1.5*inc*ny,1.5*inc*nz);
12480 insert_rectangle(image, region, 0.25);
12481 }
12482 {
12483 Region region(nx*15.*inc,ny*9.*inc,nz/2.,3.*inc*nx,1.5*inc*ny,1.5*inc*nz);
12484 insert_rectangle(image, region, 0.25);
12485 }
12486
12487 // Center rotated rectangle
12488 {
12489 Region region(nx/2.,ny/2.,nz/2.,2.*inc*nx,2.5*inc*ny,1.*inc*nz);
12490 Transform t3d(Dict("type","eman","az",(float)-25.0));
12491 insert_rectangle(image, region, 0.4f, t3d);
12492 }
12493
12494 // Rotated ellipsoids
12495 {
12496 Transform t;
12497 t.set_trans(nx*6.8f*xinc-nx/2,ny*16*yinc-ny/2,0);
12498 Dict rot;
12499 rot["type"] = "eman";
12500 rot["az"] = 43.0f;
12501 t.set_rotation(rot);
12502 Dict d;
12503 d["transform"] = &t;
12504 d["a"] = (float) 1.5*xinc*nx;
12505 d["b"] = (float) .5*yinc*ny;
12506 d["c"] = (float) .5*zinc*nz;
12507 d["fill"] = 0.2;
12508 image->process_inplace("testimage.ellipsoid",d);
12509 }
12510 {
12511 Transform t;
12512 t.set_trans(nx*7.2f*xinc-nx/2,ny*16*yinc-ny/2,0);
12513 Dict rot;
12514 rot["type"] = "eman";
12515 rot["az"] = 135.0f;
12516 t.set_rotation(rot);
12517 Dict d;
12518 d["transform"] = &t;
12519 d["a"] = (float) 1.5*xinc*nx;
12520 d["b"] = (float) .5*yinc*ny;
12521 d["c"] = (float) .5*zinc*nz;
12522 d["fill"] = 0.3;
12523 image->process_inplace("testimage.ellipsoid",d);
12524 }
12525
12526 // Dense small ellipsoids
12527 {
12528 Transform t;
12529 t.set_trans(nx*3.5f*xinc-nx/2,ny*8*yinc-ny/2,0);
12530 Dict d;
12531 d["transform"] = &t;
12532 d["a"] = (float) .5*xinc*nx;
12533 d["b"] = (float) .5*yinc*ny;
12534 d["c"] = (float) .5*zinc*nz;
12535 d["fill"] = 2.05;
12536 image->process_inplace("testimage.ellipsoid",d);
12537
12538 t.set_trans(nx*8*xinc-nx/2,ny*18*yinc-ny/2,0);
12539 image->process_inplace("testimage.ellipsoid",d);
12540
12541 t.set_trans(nx*14*xinc-nx/2,ny*18.2f*yinc-ny/2,0);
12542 image->process_inplace("testimage.ellipsoid",d);
12543
12544 t.set_trans(nx*18*xinc-nx/2,ny*14*yinc-ny/2,0);
12545 image->process_inplace("testimage.ellipsoid",d);
12546
12547 t.set_trans(nx*17*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
12548 image->process_inplace("testimage.ellipsoid",d);
12549 }
12550
12551
12552 // Dense small rectangles
12553 {
12554 Region region(nx*18.*inc,ny*11.5*inc,nz/2.,1.*inc*nx,1.*inc*ny,1.*inc*nz);
12555 Transform t3d(Dict("type","eman","az",(float)45.0));
12556 insert_rectangle(image, region, 1.45f, t3d);
12557 }
12558 {
12559 Region region(nx*3.*inc,ny*10.5*inc,nz/2.,1.*inc*nx,1.*inc*ny,1.*inc*nz);
12560 Transform t3d(Dict("type","eman","az",(float)45.0));
12561 insert_rectangle(image, region, 1.45f, t3d);
12562 }
12563
12564 // Insert small cluster of spheres
12565 {
12566 Transform t;
12567 t.set_trans(nx*14*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
12568 Dict d;
12569 d["transform"] = &t;
12570 d["a"] = (float) .5*xinc*nx;
12571 d["b"] = (float) .5*yinc*ny;
12572 d["c"] = (float) .5*zinc*nz;
12573 d["fill"] = .35;
12574 image->process_inplace("testimage.ellipsoid",d);
12575 }
12576 {
12577 Transform t;
12578 t.set_trans(nx*15*xinc-nx/2,ny*7.5f*yinc-ny/2,0);
12579 Dict d;
12580 d["transform"] = &t;
12581 d["a"] = (float) .25*xinc*nx;
12582 d["b"] = (float) .25*yinc*ny;
12583 d["c"] = (float) .25*zinc*nz;
12584 d["fill"] = .35;
12585 image->process_inplace("testimage.ellipsoid",d);
12586
12587 t.set_trans(nx*13.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
12588 image->process_inplace("testimage.ellipsoid",d);
12589
12590 t.set_trans(nx*14.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
12591 image->process_inplace("testimage.ellipsoid",d);
12592
12593 t.set_trans(nx*15.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0);
12594 image->process_inplace("testimage.ellipsoid",d);
12595
12596 t.set_trans(nx*14*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
12597 image->process_inplace("testimage.ellipsoid",d);
12598
12599 t.set_trans(nx*14*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
12600 image->process_inplace("testimage.ellipsoid",d);
12601
12602 t.set_trans(nx*15*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
12603 image->process_inplace("testimage.ellipsoid",d);
12604
12605 t.set_trans(nx*16*xinc-nx/2,ny*5.5f*yinc-ny/2,0);
12606 image->process_inplace("testimage.ellipsoid",d);
12607
12608 t.set_trans(nx*14.5f*xinc-nx/2,ny*4.5f*yinc-ny/2,0);
12609 image->process_inplace("testimage.ellipsoid",d);
12610
12611 t.set_trans(nx*15.5f*xinc-nx/2,ny*4.5f*yinc-ny/2,0);
12612 image->process_inplace("testimage.ellipsoid",d);
12613 }
12614 // Insert feducials around the outside of the "cell"
12615// for ( float i = 0.; i < 3.; i += 1. ) {
12616// for ( float j = 0.; j < 3.; j += 1. ) {
12617// Region region(nx*2.+i*inc,ny*2.+j*inc,nz/2.,0.05*inc*nx,0.05*inc*ny,0.05*inc*nz);
12618// insert_solid_ellipse(image, region, 2.0);
12619// }
12620// }
12621
12622}
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
Region defines a 2D or 3D rectangular region specified by its origin coordinates and all edges' sizes...
Definition: geometry.h:497
void insert_rectangle(EMData *image, const Region &region, const float &value, const Transform &t3d=Transform())
A Transform object is a somewhat specialized object designed specifically for EMAN2/Sparx storage of ...
Definition: transform.h:75
void set_rotation(const Dict &rotation)
Set a rotation using a specific Euler type and the dictionary interface Works for all Euler types.
Definition: transform.cpp:519
void set_trans(const float &x, const float &y, const float &z=0)
Set the post translation component.
Definition: transform.cpp:1036

References insert_rectangle(), EMAN::TestImageProcessor::nx, EMAN::TestImageProcessor::ny, EMAN::TestImageProcessor::nz, EMAN::Transform::set_rotation(), and EMAN::Transform::set_trans().

Member Data Documentation

◆ NAME

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

Definition at line 8316 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files: