#include <processor.h>
Inheritance diagram for EMAN::TestTomoImage:
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 | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "testimage.tomo.objects" |
Private Member Functions | |
void | insert_solid_ellipse (EMData *image, const Region ®ion, const float &value, const Transform &t3d=Transform()) |
void | insert_hollow_ellipse (EMData *image, const Region ®ion, const float &value, const int &radius, const Transform &t3d=Transform()) |
void | insert_rectangle (EMData *image, const Region ®ion, const float &value, const Transform &t3d=Transform()) |
IEEE Transactions on Image Processing, 7(2), Feb 1998, 204-221.
Definition at line 5795 of file processor.h.
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 5808 of file processor.h. 05809 { 05810 return "Make an image consisting various objects, useful for tomographic testing"; 05811 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5803 of file processor.h. 05804 {
05805 return NAME;
05806 }
|
|
|
|
Definition at line 8692 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(). 08693 { 08694 int startx = (int)region.origin[0] - (int)region.size[0]/2; 08695 int starty = (int)region.origin[1] - (int)region.size[1]/2; 08696 int startz = (int)region.origin[2] - (int)region.size[2]/2; 08697 08698 int endx = (int)region.origin[0] + (int)region.size[0]/2; 08699 int endy = (int)region.origin[1] + (int)region.size[1]/2; 08700 int endz = (int)region.origin[2] + (int)region.size[2]/2; 08701 08702 if ( ! t3d.is_identity() ) { 08703 float xt, yt, zt; 08704 for ( float z = (float)startz; z < (float)endz; z += 0.25f ) { 08705 for ( float y = (float)starty; y < (float)endy; y += 0.25f ) { 08706 for ( float x = (float)startx; x < (float)endx; x += 0.25f ) { 08707 xt = (float) x - region.origin[0]; 08708 yt = (float) y - region.origin[1]; 08709 zt = (float) z - region.origin[2]; 08710 Vec3f v((float)xt,(float)yt,(float)zt); 08711 v = t3d*v; 08712 image->set_value_at((int)(v[0]+region.origin[0]),(int)(v[1]+region.origin[1]),(int)(v[2]+region.origin[2]), value); 08713 } 08714 } 08715 } 08716 } else { 08717 for ( int z = startz; z < endz; ++z ) { 08718 for ( int y = starty; y < endy; ++y ) { 08719 for ( int x = startx; x < endx; ++x ) { 08720 image->set_value_at(x,y,z, value); 08721 } 08722 } 08723 } 08724 } 08725 }
|
|
|
|
Definition at line 5813 of file processor.h. 05814 { 05815 return new TestTomoImage(); 05816 }
|
|
Make a useful tomographic phantom image.
Implements EMAN::Processor. Definition at line 8727 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. 08728 { 08729 //float nx = 240; 08730 //float ny = 240; 08731 //float nz = 60; 08732 08733 //image->set_size((int)nx,(int)ny,(int)nz); 08734 float nx = (float) image->get_xsize(); 08735 float ny = (float) image->get_ysize(); 08736 float nz = (float) image->get_zsize(); 08737 08738 // This increment is used to simplified positioning 08739 // It's an incremental factor that matches the grid size of the paper 08740 // that I drew this design on before implementing it in code 08741 float inc = 1.0f/22.0f; 08742 float xinc = inc; 08743 float yinc = inc; 08744 float zinc = inc; 08745 08746 Dict d; 08747 d["a"] = (float) .4*nx+3; 08748 d["b"] = (float) .4*ny+3; 08749 d["c"] = (float) .4*nz+3; 08750 d["fill"] = 0.2; 08751 image->process_inplace("testimage.ellipsoid",d); 08752 08753 d["a"] = (float) .4*nx; 08754 d["b"] = (float) .4*ny; 08755 d["c"] = (float) .4*nz; 08756 d["fill"] = 0.1; 08757 image->process_inplace("testimage.ellipsoid",d); 08758 08759 // Center x, center z, bottom y ellipsoids that grow progessively smaller 08760 { 08761 Transform t; 08762 t.set_trans(0.,ny*4.0f*yinc-ny/2,0); 08763 Dict d; 08764 d["transform"] = &t; 08765 d["a"] = (float) 2.*xinc*nx; 08766 d["b"] = (float)0.5*yinc*ny; 08767 d["c"] = (float) 1.*zinc*nz; 08768 d["fill"] = 0.3; 08769 image->process_inplace("testimage.ellipsoid",d); 08770 } 08771 08772 { 08773 Transform t; 08774 t.set_trans(0.,ny*5.5f*yinc-ny/2,0); 08775 Dict d; 08776 d["transform"] = &t; 08777 d["a"] = (float) 1.5*xinc*nx; 08778 d["b"] = (float)0.5*yinc*ny; 08779 d["c"] = (float) 1.*zinc*nz; 08780 d["fill"] = 0.0; 08781 image->process_inplace("testimage.ellipsoid",d); 08782 } 08783 { 08784 Transform t; 08785 t.set_trans(0.,ny*7*yinc-ny/2,0); 08786 Dict d; 08787 d["transform"] = &t; 08788 d["a"] = (float) 1.*xinc*nx; 08789 d["b"] = (float)0.5*yinc*ny; 08790 d["c"] = (float) 1.*zinc*nz; 08791 d["fill"] = 0.3; 08792 image->process_inplace("testimage.ellipsoid",d); 08793 } 08794 08795 08796 { 08797 Transform t; 08798 t.set_trans(0.,ny*8.5f*yinc-ny/2,0); 08799 Dict d; 08800 d["transform"] = &t; 08801 d["a"] = (float) .75*xinc*nx; 08802 d["b"] = (float)0.5*yinc*ny; 08803 d["c"] = (float) 1.*zinc*nz; 08804 d["fill"] = 0.0; 08805 image->process_inplace("testimage.ellipsoid",d); 08806 } 08807 08808 // Center x, center z, bottom y ellipsoids that grow progessively smaller 08809 { 08810 Transform t; 08811 t.set_trans(0.,ny*18*yinc-ny/2,0); 08812 Dict d; 08813 d["transform"] = &t; 08814 d["a"] = (float) 2*xinc*nx; 08815 d["b"] = (float)0.5*yinc*ny; 08816 d["c"] = (float) 1.*zinc*nz; 08817 d["fill"] = 0.3; 08818 image->process_inplace("testimage.ellipsoid",d); 08819 } 08820 08821 { 08822 Transform t; 08823 t.set_trans(0.,ny*16.5f*yinc-ny/2,0); 08824 Dict d; 08825 d["transform"] = &t; 08826 d["a"] = (float) 1.5*xinc*nx; 08827 d["b"] = (float)0.5*yinc*ny; 08828 d["c"] = (float) 1.*zinc*nz; 08829 d["fill"] = 0.3; 08830 image->process_inplace("testimage.ellipsoid",d); 08831 } 08832 08833 { 08834 Transform t; 08835 t.set_trans(0.,ny*15*yinc-ny/2,0); 08836 Dict d; 08837 d["transform"] = &t; 08838 d["a"] = (float) 1*xinc*nx; 08839 d["b"] = (float)0.5*yinc*ny; 08840 d["c"] = (float) 1.*zinc*nz; 08841 d["fill"] = 0.3f; 08842 image->process_inplace("testimage.ellipsoid",d); 08843 } 08844 08845 { 08846 Transform t; 08847 t.set_trans(0.,ny*13.5f*yinc-ny/2,0); 08848 Dict d; 08849 d["transform"] = &t; 08850 d["a"] = (float).75*xinc*nx; 08851 d["b"] = (float)0.5*yinc*ny; 08852 d["c"] = (float) 1.*zinc*nz; 08853 d["fill"] = 0.3; 08854 image->process_inplace("testimage.ellipsoid",d); 08855 } 08856 08857 // Left ellipsoids from the bottom up 08858 { 08859 08860 Transform t; 08861 t.set_trans(nx*6*xinc-nx/2,ny*5*yinc-ny/2,0); 08862 Dict d; 08863 d["transform"] = &t; 08864 d["a"] = (float)1*xinc*nx; 08865 d["b"] = (float).75*yinc*ny; 08866 d["c"] = (float) .75*zinc*nz; 08867 d["fill"] = 0.25; 08868 image->process_inplace("testimage.ellipsoid",d); 08869 } 08870 08871 { 08872 Transform t; 08873 t.set_trans(nx*6*xinc-nx/2,ny*7*yinc-ny/2,0); 08874 Dict d; 08875 d["transform"] = &t; 08876 d["a"] = (float)1.5*xinc*nx; 08877 d["b"] = (float).75*yinc*ny; 08878 d["c"] = (float) .75*zinc*nz; 08879 d["fill"] = 0.25; 08880 image->process_inplace("testimage.ellipsoid",d); 08881 } 08882 08883 { 08884 Transform t; 08885 t.set_trans(nx*6*xinc-nx/2,ny*9*yinc-ny/2,0); 08886 Dict d; 08887 d["transform"] = &t; 08888 d["a"] = (float)2*xinc*nx; 08889 d["b"] = (float).75*yinc*ny; 08890 d["c"] = (float) .75*zinc*nz; 08891 d["fill"] = 0.25; 08892 image->process_inplace("testimage.ellipsoid",d); 08893 } 08894 08895 { 08896 Transform t; 08897 t.set_trans(nx*6*xinc-nx/2,ny*11*yinc-ny/2,0); 08898 Dict d; 08899 d["transform"] = &t; 08900 d["a"] = (float)2.5*xinc*nx; 08901 d["b"] = (float).75*yinc*ny; 08902 d["c"] = (float) 1*zinc*nz; 08903 d["fill"] = 0.25; 08904 image->process_inplace("testimage.ellipsoid",d); 08905 } 08906 08907 { 08908 Transform t; 08909 t.set_trans(nx*6*xinc-nx/2,ny*13*yinc-ny/2,0); 08910 Dict d; 08911 d["transform"] = &t; 08912 d["a"] = (float) 3*xinc*nx; 08913 d["b"] = (float).75*yinc*ny; 08914 d["c"] = (float) 1*zinc*nz; 08915 d["fill"] = 0.25; 08916 image->process_inplace("testimage.ellipsoid",d); 08917 } 08918 08919 // Right rectangle from the top down 08920 { 08921 Region region(nx*15.*inc,ny*17.*inc,nz/2.,1.*inc*nx,1.5*inc*ny,1.5*inc*nz); 08922 insert_rectangle(image, region, 0.25); 08923 } 08924 { 08925 Region region(nx*15.*inc,ny*15.*inc,nz/2.,1.5*inc*nx,1.5*inc*ny,1.5*inc*nz); 08926 insert_rectangle(image, region, 0.25); 08927 } 08928 { 08929 Region region(nx*15.*inc,ny*13.*inc,nz/2.,2.*inc*nx,1.5*inc*ny,1.5*inc*nz); 08930 insert_rectangle(image, region, 0.25); 08931 } 08932 { 08933 Region region(nx*15.*inc,ny*11.*inc,nz/2.,2.5*inc*nx,1.5*inc*ny,1.5*inc*nz); 08934 insert_rectangle(image, region, 0.25); 08935 } 08936 { 08937 Region region(nx*15.*inc,ny*9.*inc,nz/2.,3.*inc*nx,1.5*inc*ny,1.5*inc*nz); 08938 insert_rectangle(image, region, 0.25); 08939 } 08940 08941 // Center rotated rectangle 08942 { 08943 Region region(nx/2.,ny/2.,nz/2.,2.*inc*nx,2.5*inc*ny,1.*inc*nz); 08944 Transform t3d(Dict("type","eman","az",(float)-25.0)); 08945 insert_rectangle(image, region, 0.4f, t3d); 08946 } 08947 08948 // Rotated ellipsoids 08949 { 08950 Transform t; 08951 t.set_trans(nx*6.8f*xinc-nx/2,ny*16*yinc-ny/2,0); 08952 Dict rot; 08953 rot["type"] = "eman"; 08954 rot["az"] = 43.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.2; 08962 image->process_inplace("testimage.ellipsoid",d); 08963 } 08964 { 08965 Transform t; 08966 t.set_trans(nx*7.2f*xinc-nx/2,ny*16*yinc-ny/2,0); 08967 Dict rot; 08968 rot["type"] = "eman"; 08969 rot["az"] = 135.0f; 08970 t.set_rotation(rot); 08971 Dict d; 08972 d["transform"] = &t; 08973 d["a"] = (float) 1.5*xinc*nx; 08974 d["b"] = (float) .5*yinc*ny; 08975 d["c"] = (float) .5*zinc*nz; 08976 d["fill"] = 0.3; 08977 image->process_inplace("testimage.ellipsoid",d); 08978 } 08979 08980 // Dense small ellipsoids 08981 { 08982 Transform t; 08983 t.set_trans(nx*3.5f*xinc-nx/2,ny*8*yinc-ny/2,0); 08984 Dict d; 08985 d["transform"] = &t; 08986 d["a"] = (float) .5*xinc*nx; 08987 d["b"] = (float) .5*yinc*ny; 08988 d["c"] = (float) .5*zinc*nz; 08989 d["fill"] = 2.05; 08990 image->process_inplace("testimage.ellipsoid",d); 08991 08992 t.set_trans(nx*8*xinc-nx/2,ny*18*yinc-ny/2,0); 08993 image->process_inplace("testimage.ellipsoid",d); 08994 08995 t.set_trans(nx*14*xinc-nx/2,ny*18.2f*yinc-ny/2,0); 08996 image->process_inplace("testimage.ellipsoid",d); 08997 08998 t.set_trans(nx*18*xinc-nx/2,ny*14*yinc-ny/2,0); 08999 image->process_inplace("testimage.ellipsoid",d); 09000 09001 t.set_trans(nx*17*xinc-nx/2,ny*7.5f*yinc-ny/2,0); 09002 image->process_inplace("testimage.ellipsoid",d); 09003 } 09004 09005 09006 // Dense small rectangles 09007 { 09008 Region region(nx*18.*inc,ny*11.5*inc,nz/2.,1.*inc*nx,1.*inc*ny,1.*inc*nz); 09009 Transform t3d(Dict("type","eman","az",(float)45.0)); 09010 insert_rectangle(image, region, 1.45f, t3d); 09011 } 09012 { 09013 Region region(nx*3.*inc,ny*10.5*inc,nz/2.,1.*inc*nx,1.*inc*ny,1.*inc*nz); 09014 Transform t3d(Dict("type","eman","az",(float)45.0)); 09015 insert_rectangle(image, region, 1.45f, t3d); 09016 } 09017 09018 // Insert small cluster of spheres 09019 { 09020 Transform t; 09021 t.set_trans(nx*14*xinc-nx/2,ny*7.5f*yinc-ny/2,0); 09022 Dict d; 09023 d["transform"] = &t; 09024 d["a"] = (float) .5*xinc*nx; 09025 d["b"] = (float) .5*yinc*ny; 09026 d["c"] = (float) .5*zinc*nz; 09027 d["fill"] = .35; 09028 image->process_inplace("testimage.ellipsoid",d); 09029 } 09030 { 09031 Transform t; 09032 t.set_trans(nx*15*xinc-nx/2,ny*7.5f*yinc-ny/2,0); 09033 Dict d; 09034 d["transform"] = &t; 09035 d["a"] = (float) .25*xinc*nx; 09036 d["b"] = (float) .25*yinc*ny; 09037 d["c"] = (float) .25*zinc*nz; 09038 d["fill"] = .35; 09039 image->process_inplace("testimage.ellipsoid",d); 09040 09041 t.set_trans(nx*13.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0); 09042 image->process_inplace("testimage.ellipsoid",d); 09043 09044 t.set_trans(nx*14.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0); 09045 image->process_inplace("testimage.ellipsoid",d); 09046 09047 t.set_trans(nx*15.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0); 09048 image->process_inplace("testimage.ellipsoid",d); 09049 09050 t.set_trans(nx*14*xinc-nx/2,ny*5.5f*yinc-ny/2,0); 09051 image->process_inplace("testimage.ellipsoid",d); 09052 09053 t.set_trans(nx*14*xinc-nx/2,ny*5.5f*yinc-ny/2,0); 09054 image->process_inplace("testimage.ellipsoid",d); 09055 09056 t.set_trans(nx*15*xinc-nx/2,ny*5.5f*yinc-ny/2,0); 09057 image->process_inplace("testimage.ellipsoid",d); 09058 09059 t.set_trans(nx*16*xinc-nx/2,ny*5.5f*yinc-ny/2,0); 09060 image->process_inplace("testimage.ellipsoid",d); 09061 09062 t.set_trans(nx*14.5f*xinc-nx/2,ny*4.5f*yinc-ny/2,0); 09063 image->process_inplace("testimage.ellipsoid",d); 09064 09065 t.set_trans(nx*15.5f*xinc-nx/2,ny*4.5f*yinc-ny/2,0); 09066 image->process_inplace("testimage.ellipsoid",d); 09067 } 09068 // Insert feducials around the outside of the "cell" 09069 // for ( float i = 0.; i < 3.; i += 1. ) { 09070 // for ( float j = 0.; j < 3.; j += 1. ) { 09071 // Region region(nx*2.+i*inc,ny*2.+j*inc,nz/2.,0.05*inc*nx,0.05*inc*ny,0.05*inc*nz); 09072 // insert_solid_ellipse(image, region, 2.0); 09073 // } 09074 // } 09075 09076 }
|
|
Definition at line 190 of file processor.cpp. |