Class for handling density maps.
Inheritance diagram for IMP::em::DensityMap:Public Member Functions | |
| DensityMap (std::string name="DensityMap%1%") | |
| DensityMap (const DensityHeader &header, std::string name="DensityMap%1%") | |
| Construct a density map as intructed in the input header. | |
| void | add (const DensityMap *other) |
| void | calc_all_voxel2loc () |
| Calculates the coordinates that correspond to all voxels. | |
| emreal | calcRMS () |
| Calculates RMSD and mean of a map values are stored in the header. | |
| void | copy_map (const DensityMap *other) |
| copy map into this map | |
| algebra::Vector3D | get_centroid (emreal threshold=0.0) const |
| DensityMap * | get_cropped (float threshold) |
| Create a new cropped map. | |
| DensityMap * | get_cropped (const algebra::BoundingBox3D &bb) |
| Create a new cropped map with the bounding box extent. | |
| int | get_dim_index_by_location (const algebra::Vector3D &v, int ind) const |
| Calculate dimension index of a given location. | |
| int | get_dim_index_by_location (float loc_val, int ind) const |
| const DensityHeader * | get_header () const |
| DensityHeader * | get_header_writable () |
| Returns a pointer to the header of the map in a writable version. | |
| algebra::Vector3D | get_location_by_voxel (long index) const |
| Calculate the location of a given voxel. | |
| float | get_location_in_dim_by_voxel (long index, int dim) const |
| Calculate the location of a given voxel in a given dimension. | |
| std::string | get_locations_string (float t) |
| emreal | get_max_value () const |
| Returns the the value of the voxel with the highest density. | |
| float | get_maximum_value_in_xy_plane (int z_ind) |
| Get the maximum value in a XY plane indicated by a Z index. | |
| float | get_maximum_value_in_xz_plane (int y_ind) |
| Get the maximum value in a XZ plane indicated by a Y index. | |
| float | get_maximum_value_in_yz_plane (int x_ind) |
| Get the maximum value in a YZ plane indicated by a X index. | |
| emreal | get_min_value () const |
| Returns the the value of the voxel with the lowest density. | |
| long | get_number_of_voxels () const |
| number of map voxels | |
| algebra::Vector3D | get_origin () const |
| bool | get_rms_calculated () const |
| Float | get_spacing () const |
| Updated the voxel size of the map. | |
| algebra::Vector3D | get_top () const |
| emreal | get_value (float x, float y, float z) const |
| Gets the value of the voxel located at (x,y,z) | |
| emreal | get_value (const algebra::Vector3D &point) const |
| emreal | get_value (long index) const |
| Gets the value of the voxel at a given index. | |
| long | get_voxel_by_location (float x, float y, float z) const |
| Calculate the voxel of a given location. | |
| long | get_voxel_by_location (const algebra::Vector3D &v) const |
| Calculate the voxel of a given location. | |
| bool | is_normalized () const |
| bool | is_part_of_volume (float x, float y, float z) const |
| Checks whether a given point is in the grid the voxel of a given location. | |
| bool | is_part_of_volume (const algebra::Vector3D &v) const |
| Checks whether a given point is in the grid the voxel of a given location. | |
| bool | is_xyz_ind_part_of_volume (int ix, int iy, int iz) const |
| int | lower_voxel_shift (emreal loc, emreal kdist, emreal orig, int ndim) const |
| void | multiply (float factor) |
| void | pad (int nx, int ny, int nz, float val=0.0) |
| DensityMap * | pad_margin (int mrg_x, int mrg_y, int mrg_z, float val=0.0) |
| Create a new padded map. | |
| void | pick_max (const DensityMap *other) |
| void | release () |
| void | reset_data (float value=0.0) |
| Set the density voxels to some calue and reset the managment flags. | |
| bool | same_dimensions (const DensityMap *other) const |
| Checks if two maps have the same dimensions. | |
| bool | same_origin (const DensityMap *other) const |
| Checks if two maps have the same origin. | |
| bool | same_voxel_size (const DensityMap *other) const |
| Checks if two maps have the same voxel size. | |
| void | set_origin (float x, float y, float z) |
| Sets the origin of the header. | |
| void | set_origin (const IMP::algebra::Vector3D &v) |
| void | set_value (long index, emreal value) |
| Set the value of the voxel at a given index. | |
| void | set_value (float x, float y, float z, emreal value) |
| Set the value of the voxel at a given index. | |
| void | set_void_map (int nx, int ny, int nz) |
| Set the map dimension and reset all voxels to 0. | |
| void | std_normalize () |
| Normailze the density voxles according to standard deviation (stdv). | |
| void | update_voxel_size (float new_apix) |
| Updated the voxel size of the map. | |
| int | upper_voxel_shift (emreal loc, emreal kdist, emreal orig, int ndim) const |
| long | xyz_ind2voxel (int x, int y, int z) const |
| Calculate the voxel of a given xyz indexes. | |
Public Member Functions inherited from IMP::base::Object | |
| std::size_t | __hash__ () const |
| virtual std::string | get_type_name () const =0 |
| Return a string identifying the type of the object. | |
| virtual IMP::base::VersionInfo | get_version_info () const =0 |
| Get information about the module and version of the object. | |
| void | set_check_level (CheckLevel l) |
| void | set_log_level (LogLevel l) |
| Set the logging level used in this object. | |
| void | set_was_used (bool tf) const |
| void | show (std::ostream &out=std::cout) const |
| const std::string & | get_name () const |
| void | set_name (std::string name) |
Static Public Member Functions | |
| static DensityMap * | get_from (IMP::base::Object *o) |
Protected Member Functions | |
| void | allocated_data () |
| void | float2real (float *f_data, boost::scoped_array< emreal > &r_data) |
| void | real2float (emreal *r_data, boost::scoped_array< float > &f_data) |
| void | reset_all_voxel2loc () |
| void | update_header () |
| update the header values – still in work | |
Protected Member Functions inherited from IMP::base::Object | |
| Object (std::string name) | |
Protected Attributes | |
| boost::scoped_array< emreal > | data_ |
| bool | data_allocated_ |
| DensityHeader | header_ |
| bool | loc_calculated_ |
| true if the locations have already been computed | |
| bool | normalized_ |
| bool | rms_calculated_ |
| boost::scoped_array< float > | x_loc_ |
| boost::scoped_array< float > | y_loc_ |
| boost::scoped_array< float > | z_loc_ |
Friends | |
| DensityMap * | read_map (std::string filename, MapReaderWriter *reader) |
| void | write_map (DensityMap *m, std::string filename, MapReaderWriter *writer) |
Related Functions | |
(Note that these are not member functions.) | |
| double | get_density (const DensityMap *m, const algebra::Vector3D &v) |
| rotate a grid | |
| DensityMap * | get_resampled (DensityMap *input, double scaling) |
| DensityMap * | get_transformed (const DensityMap *input, const algebra::Transformation3D &tr, double threshold) |
| DensityMap * | get_transformed (DensityMap *input, const algebra::Transformation3D &tr) |
| void | get_transformed_into (const DensityMap *source, const algebra::Transformation3D &tr, DensityMap *into, bool calc_rms=true) |
| Rotate a density map into another maps. | |
| DensityMap * | read_map (std::string filename, MapReaderWriter *reader) |
| DensityMap * | read_map (std::string filename) |
| void | write_map (DensityMap *m, std::string filename, MapReaderWriter *writer) |
| void | write_map (DensityMap *m, std::string filename) |
| IMP::em::DensityMap::DensityMap | ( | const DensityHeader & | header, |
| std::string | name = "DensityMap%1%" |
||
| ) |
Construct a density map as intructed in the input header.
| void IMP::em::DensityMap::add | ( | const DensityMap * | other | ) |
Sums two grids. The result is kept in the map.
| [in] | other | the other map |
| void IMP::em::DensityMap::calc_all_voxel2loc | ( | ) |
Calculates the coordinates that correspond to all voxels.
| emreal IMP::em::DensityMap::calcRMS | ( | ) |
Calculates RMSD and mean of a map values are stored in the header.
The header stores whether map is normalized.
| void IMP::em::DensityMap::copy_map | ( | const DensityMap * | other | ) |
copy map into this map
| algebra::Vector3D IMP::em::DensityMap::get_centroid | ( | emreal | threshold = 0.0 | ) | const |
Calculates the centroid of all the voxels with density above a given threshold
| [in] | threshold | the input threshold |
| DensityMap* IMP::em::DensityMap::get_cropped | ( | float | threshold | ) |
Create a new cropped map.
The margins are determined to be the bounding box with density values below the input
| [in] | threshold | used for cropping |
| DensityMap* IMP::em::DensityMap::get_cropped | ( | const algebra::BoundingBox3D & | bb | ) |
Create a new cropped map with the bounding box extent.
| [in] | bb | the bounding box |
| int IMP::em::DensityMap::get_dim_index_by_location | ( | const algebra::Vector3D & | v, |
| int | ind | ||
| ) | const |
Calculate dimension index of a given location.
| [in] | v | The position (in angstroms) |
| [in] | ind | dimension index (X:0,Y:1 or Z:2) |
| DensityHeader* IMP::em::DensityMap::get_header_writable | ( | ) |
Returns a pointer to the header of the map in a writable version.
| algebra::Vector3D IMP::em::DensityMap::get_location_by_voxel | ( | long | index | ) | const |
Calculate the location of a given voxel.
| [in] | index | The voxel index |
| float IMP::em::DensityMap::get_location_in_dim_by_voxel | ( | long | index, |
| int | dim | ||
| ) | const |
Calculate the location of a given voxel in a given dimension.
| [in] | index | The voxel index |
| [in] | dim | The dimesion of intereset (x:=0,y:=1,z:=2) |
| std::string IMP::em::DensityMap::get_locations_string | ( | float | t | ) |
Prints the locations of all of the voxels with value above a given threshold into the input stream.
| emreal IMP::em::DensityMap::get_max_value | ( | ) | const |
Returns the the value of the voxel with the highest density.
| float IMP::em::DensityMap::get_maximum_value_in_xy_plane | ( | int | z_ind | ) |
Get the maximum value in a XY plane indicated by a Z index.
| float IMP::em::DensityMap::get_maximum_value_in_xz_plane | ( | int | y_ind | ) |
Get the maximum value in a XZ plane indicated by a Y index.
| float IMP::em::DensityMap::get_maximum_value_in_yz_plane | ( | int | x_ind | ) |
Get the maximum value in a YZ plane indicated by a X index.
| emreal IMP::em::DensityMap::get_min_value | ( | ) | const |
Returns the the value of the voxel with the lowest density.
| long IMP::em::DensityMap::get_number_of_voxels | ( | ) | const |
number of map voxels
| Float IMP::em::DensityMap::get_spacing | ( | ) | const |
Updated the voxel size of the map.
| emreal IMP::em::DensityMap::get_value | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) | const |
Gets the value of the voxel located at (x,y,z)
| [in] | x | The position ( in angstroms) of the x coordinate |
| [in] | y | The position ( in angstroms) of the y coordinate |
| [in] | z | The position ( in angstroms) of the z coordinate |
| IndexException | The point is not covered by the grid. |
| emreal IMP::em::DensityMap::get_value | ( | long | index | ) | const |
Gets the value of the voxel at a given index.
| [in] | index | voxel number in physical sense, NOT logical |
| long IMP::em::DensityMap::get_voxel_by_location | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) | const |
Calculate the voxel of a given location.
| [in] | x | The position (in angstroms) of the x coordinate |
| [in] | y | The position (in angstroms) of the y coordinate |
| [in] | z | The position (in angstroms) of the z coordinate |
| long IMP::em::DensityMap::get_voxel_by_location | ( | const algebra::Vector3D & | v | ) | const |
Calculate the voxel of a given location.
| [in] | v | The position (in angstroms) |
| bool IMP::em::DensityMap::is_part_of_volume | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) | const |
Checks whether a given point is in the grid the voxel of a given location.
| [in] | x | The position ( in angstroms) of the x coordinate |
| [in] | y | The position ( in angstroms) of the y coordinate |
| [in] | z | The position ( in angstroms) of the z coordinate |
| bool IMP::em::DensityMap::is_part_of_volume | ( | const algebra::Vector3D & | v | ) | const |
Checks whether a given point is in the grid the voxel of a given location.
| [in] | v | The position ( in angstroms) |
| void IMP::em::DensityMap::multiply | ( | float | factor | ) |
Multiply each voxel in the map by the input factor The result is kept in the map.
| [in] | factor | the multiplication factor |
| void IMP::em::DensityMap::pad | ( | int | nx, |
| int | ny, | ||
| int | nz, | ||
| float | val = 0.0 |
||
| ) |
Increase the dimension of the map The function pads zeros to the right-upper section on the map. The original content of the map will be in the lower XYZ part of the map
| [in] | nx | the number of voxels on the X axis |
| [in] | ny | the number of voxels on the Y axis |
| [in] | nz | the number of voxels on the Z axis |
| [in] | val | all additional voxels will have this value |
| if | the input x/y/z voxels is smaller than the one currently in the map |
| DensityMap* IMP::em::DensityMap::pad_margin | ( | int | mrg_x, |
| int | mrg_y, | ||
| int | mrg_z, | ||
| float | val = 0.0 |
||
| ) |
Create a new padded map.
Given this map of size [nx,ny,nz], the new map is of size [2*mrg_x+nx,2*mrg_y+ny,2*mrg_z+nz]. The new map will consist of the values of the old map, padded margin on all sides.
| [in] | mrg_x | number of margin voxels to add on both right and left on the X axis |
| [in] | mrg_y | number of margin voxels to add on both right and left on the Y axis |
| [in] | mrg_z | number of margin voxels to add on both right and left on the Z axis |
| [in] | val | ignored |
| if | the input x/y/z voxels is smaller than the one currently in the map |
| void IMP::em::DensityMap::pick_max | ( | const DensityMap * | other | ) |
Pick the max value between two corresponding voxels between two maps The result is kept in the map.
| [in] | other | the other map |
| void IMP::em::DensityMap::reset_data | ( | float | value = 0.0 | ) |
Set the density voxels to some calue and reset the managment flags.
| [in] | value | all of the density voxels will have this value |
| bool IMP::em::DensityMap::same_dimensions | ( | const DensityMap * | other | ) | const |
Checks if two maps have the same dimensions.
| [in] | other | the map to compare with |
| bool IMP::em::DensityMap::same_origin | ( | const DensityMap * | other | ) | const |
Checks if two maps have the same origin.
| [in] | other | the map to compare with |
| bool IMP::em::DensityMap::same_voxel_size | ( | const DensityMap * | other | ) | const |
Checks if two maps have the same voxel size.
| [in] | other | the map to compare with |
| void IMP::em::DensityMap::set_origin | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Sets the origin of the header.
| x | the new x (angstroms) |
| y | the new y (angstroms) |
| z | the new z (angstroms) |
| void IMP::em::DensityMap::set_value | ( | long | index, |
| emreal | value | ||
| ) |
Set the value of the voxel at a given index.
| [in] | index | voxel number in physical sense, NOT logical |
| [in] | value | value |
| void IMP::em::DensityMap::set_value | ( | float | x, |
| float | y, | ||
| float | z, | ||
| emreal | value | ||
| ) |
Set the value of the voxel at a given index.
index voxel number in physical sense, NOT logical
| void IMP::em::DensityMap::set_void_map | ( | int | nx, |
| int | ny, | ||
| int | nz | ||
| ) |
Set the map dimension and reset all voxels to 0.
| [in] | nx | x-dimension (voxels) |
| [in] | ny | y-dimension (voxels) |
| [in] | nz | z-dimension (voxels) |
| void IMP::em::DensityMap::std_normalize | ( | ) |
Normailze the density voxles according to standard deviation (stdv).
The mean is subtracted from the map, which is then divided by the stdv. The normalization flag is set to avoid repeated computation
|
protected |
update the header values – still in work
| void IMP::em::DensityMap::update_voxel_size | ( | float | new_apix | ) |
Updated the voxel size of the map.
| long IMP::em::DensityMap::xyz_ind2voxel | ( | int | x, |
| int | y, | ||
| int | z | ||
| ) | const |
Calculate the voxel of a given xyz indexes.
| [in] | x | The voxel index on the x axis of the grid |
| [in] | y | The voxel index on the y axis of the grid |
| [in] | z | The voxel index on the z axis of the grid |
|
related |
rotate a grid
/param[in] orig_dens the density map to rotate /param[in] trans the transformation
|
related |
Get a resampled version of the map. The spacing is multiplied by scaling. That means, scaling values greater than 1 increase the voxel size.
|
related |
Return a new density map containing a rotated version of the old one. Only voxels whose value is above threshold are considered when computing the bounding box of the new map (set IMP::em::get_bounding_box()).
|
related |
Return a new density map containing a rotated version of the old one. The dimension of the new map is the same as the old one.
|
related |
Rotate a density map into another maps.
| [in] | from | the map to transform |
| [in] | tr | transform the from density map by this transformation |
| [out] | into | the map to tranform into |
| [in] | calc_rms | if true RMS is calculated on the transformed map |
|
related |
Read a density map from a file and return it.
|
related |
Read a density map from a file and return it. Guess the file type from the file name. The file formats supported are:
|
friend |
Read a density map from a file and return it.
|
related |
Write a density map to a file.
|
related |
Write a density map to a file. Guess the file type from the file name. The file formats supported are:
|
friend |
Write a density map to a file.
|
protected |
true if the locations have already been computed
|
protected |
Locations for each of the voxels of the map (they are precomputed and each one is of size nvox, being nvox the size of the map)