34#ifndef eman_reconstructor_h__
35#define eman_reconstructor_h__ 1
190 std::cout <<
"Printing reconstructor params" << std::endl;
193 std::cout << (it->first) <<
" " << (it->second).to_str() << std::endl;
195 std::cout <<
"Done printing reconstructor params" << std::endl;
225 inline ReconstructorVolumeData() :
image(0),
tmp_data(0),
nx(0),
ny(0),
nz(0),
subnx(0),
subny(0),
subnz(0),
subx0(0),
suby0(0),
subz0(0) {}
258 double *ddata,*dnorm;
278 virtual void normalize_threed(
const bool sqrt_damp=
false,
const bool wiener=
false);
309 virtual void setup();
317 virtual string get_desc()
const {
return "performs 2D reconstruction"; }
328 d.
put(
"nx",
EMObject::INT,
"Necessary. The x dimension of the input images.");
404 virtual void setup();
474 virtual void clear();
487 return "Reconstruction via direct Fourier methods using one of a variety of different kernels, most of which are Gaussian based";
504 d.
put(
"size",
EMObject::INTARRAY,
"Required. The dimensions of the real-space output volume, including any padding (must be handled by the calling application). Assumed that apix x/y/z identical.");
505 d.
put(
"sym",
EMObject::STRING,
"Required. The symmetry of the reconstructed volume, c?, d?, oct, tet, icos, h?. Default is c1, ie - an asymmetric object");
506 d.
put(
"mode",
EMObject::STRING,
"Optional. Fourier pixel insertion mode name (nearest_neighbor, gauss_2, gauss_3, gauss_5, gauss_5_slow, gypergeom_5, experimental) gauss_2 is the default.");
507 d.
put(
"corners",
EMObject::BOOL,
"Optional. If not set, then reconstruction will cover a spherical volume with a radius of nx/2. If set, the full Fourier volume will be reconstructed, but will be ~2x slower.");
508 d.
put(
"sqrtnorm",
EMObject::BOOL,
"Optional. When normalizing, additionally divides by the sqrt of the normalization factor to damp exaggerated features. Is this justifyable ? No idea (yet). Default is false.");
509 d.
put(
"usessnr",
EMObject::BOOL,
"Optional. Looks for and uses the class_ssnr header parameter from each slice to weight each voxel during insertion to the reconstruction.");
510 d.
put(
"verbose",
EMObject::BOOL,
"Optional. Toggles writing useful information to standard out. Default is false.");
511 d.
put(
"quiet",
EMObject::BOOL,
"Optional. If false, print verbose information.");
512 d.
put(
"subvolume",
EMObject::INTARRAY,
"Optional. (xorigin,yorigin,zorigin,xsize,ysize,zsize) all in Fourier pixels. Useful for parallelism.");
513 d.
put(
"savenorm",
EMObject::STRING,
"Debug. Will cause the normalization volume to be written directly to the specified file when finish() is called.");
515 d.
put(
"normout",
EMObject::EMDATA,
"Will write the normalization volume to the given EMData object file when finish() is called.");
552 virtual bool pixel_at(
const float& xx,
const float& yy,
const float& zz,
float *dt);
642 return "Reconstruction via direct Fourier methods using one of a variety of different kernels, most of which are Gaussian based. This version also incorporates a nonisotropic Wiener filter based on SNR estimates stored in the class-average headers by the ctf.auto averager.";
669 virtual bool pixel_at(
const float& xx,
const float& yy,
const float& zz,
float *dt);
713 virtual void setup();
776 virtual void clear();
789 return "Reconstruction via Fourier interpolation using an iterative strategy to define the interpolation kernel";
806 d.
put(
"size",
EMObject::INTARRAY,
"Required. The dimensions of the real-space output volume, including any padding (must be handled by the calling application). Assumed that apix x/y/z identical.");
807 d.
put(
"sym",
EMObject::STRING,
"Optional. The symmetry of the reconstructed volume, c?, d?, oct, tet, icos, h?. Default is c1, ie - an asymmetric object");
808 d.
put(
"verbose",
EMObject::BOOL,
"Optional. Toggles writing useful information to standard out. Default is false.");
848 virtual void setup();
880 return "Simple (unfiltered) back-projection reconstruction. Weighting by contributing particles in the class average is optional and default behaviour";
891 d.
put(
"size",
EMObject::INTARRAY,
"Required. The dimensions of the real-space output volume, including any padding (must be handled by the calling application). Assumed that apix x/y/z identical.");
892 d.
put(
"weight",
EMObject::FLOAT,
"Optional. A temporary value set prior to slice insertion, indicative of the inserted slice's weight. Default sis 1.");
893 d.
put(
"sym",
EMObject::STRING,
"Optional. The symmetry to impose on the final reconstruction. Default is c1");
894 d.
put(
"verbose",
EMObject::BOOL,
"Optional. Toggles writing useful information to standard out. Default is false.");
909 params[
"use_weights"] =
true;
911 params[
"verbose"] =
false;
928 virtual void setup();
970 return "A back projection reconstructor with alternative statistics. mode:\n\
9710 - median rather than mean per voxel (default)\n\
9721 - similar to a mode. progressive subdivision of numeric axis to find dense value cluster\n\
9732 - median with a bias towands zero (postive and negative)\n\
9743 - median with a bias towards the 1/2 of the values spanning a narrower range\n\
9754 - specifically for tomography, requires slices to be in order by tilt\n\
987 d.
put(
"mode",
EMObject::INT,
"Default is 0, median. 1 - compute estimated statistical mode.");
988 d.
put(
"size",
EMObject::INTARRAY,
"Required. The dimensions of the real-space output volume, including any padding (must be handled by the calling application). Assumed that apix x/y/z identical.");
989 d.
put(
"weight",
EMObject::FLOAT,
"Optional. A temporary value set prior to slice insertion, indicative of the inserted slice's weight. Default sis 1.");
990 d.
put(
"sym",
EMObject::STRING,
"Optional. The symmetry to impose on the final reconstruction. Default is c1");
991 d.
put(
"verbose",
EMObject::INT,
"Optional. Toggles writing diagnostic information to standard out. Default is 0.");
1021 virtual void setup();
1042 return "Direct Fourier inversion routine";
1066 void setup(
const string& symmetry,
int size,
int npad );
1109 virtual void setup();
1130 return "Direct Fourier inversion routine";
1160 void setup(
const string& symmetry,
int size,
int npad );
1207 virtual void setup();
1228 return "Reconstruction by nearest neighbor with 3D SSNR";
1251 void setup(
const string& symmetry,
int size,
int npad);
1288 virtual void setup();
1310 return "Direct Fourier inversion reconstruction routine";
1334 void setup(
const string& symmetry,
int size,
int npad,
float snr,
int sign );
1372 nn4_ctfwReconstructor(
const string& symmetry,
int size,
int npad,
float snr,
int sign,
int do_ctf );
1376 virtual void setup();
1398 return "Direct Fourier inversion reconstruction routine";
1424 void setup(
const string& symmetry,
int size,
int npad,
float snr,
int sign,
int do_ctf );
1468 virtual void setup();
1490 return "Direct Fourier inversion reconstruction routine";
1516 void setup(
const string& symmetry,
int size,
int npad,
float snr,
int sign,
int do_ctf );
1559 virtual void setup();
1581 return "Direct Fourier inversion reconstruction routine";
1606 void setup(
const string& symmetry,
int sizeprojection,
int npad,
float snr,
int sign );
1652 virtual void setup();
1675 return "Reconstruction by nearest neighbor with 3D SSNR with CTF";
1701 void setup(
const string& symmetry,
int size,
int npad,
float snr,
int sign);
1758 void read(
int nprj );
1781 file_store(
const string& filename,
int npad,
int write,
bool CTF);
Real space 3D reconstruction using back projection.
static Reconstructor * NEW()
BackProjectionReconstructor & operator=(const BackProjectionReconstructor &)
virtual string get_desc() const
Get a clear, concise description of this class.
virtual int insert_slice(const EMData *const slice, const Transform &euler, const float weight)
Insert an image slice to the reconstructor.
EMData * preprocess_slice(const EMData *const slice, const Transform &t)
While you can just insert unprocessed slices, if you call preprocess_slice yourself,...
virtual ~BackProjectionReconstructor()
BackProjectionReconstructor(const BackProjectionReconstructor &that)
virtual void setup()
Initialize the reconstructor.
virtual TypeDict get_param_types() const
BackProjectionReconstructor()
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
virtual int determine_slice_agreement(EMData *slice, const Transform &euler, const float weight=1.0, bool sub=true)
Dummy function which always returns the same values.
void load_default_settings()
virtual EMData * finish(bool doift=true)
Finish reconstruction and return the complete model.
Const iterator support for the Dict object This is just a wrapper, everything is inherited from the m...
EMData stores an image's data and defines core image processing routines.
EMObject is a wrapper class for types including int, float, double, etc as defined in ObjectType.
A class one may inherit from to ensure that the responsibilities of being incorporated into an EMAN2:...
Dict params
This is the dictionary the stores the parameters of the object.
Factory is used to store objects to create new instances.
Fourier space 3D reconstruction The Fourier reconstructor is designed to work in an iterative fashion...
virtual string get_desc() const
Get the one line description of the reconstructor.
virtual ~FourierIterReconstructor()
Deconstructor calls free_memory()
FourierIterReconstructor & operator=(const FourierIterReconstructor &)
Disallow assignment.
virtual void setup()
Setup the Fourier reconstructor.
virtual EMData * finish(bool doift=true)
Get the reconstructed volume Normally will return the volume in real-space with the requested size.
virtual void clear()
clear the volume and tmp_data for use in Monte Carlo reconstructions
virtual string get_name() const
Get the unique name of the reconstructor.
FourierIterReconstructor(const FourierIterReconstructor &that)
Disallow copy construction.
virtual TypeDict get_param_types() const
Get the parameter types of this object.
virtual void free_memory()
Frees the memory owned by this object (but not parent objects) Deletes the FourierPixelInserter3D poi...
FourierIterReconstructor()
Default constructor.
virtual void setup_seed(EMData *seed, float seed_weight)
Initialize the reconstructor with a seed volume.
virtual int insert_slice(const EMData *const slice, const Transform &euler, const float weight)
Insert a slice into a 3D volume, in a given orientation.
virtual int determine_slice_agreement(EMData *slice, const Transform &euler, const float weight=1.0, bool sub=true)
Compares a slice to the current reconstruction volume and computes a normalization factor and quality...
static Reconstructor * NEW()
Factory incorporation uses the pointer of this function.
virtual EMData * preprocess_slice(const EMData *const slice, const Transform &t=Transform())
Preprocess the slice prior to insertion into the 3D volume this Fourier tranforms the slice and make ...
virtual void setup_seedandweights(EMData *seed, EMData *weight)
Initialize the reconstructor with a seed volume, as above.
FourierPixelInserter3D class defines a way a continuous pixel in 3D is inserted into the discrete 3D ...
This class originally added for 2D experimentation and prototying.
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
virtual void setup()
Initialize the reconstructor.
FourierReconstructorSimple2D()
virtual int insert_slice(const EMData *const slice, const Transform &euler, const float weight)
Insert an image slice to the reconstructor.
static Reconstructor * NEW()
virtual EMData * finish(bool doift=true)
Finish reconstruction and return the complete model.
virtual string get_desc() const
Get a clear, concise description of this class.
virtual TypeDict get_param_types() const
virtual ~FourierReconstructorSimple2D()
Fourier space 3D reconstruction The Fourier reconstructor is designed to work in an iterative fashion...
virtual void do_insert_slice_work(const EMData *const input_slice, const Transform &euler, const float weight, const bool corners=false)
A function to perform the nuts and bolts of inserting an image slice.
virtual void clear()
clear the volume and tmp_data for use in Monte Carlo reconstructions
virtual void load_default_settings()
Load default settings.
virtual void setup_seed(EMData *seed, float seed_weight)
Initialize the reconstructor with a seed volume.
virtual ~FourierReconstructor()
Deconstructor calls free_memory()
virtual void do_compare_slice_work(EMData *input_slice, const Transform &euler, float weight)
A function to perform the nuts and bolts of comparing an image slice.
virtual void load_inserter()
Load the pixel inserter based on the information in params.
virtual TypeDict get_param_types() const
Get the parameter types of this object.
virtual int insert_slice(const EMData *const slice, const Transform &euler, const float weight)
Insert a slice into a 3D volume, in a given orientation.
static Reconstructor * NEW()
Factory incorporation uses the pointer of this function.
virtual void setup()
Setup the Fourier reconstructor.
virtual void free_memory()
Frees the memory owned by this object (but not parent objects) Deletes the FourierPixelInserter3D poi...
virtual EMData * preprocess_slice(const EMData *const slice, const Transform &t=Transform())
Preprocess the slice prior to insertion into the 3D volume this Fourier tranforms the slice and make ...
virtual EMData * finish(bool doift=true)
Get the reconstructed volume Normally will return the volume in real-space with the requested size.
FourierReconstructor & operator=(const FourierReconstructor &)
Disallow assignment.
virtual void setup_seedandweights(EMData *seed, EMData *weight)
Initialize the reconstructor with a seed volume, as above.
virtual EMData * projection(const Transform &euler, int ret_fourier)
Generates a projection by extracting a slice in Fourier space.
virtual string get_desc() const
Get the one line description of the reconstructor.
FourierPixelInserter3D * inserter
A pixel inserter pointer which inserts pixels into the 3D volume using one of a variety of insertion ...
FourierReconstructor(const FourierReconstructor &that)
Disallow copy construction.
FourierReconstructor()
Default constructor calls load_default_settings()
virtual bool pixel_at(const float &xx, const float &yy, const float &zz, float *dt)
This is a mode-2 pixel extractor.
virtual int determine_slice_agreement(EMData *slice, const Transform &euler, const float weight=1.0, bool sub=true)
Compares a slice to the current reconstruction volume and computes a normalization factor and quality...
virtual string get_name() const
Get the unique name of the reconstructor.
This is a Mixin class A class object encapsulating the volume data required by Reconstructors It basi...
void free_memory()
Free allocated memorys The inherited class may have allocated image of tmp_data In either case you ca...
ReconstructorVolumeData(const ReconstructorVolumeData &that)
Disallow copy construction.
virtual void zero_memory()
Sends the pixels in tmp_data and image to zero Convenience only.
virtual ~ReconstructorVolumeData()
Destructor safely frees memory.
const EMData * get_emdata()
Get the main image pointer, probably redundant (not used)
EMData * image
Inheriting class allocates this, probably in setup().
ReconstructorVolumeData()
Only constructor All member variables are zeroed.
EMData * tmp_data
Inheriting class may allocate this, probably in setup()
ReconstructorVolumeData & operator=(const ReconstructorVolumeData &)
Disallow assignment.
virtual void normalize_threed(const bool sqrt_damp=false, const bool wiener=false)
Normalize on the assumption that image is a Fourier volume and that tmp_data is a volume of weights c...
Reconstructor class defines a way to do 3D recontruction.
virtual int determine_slice_agreement(EMData *slice, const Transform &euler, const float weight=1.0, bool sub=true)
Compares a slice to the current reconstruction volume and computes a normalization factor and quality...
EMObject & operator[](const string &key)
int insert_slice(const EMData *const slice, const Transform &euler)
virtual void setup_seed(EMData *seed, float seed_weight)
Initialize the reconstructor with a seed volume.
virtual void setup_seedandweights(EMData *seed, EMData *weight)
Initialize the reconstructor with a seed volume, as above.
virtual EMData * preprocess_slice(const EMData *const slice, const Transform &t=Transform())
While you can just insert unprocessed slices, if you call preprocess_slice yourself,...
Reconstructor & operator=(const Reconstructor &)
void print_params() const
Print the current parameters to std::out.
virtual void setup()=0
Initialize the reconstructor.
virtual void clear()
set the volume and tmp_volume data to zero, for use in Monte Carlo reconstructors
virtual EMData * projection(const Transform &euler, int ret_fourier=1)
This will create a projection from the current reconstruction.
virtual int insert_slice(const EMData *const slice, const Transform &euler, const float weight)
Insert an image slice to the reconstructor.
Reconstructor(const Reconstructor &that)
virtual EMData * finish(bool doift=true)
Finish reconstruction and return the complete model.
TypeDict is a dictionary to store <string, EMObject::ObjectType> pair.
void put(const string &key, EMObject::ObjectType o, const string &desc="")
Fourier space 3D reconstruction This is a modified version of the normal FourierReconstructor which i...
virtual void do_compare_slice_work(EMData *input_slice, const Transform &euler, float weight)
A function to perform the nuts and bolts of comparing an image slice.
static Reconstructor * NEW()
Factory incorporation uses the pointer of this function.
WienerFourierReconstructor(const WienerFourierReconstructor &that)
A pixel inserter pointer which inserts pixels into the 3D volume using one of a variety of insertion ...
virtual string get_name() const
Get the unique name of the reconstructor.
virtual bool pixel_at(const float &xx, const float &yy, const float &zz, float *dt)
This is a mode-2 pixel extractor.
virtual string get_desc() const
Get the one line description of the reconstructor.
virtual EMData * finish(bool doift=true)
Get the reconstructed volume Normally will return the volume in real-space with the requested size.
virtual int determine_slice_agreement(EMData *slice, const Transform &euler, const float weight=1.0, bool sub=true)
Compares a slice to the current reconstruction volume and computes a normalization factor and quality...
WienerFourierReconstructor()
Default constructor calls load_default_settings()
virtual ~WienerFourierReconstructor()
Deconstructor calls free_memory()
virtual int insert_slice(const EMData *const slice, const Transform &euler, const float weight)
Insert a slice into a 3D volume, in a given orientation.
WienerFourierReconstructor & operator=(const WienerFourierReconstructor &)
Disallow assignment.
virtual void do_insert_slice_work(const EMData *const input_slice, const Transform &euler, const float weight)
shared_ptr< std::ofstream > m_bin_ohandle
shared_ptr< std::ofstream > m_txt_ohandle
vector< float > m_defocuses
std::istream::off_type m_totsize
void get_image(int id, EMData *padfft)
shared_ptr< std::ifstream > m_ihandle
void add_image(EMData *data, const Transform &tf)
file_store(const string &filename, int npad, int write, bool CTF)
vector< point_t > m_points
void add_tovol(EMData *fftvol, EMData *wgtvol, const vector< int > &mults, int pbegin, int pend)
shared_ptr< std::ifstream > m_bin_if
shared_ptr< std::ofstream > m_txt_of
vector< std::istream::off_type > m_offsets
newfile_store(const string &prefix, int npad, bool ctf)
void add_image(EMData *data, const Transform &tf)
void get_image(int id, EMData *buf)
shared_ptr< std::ofstream > m_bin_of
virtual string get_desc() const
Get a clear, concise description of this class.
static Reconstructor * NEW()
virtual ~nn4Reconstructor()
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
virtual TypeDict get_param_types() const
virtual void setup()
Initialize the reconstructor.
int insert_padfft_slice(EMData *padded, const Transform &trans, float mult=1)
virtual int insert_slice(const EMData *const slice, const Transform &euler, const float weight)
Insert an image slice to the reconstructor.
virtual EMData * finish(bool doift=true)
Finish reconstruction and return the complete model.
void load_default_settings()
nn4_ctf Direct Fourier Inversion Reconstructor
static Reconstructor * NEW()
TypeDict get_param_types() const
virtual string get_desc() const
Get a clear, concise description of this class.
int insert_padfft_slice(EMData *padfft, EMData *ctf2d2, const Transform &trans, float mult=1)
virtual void setup()
Initialize the reconstructor.
int insert_buffed_slice(const EMData *buffer, float mult)
virtual ~nn4_ctfReconstructor()
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 int insert_slice(const EMData *const slice, const Transform &euler, const float weight)
Insert a slice into a 3D volume, in a given orientation.
nn4_ctf_rectDirect Fourier Inversion Reconstructor
nn4_ctf_rectReconstructor()
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
virtual ~nn4_ctf_rectReconstructor()
virtual EMData * finish(bool doift=true)
Finish reconstruction and return the complete model.
int insert_buffed_slice(const EMData *buffer, float mult)
static Reconstructor * NEW()
virtual void setup()
Initialize the reconstructor.
TypeDict get_param_types() const
int insert_padfft_slice(EMData *padfft, const Transform &trans, float mult=1)
virtual int insert_slice(const EMData *const slice, const Transform &euler, const float weight)
Insert a slice into a 3D volume, in a given orientation.
virtual string get_desc() const
Get a clear, concise description of this class.
nn4_ctfw Direct Fourier Weighted Inversion Reconstructor
virtual void setup()
Initialize the reconstructor.
virtual ~nn4_ctfwReconstructor()
int insert_padfft_slice_weighted(EMData *padfft, EMData *ctf2d2, vector< float > bckgnoise, const Transform &trans, const float weight)
virtual EMData * finish(bool compensate=true)
Finish reconstruction and return the complete model.
virtual string get_desc() const
Get a clear, concise description of this class.
virtual int insert_slice(const EMData *const slice, const Transform &euler, const float weight)
Insert a slice into a 3D volume, in a given orientation.
static Reconstructor * NEW()
TypeDict get_param_types() const
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
nn4_ctfws Direct Fourier Weighted Inversion Reconstructor for sorting
int insert_padfft_slice_weighted(EMData *padfft, EMData *ctf2d2, vector< float > bckgnoise, const Transform &trans, const float weight)
virtual int insert_slice(const EMData *const slice, const Transform &euler, const float weight)
Insert a slice into a 3D volume, in a given orientation.
static Reconstructor * NEW()
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
virtual void setup()
Initialize the reconstructor.
virtual string get_desc() const
Get a clear, concise description of this class.
virtual EMData * finish(bool compensate=true)
Finish reconstruction and return the complete model.
TypeDict get_param_types() const
virtual ~nn4_ctfwsReconstructor()
Direct Fourier inversion Reconstructor for extremly rectangular object.
virtual ~nn4_rectReconstructor()
virtual void setup()
Initialize the reconstructor.
virtual int insert_slice(const EMData *const slice, const Transform &euler, const float weight)
Insert an image slice to the reconstructor.
static Reconstructor * NEW()
virtual TypeDict get_param_types() const
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
void load_default_settings()
virtual EMData * finish(bool doift=true)
Finish reconstruction and return the complete model.
virtual string get_desc() const
Get a clear, concise description of this class.
int insert_padfft_slice(EMData *padded, const Transform &trans, float mult=1)
virtual int insert_slice(const EMData *const slice, const Transform &euler, const float weight)
Insert an image slice to the reconstructor.
virtual EMData * finish(bool doift=true)
Finish reconstruction and return the complete model.
virtual void setup()
Initialize the reconstructor.
static Reconstructor * NEW()
virtual string get_name() const
Get the unique name of this class (especially for factory based instantiation access)
virtual TypeDict get_param_types() const
int insert_padfft_slice(EMData *padded, const Transform &trans, float mult=1)
virtual string get_desc() const
Get a clear, concise description of this class.
static Reconstructor * NEW()
virtual int insert_slice(const EMData *const slice, const Transform &euler, const float weight)
Insert a slice into a 3D volume, in a given orientation.
~nnSSNR_ctfReconstructor()
nnSSNR_ctfReconstructor()
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 EMData * finish(bool doift=true)
Finish reconstruction and return the complete model.
virtual void setup()
Initialize the reconstructor.
int insert_padfft_slice(EMData *padded, const Transform &trans, float mult=1)
TypeDict get_param_types() const
void mult(int n)
multiply an integer number to each pixel value of the image.
void sub(float f)
subtract a float number to each pixel value of the image.
EMData * padfft_slice(const EMData *const slice, const Transform &t, int npad)
Direct Fourier inversion Reconstructor.
void dump_reconstructors()
map< string, vector< string > > dump_reconstructors_list()