#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 6052 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 6065 of file processor.h. 06066 { 06067 return "Make an image consisting various objects, useful for tomographic testing"; 06068 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6060 of file processor.h. 06061 {
06062 return NAME;
06063 }
|
|
|
|
Definition at line 8944 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(). 08945 { 08946 int startx = (int)region.origin[0] - (int)region.size[0]/2; 08947 int starty = (int)region.origin[1] - (int)region.size[1]/2; 08948 int startz = (int)region.origin[2] - (int)region.size[2]/2; 08949 08950 int endx = (int)region.origin[0] + (int)region.size[0]/2; 08951 int endy = (int)region.origin[1] + (int)region.size[1]/2; 08952 int endz = (int)region.origin[2] + (int)region.size[2]/2; 08953 08954 if ( ! t3d.is_identity() ) { 08955 float xt, yt, zt; 08956 for ( float z = (float)startz; z < (float)endz; z += 0.25f ) { 08957 for ( float y = (float)starty; y < (float)endy; y += 0.25f ) { 08958 for ( float x = (float)startx; x < (float)endx; x += 0.25f ) { 08959 xt = (float) x - region.origin[0]; 08960 yt = (float) y - region.origin[1]; 08961 zt = (float) z - region.origin[2]; 08962 Vec3f v((float)xt,(float)yt,(float)zt); 08963 v = t3d*v; 08964 image->set_value_at((int)(v[0]+region.origin[0]),(int)(v[1]+region.origin[1]),(int)(v[2]+region.origin[2]), value); 08965 } 08966 } 08967 } 08968 } else { 08969 for ( int z = startz; z < endz; ++z ) { 08970 for ( int y = starty; y < endy; ++y ) { 08971 for ( int x = startx; x < endx; ++x ) { 08972 image->set_value_at(x,y,z, value); 08973 } 08974 } 08975 } 08976 } 08977 }
|
|
|
|
Definition at line 6070 of file processor.h. 06071 { 06072 return new TestTomoImage(); 06073 }
|
|
Make a useful tomographic phantom image.
Implements EMAN::Processor. Definition at line 8979 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. 08980 { 08981 //float nx = 240; 08982 //float ny = 240; 08983 //float nz = 60; 08984 08985 //image->set_size((int)nx,(int)ny,(int)nz); 08986 float nx = (float) image->get_xsize(); 08987 float ny = (float) image->get_ysize(); 08988 float nz = (float) image->get_zsize(); 08989 08990 // This increment is used to simplified positioning 08991 // It's an incremental factor that matches the grid size of the paper 08992 // that I drew this design on before implementing it in code 08993 float inc = 1.0f/22.0f; 08994 float xinc = inc; 08995 float yinc = inc; 08996 float zinc = inc; 08997 08998 Dict d; 08999 d["a"] = (float) .4*nx+3; 09000 d["b"] = (float) .4*ny+3; 09001 d["c"] = (float) .4*nz+3; 09002 d["fill"] = 0.2; 09003 image->process_inplace("testimage.ellipsoid",d); 09004 09005 d["a"] = (float) .4*nx; 09006 d["b"] = (float) .4*ny; 09007 d["c"] = (float) .4*nz; 09008 d["fill"] = 0.1; 09009 image->process_inplace("testimage.ellipsoid",d); 09010 09011 // Center x, center z, bottom y ellipsoids that grow progessively smaller 09012 { 09013 Transform t; 09014 t.set_trans(0.,ny*4.0f*yinc-ny/2,0); 09015 Dict d; 09016 d["transform"] = &t; 09017 d["a"] = (float) 2.*xinc*nx; 09018 d["b"] = (float)0.5*yinc*ny; 09019 d["c"] = (float) 1.*zinc*nz; 09020 d["fill"] = 0.3; 09021 image->process_inplace("testimage.ellipsoid",d); 09022 } 09023 09024 { 09025 Transform t; 09026 t.set_trans(0.,ny*5.5f*yinc-ny/2,0); 09027 Dict d; 09028 d["transform"] = &t; 09029 d["a"] = (float) 1.5*xinc*nx; 09030 d["b"] = (float)0.5*yinc*ny; 09031 d["c"] = (float) 1.*zinc*nz; 09032 d["fill"] = 0.0; 09033 image->process_inplace("testimage.ellipsoid",d); 09034 } 09035 { 09036 Transform t; 09037 t.set_trans(0.,ny*7*yinc-ny/2,0); 09038 Dict d; 09039 d["transform"] = &t; 09040 d["a"] = (float) 1.*xinc*nx; 09041 d["b"] = (float)0.5*yinc*ny; 09042 d["c"] = (float) 1.*zinc*nz; 09043 d["fill"] = 0.3; 09044 image->process_inplace("testimage.ellipsoid",d); 09045 } 09046 09047 09048 { 09049 Transform t; 09050 t.set_trans(0.,ny*8.5f*yinc-ny/2,0); 09051 Dict d; 09052 d["transform"] = &t; 09053 d["a"] = (float) .75*xinc*nx; 09054 d["b"] = (float)0.5*yinc*ny; 09055 d["c"] = (float) 1.*zinc*nz; 09056 d["fill"] = 0.0; 09057 image->process_inplace("testimage.ellipsoid",d); 09058 } 09059 09060 // Center x, center z, bottom y ellipsoids that grow progessively smaller 09061 { 09062 Transform t; 09063 t.set_trans(0.,ny*18*yinc-ny/2,0); 09064 Dict d; 09065 d["transform"] = &t; 09066 d["a"] = (float) 2*xinc*nx; 09067 d["b"] = (float)0.5*yinc*ny; 09068 d["c"] = (float) 1.*zinc*nz; 09069 d["fill"] = 0.3; 09070 image->process_inplace("testimage.ellipsoid",d); 09071 } 09072 09073 { 09074 Transform t; 09075 t.set_trans(0.,ny*16.5f*yinc-ny/2,0); 09076 Dict d; 09077 d["transform"] = &t; 09078 d["a"] = (float) 1.5*xinc*nx; 09079 d["b"] = (float)0.5*yinc*ny; 09080 d["c"] = (float) 1.*zinc*nz; 09081 d["fill"] = 0.3; 09082 image->process_inplace("testimage.ellipsoid",d); 09083 } 09084 09085 { 09086 Transform t; 09087 t.set_trans(0.,ny*15*yinc-ny/2,0); 09088 Dict d; 09089 d["transform"] = &t; 09090 d["a"] = (float) 1*xinc*nx; 09091 d["b"] = (float)0.5*yinc*ny; 09092 d["c"] = (float) 1.*zinc*nz; 09093 d["fill"] = 0.3f; 09094 image->process_inplace("testimage.ellipsoid",d); 09095 } 09096 09097 { 09098 Transform t; 09099 t.set_trans(0.,ny*13.5f*yinc-ny/2,0); 09100 Dict d; 09101 d["transform"] = &t; 09102 d["a"] = (float).75*xinc*nx; 09103 d["b"] = (float)0.5*yinc*ny; 09104 d["c"] = (float) 1.*zinc*nz; 09105 d["fill"] = 0.3; 09106 image->process_inplace("testimage.ellipsoid",d); 09107 } 09108 09109 // Left ellipsoids from the bottom up 09110 { 09111 09112 Transform t; 09113 t.set_trans(nx*6*xinc-nx/2,ny*5*yinc-ny/2,0); 09114 Dict d; 09115 d["transform"] = &t; 09116 d["a"] = (float)1*xinc*nx; 09117 d["b"] = (float).75*yinc*ny; 09118 d["c"] = (float) .75*zinc*nz; 09119 d["fill"] = 0.25; 09120 image->process_inplace("testimage.ellipsoid",d); 09121 } 09122 09123 { 09124 Transform t; 09125 t.set_trans(nx*6*xinc-nx/2,ny*7*yinc-ny/2,0); 09126 Dict d; 09127 d["transform"] = &t; 09128 d["a"] = (float)1.5*xinc*nx; 09129 d["b"] = (float).75*yinc*ny; 09130 d["c"] = (float) .75*zinc*nz; 09131 d["fill"] = 0.25; 09132 image->process_inplace("testimage.ellipsoid",d); 09133 } 09134 09135 { 09136 Transform t; 09137 t.set_trans(nx*6*xinc-nx/2,ny*9*yinc-ny/2,0); 09138 Dict d; 09139 d["transform"] = &t; 09140 d["a"] = (float)2*xinc*nx; 09141 d["b"] = (float).75*yinc*ny; 09142 d["c"] = (float) .75*zinc*nz; 09143 d["fill"] = 0.25; 09144 image->process_inplace("testimage.ellipsoid",d); 09145 } 09146 09147 { 09148 Transform t; 09149 t.set_trans(nx*6*xinc-nx/2,ny*11*yinc-ny/2,0); 09150 Dict d; 09151 d["transform"] = &t; 09152 d["a"] = (float)2.5*xinc*nx; 09153 d["b"] = (float).75*yinc*ny; 09154 d["c"] = (float) 1*zinc*nz; 09155 d["fill"] = 0.25; 09156 image->process_inplace("testimage.ellipsoid",d); 09157 } 09158 09159 { 09160 Transform t; 09161 t.set_trans(nx*6*xinc-nx/2,ny*13*yinc-ny/2,0); 09162 Dict d; 09163 d["transform"] = &t; 09164 d["a"] = (float) 3*xinc*nx; 09165 d["b"] = (float).75*yinc*ny; 09166 d["c"] = (float) 1*zinc*nz; 09167 d["fill"] = 0.25; 09168 image->process_inplace("testimage.ellipsoid",d); 09169 } 09170 09171 // Right rectangle from the top down 09172 { 09173 Region region(nx*15.*inc,ny*17.*inc,nz/2.,1.*inc*nx,1.5*inc*ny,1.5*inc*nz); 09174 insert_rectangle(image, region, 0.25); 09175 } 09176 { 09177 Region region(nx*15.*inc,ny*15.*inc,nz/2.,1.5*inc*nx,1.5*inc*ny,1.5*inc*nz); 09178 insert_rectangle(image, region, 0.25); 09179 } 09180 { 09181 Region region(nx*15.*inc,ny*13.*inc,nz/2.,2.*inc*nx,1.5*inc*ny,1.5*inc*nz); 09182 insert_rectangle(image, region, 0.25); 09183 } 09184 { 09185 Region region(nx*15.*inc,ny*11.*inc,nz/2.,2.5*inc*nx,1.5*inc*ny,1.5*inc*nz); 09186 insert_rectangle(image, region, 0.25); 09187 } 09188 { 09189 Region region(nx*15.*inc,ny*9.*inc,nz/2.,3.*inc*nx,1.5*inc*ny,1.5*inc*nz); 09190 insert_rectangle(image, region, 0.25); 09191 } 09192 09193 // Center rotated rectangle 09194 { 09195 Region region(nx/2.,ny/2.,nz/2.,2.*inc*nx,2.5*inc*ny,1.*inc*nz); 09196 Transform t3d(Dict("type","eman","az",(float)-25.0)); 09197 insert_rectangle(image, region, 0.4f, t3d); 09198 } 09199 09200 // Rotated ellipsoids 09201 { 09202 Transform t; 09203 t.set_trans(nx*6.8f*xinc-nx/2,ny*16*yinc-ny/2,0); 09204 Dict rot; 09205 rot["type"] = "eman"; 09206 rot["az"] = 43.0f; 09207 t.set_rotation(rot); 09208 Dict d; 09209 d["transform"] = &t; 09210 d["a"] = (float) 1.5*xinc*nx; 09211 d["b"] = (float) .5*yinc*ny; 09212 d["c"] = (float) .5*zinc*nz; 09213 d["fill"] = 0.2; 09214 image->process_inplace("testimage.ellipsoid",d); 09215 } 09216 { 09217 Transform t; 09218 t.set_trans(nx*7.2f*xinc-nx/2,ny*16*yinc-ny/2,0); 09219 Dict rot; 09220 rot["type"] = "eman"; 09221 rot["az"] = 135.0f; 09222 t.set_rotation(rot); 09223 Dict d; 09224 d["transform"] = &t; 09225 d["a"] = (float) 1.5*xinc*nx; 09226 d["b"] = (float) .5*yinc*ny; 09227 d["c"] = (float) .5*zinc*nz; 09228 d["fill"] = 0.3; 09229 image->process_inplace("testimage.ellipsoid",d); 09230 } 09231 09232 // Dense small ellipsoids 09233 { 09234 Transform t; 09235 t.set_trans(nx*3.5f*xinc-nx/2,ny*8*yinc-ny/2,0); 09236 Dict d; 09237 d["transform"] = &t; 09238 d["a"] = (float) .5*xinc*nx; 09239 d["b"] = (float) .5*yinc*ny; 09240 d["c"] = (float) .5*zinc*nz; 09241 d["fill"] = 2.05; 09242 image->process_inplace("testimage.ellipsoid",d); 09243 09244 t.set_trans(nx*8*xinc-nx/2,ny*18*yinc-ny/2,0); 09245 image->process_inplace("testimage.ellipsoid",d); 09246 09247 t.set_trans(nx*14*xinc-nx/2,ny*18.2f*yinc-ny/2,0); 09248 image->process_inplace("testimage.ellipsoid",d); 09249 09250 t.set_trans(nx*18*xinc-nx/2,ny*14*yinc-ny/2,0); 09251 image->process_inplace("testimage.ellipsoid",d); 09252 09253 t.set_trans(nx*17*xinc-nx/2,ny*7.5f*yinc-ny/2,0); 09254 image->process_inplace("testimage.ellipsoid",d); 09255 } 09256 09257 09258 // Dense small rectangles 09259 { 09260 Region region(nx*18.*inc,ny*11.5*inc,nz/2.,1.*inc*nx,1.*inc*ny,1.*inc*nz); 09261 Transform t3d(Dict("type","eman","az",(float)45.0)); 09262 insert_rectangle(image, region, 1.45f, t3d); 09263 } 09264 { 09265 Region region(nx*3.*inc,ny*10.5*inc,nz/2.,1.*inc*nx,1.*inc*ny,1.*inc*nz); 09266 Transform t3d(Dict("type","eman","az",(float)45.0)); 09267 insert_rectangle(image, region, 1.45f, t3d); 09268 } 09269 09270 // Insert small cluster of spheres 09271 { 09272 Transform t; 09273 t.set_trans(nx*14*xinc-nx/2,ny*7.5f*yinc-ny/2,0); 09274 Dict d; 09275 d["transform"] = &t; 09276 d["a"] = (float) .5*xinc*nx; 09277 d["b"] = (float) .5*yinc*ny; 09278 d["c"] = (float) .5*zinc*nz; 09279 d["fill"] = .35; 09280 image->process_inplace("testimage.ellipsoid",d); 09281 } 09282 { 09283 Transform t; 09284 t.set_trans(nx*15*xinc-nx/2,ny*7.5f*yinc-ny/2,0); 09285 Dict d; 09286 d["transform"] = &t; 09287 d["a"] = (float) .25*xinc*nx; 09288 d["b"] = (float) .25*yinc*ny; 09289 d["c"] = (float) .25*zinc*nz; 09290 d["fill"] = .35; 09291 image->process_inplace("testimage.ellipsoid",d); 09292 09293 t.set_trans(nx*13.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0); 09294 image->process_inplace("testimage.ellipsoid",d); 09295 09296 t.set_trans(nx*14.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0); 09297 image->process_inplace("testimage.ellipsoid",d); 09298 09299 t.set_trans(nx*15.5f*xinc-nx/2,ny*6.5f*yinc-ny/2,0); 09300 image->process_inplace("testimage.ellipsoid",d); 09301 09302 t.set_trans(nx*14*xinc-nx/2,ny*5.5f*yinc-ny/2,0); 09303 image->process_inplace("testimage.ellipsoid",d); 09304 09305 t.set_trans(nx*14*xinc-nx/2,ny*5.5f*yinc-ny/2,0); 09306 image->process_inplace("testimage.ellipsoid",d); 09307 09308 t.set_trans(nx*15*xinc-nx/2,ny*5.5f*yinc-ny/2,0); 09309 image->process_inplace("testimage.ellipsoid",d); 09310 09311 t.set_trans(nx*16*xinc-nx/2,ny*5.5f*yinc-ny/2,0); 09312 image->process_inplace("testimage.ellipsoid",d); 09313 09314 t.set_trans(nx*14.5f*xinc-nx/2,ny*4.5f*yinc-ny/2,0); 09315 image->process_inplace("testimage.ellipsoid",d); 09316 09317 t.set_trans(nx*15.5f*xinc-nx/2,ny*4.5f*yinc-ny/2,0); 09318 image->process_inplace("testimage.ellipsoid",d); 09319 } 09320 // Insert feducials around the outside of the "cell" 09321 // for ( float i = 0.; i < 3.; i += 1. ) { 09322 // for ( float j = 0.; j < 3.; j += 1. ) { 09323 // Region region(nx*2.+i*inc,ny*2.+j*inc,nz/2.,0.05*inc*nx,0.05*inc*ny,0.05*inc*nz); 09324 // insert_solid_ellipse(image, region, 2.0); 09325 // } 09326 // } 09327 09328 }
|
|
Definition at line 195 of file processor.cpp. |