#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 238 of file reconstructor.cpp. References EMAN::EMData::depad(), EMAN::EMData::do_ift_inplace(), EMAN::ReconstructorVolumeData::normalize_threed(), and EMAN::EMData::process_inplace(). 00239 { 00240 normalize_threed(); 00241 00242 image->process_inplace("xform.fourierorigin.tocorner"); 00243 image->do_ift_inplace(); 00244 image->depad(); 00245 image->process_inplace("xform.phaseorigin.tocenter"); 00246 00247 return image; 00248 }
|
|
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 121 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. 00122 { 00123 00124 // Are these exceptions really necessary? (d.woolford) 00125 if (!slice) throw NullPointerException("EMData pointer (input image) is NULL"); 00126 00127 if ( slice->get_ndim() != 1 ) throw ImageDimensionException("Image dimension must be 1"); 00128 00129 // I could also test to make sure the image is the right dimensions... 00130 if (slice->is_complex()) throw ImageFormatException("The image is complex, expecting real"); 00131 00132 EMData* working_slice = slice->process("xform.phaseorigin.tocorner"); 00133 00134 // Fourier transform the slice 00135 working_slice->do_fft_inplace(); 00136 00137 float* rdata = image->get_data(); 00138 float* norm = tmp_data->get_data(); 00139 float* dat = working_slice->get_data(); 00140 00141 float g[4]; 00142 int offset[4]; 00143 float dt[2]; 00144 offset[0] = 0; offset[1] = 2; offset[2] = nx; offset[3] = nx+2; 00145 00146 float alt = -((float)(euler.get_rotation("2d"))["alpha"])*M_PI/180.0f; 00147 for (int x = 0; x < working_slice->get_xsize() / 2; x++) { 00148 00149 float rx = (float) x; 00150 00151 float xx = rx*cos(alt); 00152 float yy = rx*sin(alt); 00153 float cc = 1.0; 00154 00155 if (xx < 0) { 00156 xx = -xx; 00157 yy = -yy; 00158 cc = -1.0; 00159 } 00160 00161 yy += ny / 2; 00162 00163 00164 dt[0] = dat[2*x]; 00165 dt[1] = cc * dat[2*x+1]; 00166 00167 // PHIL IS INTERESTED FROM HERE DOWN 00168 int x0 = (int) floor(xx); 00169 int y0 = (int) floor(yy); 00170 00171 int i = 2*x0 + y0*nx; 00172 00173 float dx = xx - x0; 00174 float dy = yy - y0; 00175 00176 g[0] = Util::agauss(1, dx, dy, 0, EMConsts::I2G); 00177 g[1] = Util::agauss(1, 1 - dx, dy, 0, EMConsts::I2G); 00178 g[2] = Util::agauss(1, dx, 1 - dy, 0, EMConsts::I2G); 00179 g[3] = Util::agauss(1, 1 - dx, 1 - dy, 0, EMConsts::I2G); 00180 00181 // At the extreme we can only do some much... 00182 if ( x0 == nx-2 ) { 00183 int k = i + offset[0]; 00184 rdata[k] += g[0] * dt[0]; 00185 rdata[k + 1] += g[0] * dt[1]; 00186 norm[k/2] += g[0]; 00187 00188 k = i + offset[2]; 00189 rdata[k] += g[2] * dt[0]; 00190 rdata[k + 1] += g[2] * dt[1]; 00191 norm[k/2] += g[2]; 00192 continue; 00193 00194 } 00195 // capture and accommodate for periodic boundary conditions in the x direction 00196 if ( x0 > nx-2 ) { 00197 int dif = x0 - (nx-2); 00198 x0 -= dif; 00199 } 00200 // At the extreme we can only do some much... 00201 if ( y0 == ny -1 ) { 00202 int k = i + offset[0]; 00203 rdata[k] += g[0] * dt[0]; 00204 rdata[k + 1] += g[0] * dt[1]; 00205 norm[k/2] += g[0]; 00206 00207 k = i + offset[1]; 00208 rdata[k] += g[1] * dt[0]; 00209 rdata[k + 1] += g[1] * dt[1]; 00210 norm[k/2] += g[1]; 00211 continue; 00212 } 00213 // capture and accommodate for periodic boundary conditions in the y direction 00214 if ( y0 > ny-1) { 00215 int dif = y0 - (ny-1); 00216 y0 -= dif; 00217 } 00218 00219 if (x0 >= nx - 2 || y0 >= ny - 1) continue; 00220 00221 00222 00223 00224 for (int j = 0; j < 4; j++) 00225 { 00226 int k = i + offset[j]; 00227 rdata[k] += g[j] * dt[0]; 00228 rdata[k + 1] += g[j] * dt[1]; 00229 norm[k/2] += g[j]; 00230 00231 } 00232 } 00233 00234 return 0; 00235 00236 }
|
|
Definition at line 295 of file reconstructor.h. 00296 { 00297 return new FourierReconstructorSimple2D(); 00298 }
|
|
Initialize the reconstructor.
Implements EMAN::Reconstructor. Definition at line 100 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(). 00101 { 00102 nx = params.set_default("nx",0); 00103 00104 if ( nx < 0 ) throw InvalidValueException(nx, "nx must be positive"); 00105 00106 bool is_fftodd = (nx % 2 == 1); 00107 00108 ny = nx; 00109 nx += 2-is_fftodd; 00110 00111 image = new EMData(); 00112 image->set_size(nx, ny); 00113 image->set_complex(true); 00114 image->set_fftodd(is_fftodd); 00115 image->set_ri(true); 00116 00117 tmp_data = new EMData(); 00118 tmp_data->set_size(nx/2, nx); 00119 }
|
|
Definition at line 74 of file reconstructor.cpp. |