#include <reconstructor.h>
Inheritance diagram for EMAN::FourierReconstructorSimple2D:
Public Member Functions | |
FourierReconstructorSimple2D () | |
virtual | ~FourierReconstructorSimple2D () |
virtual void | setup () |
Initialize the reconstructor. | |
virtual int | insert_slice (const EMData *const slice, const Transform &euler, const float weight=1.0) |
Insert an image slice to the reconstructor. | |
virtual EMData * | finish (bool doift=true) |
Finish reconstruction and return the complete model. | |
virtual string | get_name () const |
Get the unique name of this class (especially for factory based instantiation access). | |
virtual string | get_desc () const |
Get a clear, concise description of this class. | |
virtual TypeDict | get_param_types () const |
Static Public Member Functions | |
Reconstructor * | NEW () |
Static Public Attributes | |
const string | NAME = "fouriersimple2D" |
It is basically a replica of the FourierReconstructor, but works in 2D
Definition at line 278 of file reconstructor.h.
|
Definition at line 281 of file reconstructor.h. 00281 {}
|
|
Definition at line 283 of file reconstructor.h. 00283 { }
|
|
Finish reconstruction and return the complete model.
Reimplemented from EMAN::Reconstructor. Definition at line 234 of file reconstructor.cpp. References EMAN::EMData::depad(), EMAN::EMData::do_ift_inplace(), EMAN::ReconstructorVolumeData::normalize_threed(), and EMAN::EMData::process_inplace(). 00235 { 00236 normalize_threed(); 00237 00238 image->process_inplace("xform.fourierorigin.tocorner"); 00239 image->do_ift_inplace(); 00240 image->depad(); 00241 image->process_inplace("xform.phaseorigin.tocenter"); 00242 00243 return image; 00244 }
|
|
Get a clear, concise description of this class.
Implements EMAN::FactoryBase. Definition at line 293 of file reconstructor.h. 00293 { return "performs 2D reconstruction"; }
|
|
Get the unique name of this class (especially for factory based instantiation access).
Implements EMAN::FactoryBase. Definition at line 291 of file reconstructor.h. 00291 { return NAME; }
|
|
Implements EMAN::FactoryBase. Definition at line 301 of file reconstructor.h. References EMAN::TypeDict::put(). 00302 { 00303 TypeDict d; 00304 d.put("nx", EMObject::INT, "Necessary. The x dimension of the input images."); 00305 // d.put("sym", EMObject::STRING, "Symmetry - assumed to be C1 if not specified"); 00306 return d; 00307 }
|
|
Insert an image slice to the reconstructor. To insert multiple image slices, call this function multiple times.
Reimplemented from EMAN::Reconstructor. Definition at line 117 of file reconstructor.cpp. References EMAN::Util::agauss(), EMAN::EMData::do_fft_inplace(), dt, EMAN::EMData::get_data(), EMAN::EMData::get_ndim(), EMAN::Transform::get_rotation(), EMAN::EMData::get_xsize(), ImageDimensionException, ImageFormatException, EMAN::EMData::is_complex(), norm(), NullPointerException, nx, EMAN::EMData::process(), rdata, and x. 00118 { 00119 00120 // Are these exceptions really necessary? (d.woolford) 00121 if (!slice) throw NullPointerException("EMData pointer (input image) is NULL"); 00122 00123 if ( slice->get_ndim() != 1 ) throw ImageDimensionException("Image dimension must be 1"); 00124 00125 // I could also test to make sure the image is the right dimensions... 00126 if (slice->is_complex()) throw ImageFormatException("The image is complex, expecting real"); 00127 00128 EMData* working_slice = slice->process("xform.phaseorigin.tocorner"); 00129 00130 // Fourier transform the slice 00131 working_slice->do_fft_inplace(); 00132 00133 float* rdata = image->get_data(); 00134 float* norm = tmp_data->get_data(); 00135 float* dat = working_slice->get_data(); 00136 00137 float g[4]; 00138 int offset[4]; 00139 float dt[2]; 00140 offset[0] = 0; offset[1] = 2; offset[2] = nx; offset[3] = nx+2; 00141 00142 float alt = -((float)(euler.get_rotation("2d"))["alpha"])*M_PI/180.0f; 00143 for (int x = 0; x < working_slice->get_xsize() / 2; x++) { 00144 00145 float rx = (float) x; 00146 00147 float xx = rx*cos(alt); 00148 float yy = rx*sin(alt); 00149 float cc = 1.0; 00150 00151 if (xx < 0) { 00152 xx = -xx; 00153 yy = -yy; 00154 cc = -1.0; 00155 } 00156 00157 yy += ny / 2; 00158 00159 00160 dt[0] = dat[2*x]; 00161 dt[1] = cc * dat[2*x+1]; 00162 00163 // PHIL IS INTERESTED FROM HERE DOWN 00164 int x0 = (int) floor(xx); 00165 int y0 = (int) floor(yy); 00166 00167 int i = 2*x0 + y0*nx; 00168 00169 float dx = xx - x0; 00170 float dy = yy - y0; 00171 00172 g[0] = Util::agauss(1, dx, dy, 0, EMConsts::I2G); 00173 g[1] = Util::agauss(1, 1 - dx, dy, 0, EMConsts::I2G); 00174 g[2] = Util::agauss(1, dx, 1 - dy, 0, EMConsts::I2G); 00175 g[3] = Util::agauss(1, 1 - dx, 1 - dy, 0, EMConsts::I2G); 00176 00177 // At the extreme we can only do some much... 00178 if ( x0 == nx-2 ) { 00179 int k = i + offset[0]; 00180 rdata[k] += g[0] * dt[0]; 00181 rdata[k + 1] += g[0] * dt[1]; 00182 norm[k/2] += g[0]; 00183 00184 k = i + offset[2]; 00185 rdata[k] += g[2] * dt[0]; 00186 rdata[k + 1] += g[2] * dt[1]; 00187 norm[k/2] += g[2]; 00188 continue; 00189 00190 } 00191 // capture and accommodate for periodic boundary conditions in the x direction 00192 if ( x0 > nx-2 ) { 00193 int dif = x0 - (nx-2); 00194 x0 -= dif; 00195 } 00196 // At the extreme we can only do some much... 00197 if ( y0 == ny -1 ) { 00198 int k = i + offset[0]; 00199 rdata[k] += g[0] * dt[0]; 00200 rdata[k + 1] += g[0] * dt[1]; 00201 norm[k/2] += g[0]; 00202 00203 k = i + offset[1]; 00204 rdata[k] += g[1] * dt[0]; 00205 rdata[k + 1] += g[1] * dt[1]; 00206 norm[k/2] += g[1]; 00207 continue; 00208 } 00209 // capture and accommodate for periodic boundary conditions in the y direction 00210 if ( y0 > ny-1) { 00211 int dif = y0 - (ny-1); 00212 y0 -= dif; 00213 } 00214 00215 if (x0 >= nx - 2 || y0 >= ny - 1) continue; 00216 00217 00218 00219 00220 for (int j = 0; j < 4; j++) 00221 { 00222 int k = i + offset[j]; 00223 rdata[k] += g[j] * dt[0]; 00224 rdata[k + 1] += g[j] * dt[1]; 00225 norm[k/2] += g[j]; 00226 00227 } 00228 } 00229 00230 return 0; 00231 00232 }
|
|
Definition at line 295 of file reconstructor.h. 00296 { 00297 return new FourierReconstructorSimple2D(); 00298 }
|
|
Initialize the reconstructor.
Implements EMAN::Reconstructor. Definition at line 96 of file reconstructor.cpp. References InvalidValueException, is_fftodd(), EMAN::EMData::set_complex(), EMAN::Dict::set_default(), EMAN::EMData::set_fftodd(), EMAN::EMData::set_ri(), and EMAN::EMData::set_size(). 00097 { 00098 nx = params.set_default("nx",0); 00099 00100 if ( nx < 0 ) throw InvalidValueException(nx, "nx must be positive"); 00101 00102 bool is_fftodd = (nx % 2 == 1); 00103 00104 ny = nx; 00105 nx += 2-is_fftodd; 00106 00107 image = new EMData(); 00108 image->set_size(nx, ny); 00109 image->set_complex(true); 00110 image->set_fftodd(is_fftodd); 00111 image->set_ri(true); 00112 00113 tmp_data = new EMData(); 00114 tmp_data->set_size(nx/2, nx); 00115 }
|
|
Definition at line 74 of file reconstructor.cpp. |