Simple fft-based radial mapfiltering implementation. More...
#include <mapfilter.h>
Public Types | |
enum | TYPE { NONE, Absolute, Relative } |
Scaling modes. | |
Public Member Functions | |
MapFilter_fft (const MapFilterFn_base &fltr, const ftype scale=1.0, const TYPE type=NONE) | |
constructor | |
MapFilter_fft (clipper::Xmap< T > &result, const clipper::Xmap< T > &xmap, MapFilterFn_base &fltr, const ftype scale=1.0, const TYPE type=NONE) | |
constructor: shorthand for constructor+operator | |
bool | operator() (clipper::Xmap< T > &result, const clipper::Xmap< T > &xmap) const |
bool | operator() (clipper::NXmap< T > &result, const clipper::NXmap< T > &nxmap) const |
Simple fft-based radial mapfiltering implementation.
The FFT method is fast, and also gives good precision.
The following example demonstrates how to use the MapFilter to calculate the local mean and local deviation of an electron density map, in 'xmap':
make squared map clipper::Xmap<float> xmap2( xmap ); clipper::Xmap<float>::Map_reference_index ix; for ( ix = xmap2.first(); !ix.last(); ix.next() ) xmap2[ix] = pow( xmap2[ix], 2.0 ); now calculate local mean, local mean squared clipper::MapFilterFn_step fn( filter_radius ); clipper::MapFilter_fft<float> fltr( fn, 1.0, clipper::MapFilter_fft<float>::Relative ); clipper::Xmap<float> lmean, lsigm; fltr( lmean, xmap ); fltr( lsigm, xmap2 ); calculate std deviation for ( ix = lmean.first(); !ix.last(); ix.next() ) lsigm[ix] = sqrt( lsigm[ix] - pow( lmean[ix], 2.0 ) );
This would be a useful step in solvent mask determination, for example.
clipper::MapFilter_fft< T >::MapFilter_fft | ( | const MapFilterFn_base & | fltr, | |
const ftype | scale = 1.0 , |
|||
const TYPE | type = NONE | |||
) | [inline] |
constructor
The filter function is constructed with the given filter. Scaling may also be optionally applied. This may be absolute, which just applies a scale factor to the result, or relative, which scales the filter relative to its own integral. Therefore, relative scaling with a scale factor of 1.0 gives an output map on the same scale as the input map.
Note that the filter is not stored internally, and so must persist as long as the MapFilter is required.
fltr | The radial filter to apply. | |
scale | The scale factor to apply (default = 1.0). | |
type | The type of scaling to apply: NONE, Absolute, Relative. |
bool clipper::MapFilter_fft< T >::operator() | ( | clipper::Xmap< T > & | result, | |
const clipper::Xmap< T > & | xmap | |||
) | const [inline, virtual] |
Apply the filter to a given map.
result | The filtered map. | |
xmap | The map to be filtered. |
Implements clipper::MapFilter_base< T >.
References clipper::Xmap< T >::cell(), clipper::Xmap_base::Map_reference_coord::coord(), clipper::Coord_grid::coord_frac(), clipper::FFTmap_p1::cplx_data(), clipper::FFTmap_p1::fft_x_to_h(), clipper::Xmap< T >::first(), clipper::Xmap< T >::grid_sampling(), clipper::Xmap< T >::init(), clipper::Coord_frac::lengthsq(), clipper::Xmap_base::Map_reference_coord::next_u(), clipper::Xmap_base::Map_reference_coord::next_v(), clipper::Xmap_base::Map_reference_coord::next_w(), clipper::Grid::nu(), clipper::Grid_sampling::nu(), clipper::Grid::nv(), clipper::Grid_sampling::nv(), clipper::Grid::nw(), clipper::Grid_sampling::nw(), clipper::FFTmap_p1::real_data(), clipper::Xmap< T >::spacegroup(), clipper::Coord_grid::u(), clipper::Coord_grid::v(), clipper::Cell::volume(), and clipper::Coord_grid::w().
bool clipper::MapFilter_fft< T >::operator() | ( | clipper::NXmap< T > & | result, | |
const clipper::NXmap< T > & | nxmap | |||
) | const [inline] |
Apply the filter to a given map.
result | The filtered map. | |
nxmap | The map to be filtered. |
References clipper::FFTmap_p1::cplx_data(), clipper::FFTmap_p1::fft_x_to_h(), clipper::NXmap< T >::first(), clipper::NXmap< T >::grid(), clipper::NXmap< T >::init(), clipper::Grid_sampling::nu(), clipper::Grid::nu(), clipper::Grid_sampling::nv(), clipper::Grid::nv(), clipper::Grid_sampling::nw(), clipper::Grid::nw(), clipper::NXmap< T >::operator_grid_orth(), clipper::NXmap< T >::operator_orth_grid(), clipper::FFTmap_p1::real_data(), clipper::RTop< T >::rot(), clipper::Coord_grid::u(), clipper::Coord_grid::v(), clipper::Coord_grid::w(), and clipper::Vec3<>::zero().