EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions
EMAN::FourierPlaneReconstructor Class Reference

Fourier space 3D reconstruction The Fourier reconstructor is designed to work in an iterative fashion, where similarity ("quality") metrics are used to determine if a slice should be inserted into the 3D in each subsequent iteration. More...

#include <reconstructor.h>

Inheritance diagram for EMAN::FourierPlaneReconstructor:
Inheritance graph
[legend]
Collaboration diagram for EMAN::FourierPlaneReconstructor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FourierPlaneReconstructor ()
 Default constructor calls load_default_settings()
virtual ~FourierPlaneReconstructor ()
 Deconstructor calls free_memory()
virtual void setup ()
 Setup the Fourier reconstructor

Exceptions:
InvalidValueExceptionWhen one of the input parameters is invalid.

virtual void setup_seed (EMData *seed, float seed_weight)
 Initialize the reconstructor with a seed volume.
virtual EMDatapreprocess_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 sure all the pixels are in the right position it always returns a copy of the provided slice, so it should be deleted by someone eventually.
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.
virtual EMDatafinish (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.
virtual string get_desc () const
 Get the one line description of the reconstructor.
virtual TypeDict get_param_types () const
 Get the parameter types of this object.

Static Public Member Functions

static ReconstructorNEW ()
 Factory incorporation uses the pointer of this function.

Static Public Attributes

static const string NAME = "fourier_plane"

Protected Member Functions

virtual void load_default_settings ()
 Load default settings.
virtual void free_memory ()
 Frees the memory owned by this object (but not parent objects) Deletes the FourierPixelInserter3D pointer.
virtual void load_inserter ()
 Load the pixel inserter based on the information in params.
virtual void do_insert_slice_work (const EMData *const input_slice, const Transform &euler, const float weight)
 A function to perform the nuts and bolts of inserting an image slice.
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 bool pixel_at (const float &xx, const float &yy, const float &zz, float *dt)
 This is a mode-2 pixel extractor.

Protected Attributes

FourierPixelInserter3Dinserter
 A pixel inserter pointer which inserts pixels into the 3D volume using one of a variety of insertion methods.

Private Member Functions

 FourierPlaneReconstructor (const FourierPlaneReconstructor &that)
 Disallow copy construction.
FourierPlaneReconstructoroperator= (const FourierPlaneReconstructor &)
 Disallow assignment.

Detailed Description

Fourier space 3D reconstruction The Fourier reconstructor is designed to work in an iterative fashion, where similarity ("quality") metrics are used to determine if a slice should be inserted into the 3D in each subsequent iteration.

The client creates a Fourier reconstructor to insert real images into a 3D volume. The return image is a real space image

This reconstructor is based on EMAN1's Fourier reconstructor with a handful of modifications including 1. - Fourier ring correlation (FRC) as opposed to the mean phase residual is used to estimate slice quality. The FRC of the slice in the 3D volume is determined - but the slice is removed from the 3D volume before doing this so the score reflects the extent to which the slice agrees with the contribution of the other slices in the 3D volume. The FRC is converted to SNR using the relationship described by Penczek ( Three-dimensional spectral signal to noise ratio for a class of reconstruction algorithms, JSB 2002 138 (24-46) ) FRC = S/(sqrt(S+N1)sqrt(S+N2)) Where N1 is the noise in the slice of the 3D volume and N2 is the noise in the image slice being inserted. We make the assumption that the noise in the 3D volume is 0 (N1=0) to get FRC^2 = SNR/(1+SNR) which gives a spectral SNR plot - we then divide each SNR value by the number of particles in the class average (seeing as SNR should scale linearly with the number of particles) to get the estimated SNR per contributing particle in this class average. If the particles that have been averaged are not homogenous this score should be low etc. The scaled SNR curve is then converted back to a FRC curve and integrated. This integral is the similarity metric, and depends on how far information extends to in Fourier space - typical values range from 0.05 to 0.2, but can vary substantially depending on the data.

2 - Uses half of the memory used by EMAN1's equivalent reconstruction algorithm

        Reconstructor* r = Factory<Reconstructor>::get("fourier", params);
        r->setup();
        for k in 0:num_iterations-1
                // First do a round of slice quality (metric) determination - only possible if a 3D volume has
                // already been generated (k>0)
                if ( k  > 0 )
                        // Determine the agreement of the slices with the previous reconstructed volume (in memory)
                        for i in 0:num_slices-1
                                r->determine_slice_agreement(image[i], image[i].euler_orientation);

                // Insert the slices into the 3D volume
                // Will decide not to insert the slice if the its "quality" is not good enough
                for i in 0:num_slices-1
                        int failure = r->insert_slice(image[i], image[i].euler_orientation);
                        if ( failure ) cout << "Slice was not inserted due to poor quality" << endl;

        // Get the resulting volume
        EMData* result = r->finish();
        result->write_image("threed.mrc");

Definition at line 703 of file reconstructor.h.


Constructor & Destructor Documentation

EMAN::FourierPlaneReconstructor::FourierPlaneReconstructor ( ) [inline]

Default constructor calls load_default_settings()

Definition at line 709 of file reconstructor.h.

References load_default_settings().

Referenced by NEW().

virtual EMAN::FourierPlaneReconstructor::~FourierPlaneReconstructor ( ) [inline, virtual]

Deconstructor calls free_memory()

Definition at line 714 of file reconstructor.h.

References free_memory().

{ free_memory(); }
EMAN::FourierPlaneReconstructor::FourierPlaneReconstructor ( const FourierPlaneReconstructor that) [private]

Disallow copy construction.


Member Function Documentation

void FourierPlaneReconstructor::clear ( ) [virtual]

clear the volume and tmp_data for use in Monte Carlo reconstructions

Reimplemented from EMAN::Reconstructor.

Definition at line 335 of file reconstructor.cpp.

{}
int FourierPlaneReconstructor::determine_slice_agreement ( EMData slice,
const Transform euler,
const float  weight = 1.0,
bool  sub = true 
) [virtual]

Compares a slice to the current reconstruction volume and computes a normalization factor and quality.

Normalization and quality are returned via attributes set in the passed slice. You may freely mix calls to determine_slice_agreement with calls to insert_slice, but note that determine_slice_agreement can only use information from slices that have already been inserted. Attributes set in the slice are: reconstruct_norm the relative normalization factor which should be applied before inserting the slice reconstruct_qual a scaled quality factor (larger better) for this slice as compared to the existing reconstruction reconstruct_absqual the absolute (not scaled based on weight) quality factor comparing this slice to the existing reconstruction reconstruct_weight the summed weights from all voxels intersecting with the inserted slice, larger -> more overlap with other slices

Parameters:
input_sliceThe EMData slice to be compared
eulerThe orientation of the slice as a Transform object
weightA weighting factor for this slice, generally the number of particles in a class-average. May be ignored by some reconstructors
subFlag indicating whether to subtract the slice from the volume before comparing. May be ignored by some reconstructors
Returns:
0 if OK. 1 if error.
Exceptions:
NullPointerExceptionif the input EMData pointer is null
ImageFormatExceptionif the image is complex as opposed to real

Reimplemented from EMAN::Reconstructor.

Definition at line 339 of file reconstructor.cpp.

{ return 0; }
void FourierPlaneReconstructor::do_compare_slice_work ( EMData input_slice,
const Transform euler,
float  weight 
) [protected, virtual]

A function to perform the nuts and bolts of comparing an image slice.

Parameters:
input_slicethe slice to insert into the 3D volume
eulera transform storing the slice euler angle

Definition at line 340 of file reconstructor.cpp.

{}
void FourierPlaneReconstructor::do_insert_slice_work ( const EMData *const  input_slice,
const Transform euler,
const float  weight 
) [protected, virtual]

A function to perform the nuts and bolts of inserting an image slice.

Parameters:
input_slicethe slice to insert into the 3D volume
eulera transform storing the slice euler angle
weightweighting factor for this slice (usually number of particles in a class-average)

Definition at line 338 of file reconstructor.cpp.

{}
EMData * FourierPlaneReconstructor::finish ( bool  doift = true) [virtual]

Get the reconstructed volume Normally will return the volume in real-space with the requested size.

The calling application is responsible for removing any padding.

Parameters:
doiftA flag indicating whether the returned object should be guaranteed to be in real-space (true) or should be left in whatever space the reconstructor generated
Returns:
The real space reconstructed volume

Reimplemented from EMAN::Reconstructor.

Definition at line 342 of file reconstructor.cpp.

{ return NULL; }
void FourierPlaneReconstructor::free_memory ( ) [protected, virtual]

Frees the memory owned by this object (but not parent objects) Deletes the FourierPixelInserter3D pointer.

Reimplemented from EMAN::ReconstructorVolumeData.

Definition at line 331 of file reconstructor.cpp.

Referenced by ~FourierPlaneReconstructor().

{}
virtual string EMAN::FourierPlaneReconstructor::get_desc ( ) const [inline, virtual]

Get the one line description of the reconstructor.

Implements EMAN::FactoryBase.

Definition at line 792 of file reconstructor.h.

                {
                        return "Reconstruction via direct Fourier methods using one of a variety of different kernels, most of which are Gaussian based";
                }
virtual string EMAN::FourierPlaneReconstructor::get_name ( ) const [inline, virtual]

Get the unique name of the reconstructor.

Implements EMAN::FactoryBase.

Definition at line 785 of file reconstructor.h.

References NAME.

                {
                        return NAME;
                }
virtual TypeDict EMAN::FourierPlaneReconstructor::get_param_types ( ) const [inline, virtual]

Get the parameter types of this object.

Returns:
a TypeDict detailing all of the acceptable (and necessary) parameters

Implements EMAN::FactoryBase.

Definition at line 808 of file reconstructor.h.

References EMAN::EMObject::BOOL, EMAN::EMObject::INTARRAY, EMAN::TypeDict::put(), and EMAN::EMObject::STRING.

                {
                        TypeDict d;
                        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.");
                        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");
                        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.");
                        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.");
                        d.put("verbose", EMObject::BOOL, "Optional. Toggles writing useful information to standard out. Default is false.");
                        d.put("quiet", EMObject::BOOL, "Optional. If false, print verbose information.");
                        return d;
                }
int FourierPlaneReconstructor::insert_slice ( const EMData *const  slice,
const Transform euler,
const float  weight 
) [virtual]

Insert a slice into a 3D volume, in a given orientation.

Returns:
0 if successful, 1 otherwise
Parameters:
slicethe image slice to be inserted into the 3D volume
eulerEuler angle of this image slice.
weightA weighting factor for this slice, generally the number of particles in a class-average. May be ignored by some reconstructors
Returns:
0 if OK. 1 if error.
Exceptions:
NullPointerExceptionif the input EMData pointer is null
ImageFormatExceptionif the image is complex as opposed to real

Reimplemented from EMAN::Reconstructor.

Definition at line 337 of file reconstructor.cpp.

{ return 0; }
void FourierPlaneReconstructor::load_default_settings ( ) [protected, virtual]

Load default settings.

Definition at line 330 of file reconstructor.cpp.

Referenced by FourierPlaneReconstructor().

{}
void FourierPlaneReconstructor::load_inserter ( ) [protected, virtual]

Load the pixel inserter based on the information in params.

Definition at line 332 of file reconstructor.cpp.

{}
static Reconstructor* EMAN::FourierPlaneReconstructor::NEW ( ) [inline, static]

Factory incorporation uses the pointer of this function.

Returns:
a Reconstructor pointer to a newly allocated FourierReconstructor

Definition at line 800 of file reconstructor.h.

References FourierPlaneReconstructor().

                {
                        return new FourierPlaneReconstructor();
                }
FourierPlaneReconstructor& EMAN::FourierPlaneReconstructor::operator= ( const FourierPlaneReconstructor ) [private]

Disallow assignment.

bool FourierPlaneReconstructor::pixel_at ( const float &  xx,
const float &  yy,
const float &  zz,
float *  dt 
) [protected, virtual]

This is a mode-2 pixel extractor.

Parameters:
xx,yy,zzvoxel coordinates (need not be integers)
dtfloat pointer with 3 floats allocated for returned complex value and weight sum

Definition at line 341 of file reconstructor.cpp.

{ return false; }
EMData * FourierPlaneReconstructor::preprocess_slice ( const EMData *const  slice,
const Transform t = Transform() 
) [virtual]

Preprocess the slice prior to insertion into the 3D volume this Fourier tranforms the slice and make sure all the pixels are in the right position it always returns a copy of the provided slice, so it should be deleted by someone eventually.

Returns:
the processed slice
Parameters:
slicethe slice to be prepocessed
ttransform to be used for insertion
Exceptions:
InvalidValueExceptionwhen the specified padding value is less than the size of the images

Reimplemented from EMAN::Reconstructor.

Definition at line 336 of file reconstructor.cpp.

{ return NULL; }
void FourierPlaneReconstructor::setup ( ) [virtual]

Setup the Fourier reconstructor

Exceptions:
InvalidValueExceptionWhen one of the input parameters is invalid.

Implements EMAN::Reconstructor.

Definition at line 333 of file reconstructor.cpp.

{}
void FourierPlaneReconstructor::setup_seed ( EMData seed,
float  seed_weight 
) [virtual]

Initialize the reconstructor with a seed volume.

This can be used to provide some 'default' value when there is missing data in Fourier space. The passed 'seed' must be of the appropriate padded size, must be in Fourier space, and the same EMData* object will be returned by finish(), meaning the Reconstructor is implicitly taking ownership of the object. However, in Python, this means the seed may be passed in without copying, as the same EMData will be coming back out at the end. The seed_weight determines how 'strong' the seed volume should be as compared to other inserted slices in Fourier space.

Exceptions:
InvalidValueExceptionWhen one of the input parameters is invalid

Reimplemented from EMAN::Reconstructor.

Definition at line 334 of file reconstructor.cpp.

{}

Member Data Documentation

A pixel inserter pointer which inserts pixels into the 3D volume using one of a variety of insertion methods.

Definition at line 856 of file reconstructor.h.

const string FourierPlaneReconstructor::NAME = "fourier_plane" [static]

Definition at line 820 of file reconstructor.h.

Referenced by get_name().


The documentation for this class was generated from the following files: