MAP import/export parent class for clipper objects. More...
#include <ccp4_map_io.h>
Public Types | |
enum | ASUerror { ASUCORRECT, ASUINCOMPLETE, ASUINCONSISTENT } |
Public Member Functions | |
CCP4MAPfile () | |
Constructor: does nothing. | |
~CCP4MAPfile () | |
Destructor: close any file that was left open. | |
void | open_read (const String filename_in) |
Open a file for read access. | |
void | close_read () |
Close a file after reading. | |
void | open_write (const String filename_out) |
Open a file for read access. | |
void | close_write () |
Close a file after reading. | |
void | set_cell (const Cell &cell) |
set cell desription (NXmap write only) | |
const Spacegroup & | spacegroup () const |
get file spacegroup | |
const Cell & | cell () const |
get file cell | |
const Grid_sampling & | grid_sampling () const |
get file grid_sampling | |
template<class T > | |
void | import_xmap (Xmap< T > &xmap) const |
import data to Xmap | |
template<class T > | |
void | export_xmap (const Xmap< T > &xmap) |
export data from Xmap | |
template<class T > | |
void | import_nxmap (NXmap< T > &nxmap) const |
import data to NXmap | |
template<class T > | |
void | export_nxmap (const NXmap< T > &nxmap) |
export data from NXmap | |
template<class T > | |
ASUerror | import_xmap_check_asu (Xmap< T > &xmap, T missing) const |
import data to Xmap and check ASU (float/double only) | |
Protected Types | |
enum | MAPmode { NONE, READ, WRITE } |
Protected Attributes | |
String | filename |
filename | |
MAPmode | mode |
mode | |
ASUerror | asuerr |
ASU error flag. | |
Spacegroup | spacegroup_ |
map spacegroup | |
Cell | cell_ |
map cell | |
Grid_sampling | grid_sam_ |
cell grid sampling | |
Grid_range | grid_map_ |
map grid extent |
MAP import/export parent class for clipper objects.
This is the import/export class which can be linked to a CCP4 map file and be used to transfer data into or out of a Clipper data structure.
clipper::CCP4MAPfile::CCP4MAPfile | ( | ) |
Constructor: does nothing.
Constructing an CCP4MAPfile does nothing except flag the object as not attached to any file for either input or output
References mode.
clipper::CCP4MAPfile::~CCP4MAPfile | ( | ) |
Destructor: close any file that was left open.
Close any files which were left open. This is particularly important since to access the MAP file efficiently, data reads and writes are deferred until the file is closed.
References close_read(), close_write(), and mode.
void clipper::CCP4MAPfile::open_read | ( | const String | filename_in | ) |
Open a file for read access.
The file is opened for reading. This CCP4MAPfile object will remain attached to this file until it is closed. Until that occurs, no other file may be opened with this object, however another CCP4MAPfile object could be used to access another file.
filename_in | The input filename or pathname. |
References cell_, filename, grid_map_, grid_sam_, clipper::message, mode, and spacegroup_.
void clipper::CCP4MAPfile::close_read | ( | ) |
Close a file after reading.
Close the file after reading.
References clipper::message, and mode.
Referenced by ~CCP4MAPfile().
void clipper::CCP4MAPfile::open_write | ( | const String | filename_out | ) |
Open a file for read access.
The file is opened for writing. This will be a new file, created entirely from data from within the program, rather than by extending an existing file. Similar restrictions apply as for open_read().
filename_out | The output filename or pathname. |
References filename, clipper::message, and mode.
void clipper::CCP4MAPfile::close_write | ( | ) |
Close a file after reading.
Close the file after writing.
References clipper::message, and mode.
Referenced by ~CCP4MAPfile().
void clipper::CCP4MAPfile::set_cell | ( | const Cell & | cell | ) |
set cell desription (NXmap write only)
When writing an NXmap, the cell for the output map must be set using set_cell(). Note that the NXmap is rather more general than the CCP4 map, since it can take an arbitrary rotation+skew matrix. The resulting map will only be sensible if the NXmap grid skew matrix reflects the supplied cell. This is not possible in the general case. (Alternatively, opening an equivalent map for read and then closing it again will also set the cell).
cell | The cell description for the output map file. |
References cell_, clipper::message, and mode.
const Spacegroup & clipper::CCP4MAPfile::spacegroup | ( | ) | const |
get file spacegroup
Get the spacegroup from the MTZ file.
References spacegroup_.
const Cell & clipper::CCP4MAPfile::cell | ( | ) | const |
const Grid_sampling & clipper::CCP4MAPfile::grid_sampling | ( | ) | const |
get file grid_sampling
Get the grid sampling from the MTZ file.
References grid_sam_.
void clipper::CCP4MAPfile::import_xmap | ( | Xmap< T > & | xmap | ) | const [inline] |
import data to Xmap
Import a complete Xmap object. The supplied Xmap object is examined, and if any of the parameters (spacegroup, cell, or grid_sampling) are unset, then they will be set using values from the file. The data is the imported from the file.
If the spacegroups mismatch, the resulting map will obey its spacegroup symmetry, but no expansion will be performed if the file has a higher symmetry and only holds an asymmetric unit.
xmap | The Xmap to be imported. |
References clipper::Xmap< T >::cell(), cell_, filename, grid_sam_, clipper::Xmap< T >::grid_sampling(), clipper::Xmap< T >::init(), clipper::Grid_sampling::is_null(), clipper::Cell::is_null(), clipper::Spacegroup::is_null(), clipper::message, mode, clipper::Xmap_base::Map_reference_coord::set_coord(), clipper::Xmap< T >::spacegroup(), and spacegroup_.
void clipper::CCP4MAPfile::export_xmap | ( | const Xmap< T > & | xmap | ) | [inline] |
export data from Xmap
xmap | The Xmap to be exported. |
References clipper::Cell_descr::a(), clipper::Cell_descr::alpha_deg(), clipper::Cell_descr::b(), clipper::Cell_descr::beta_deg(), clipper::Cell_descr::c(), clipper::Xmap< T >::cell(), clipper::Cell::descr(), clipper::Spacegroup::descr(), filename, clipper::Symop::format(), clipper::Cell_descr::gamma_deg(), clipper::Xmap< T >::grid_asu(), clipper::Xmap< T >::grid_sampling(), clipper::Grid_range::max(), clipper::message, clipper::Grid_range::min(), mode, clipper::Spacegroup::num_symops(), clipper::Xmap_base::Map_reference_coord::set_coord(), clipper::Xmap< T >::spacegroup(), clipper::Spgr_descr::spacegroup_number(), and clipper::Spacegroup::symop().
void clipper::CCP4MAPfile::import_nxmap | ( | NXmap< T > & | nxmap | ) | const [inline] |
import data to NXmap
nxmap | The NXmap to be imported. |
References cell_, filename, grid_map_, grid_sam_, clipper::NXmap< T >::init(), clipper::message, mode, and clipper::NXmap< T >::set_data().
void clipper::CCP4MAPfile::export_nxmap | ( | const NXmap< T > & | nxmap | ) | [inline] |
export data from NXmap
The cell for the output map must have been set using set_cell_descr(). Note that the NXmap is rather more general than the CCP4 map, since it can take an arbitrary rotation+skew matrix. The resulting map will only be sensible if the NXmap grid skew matrix reflects the supplied cell. This is not possible in the general case.
nxmap | The NXmap to be exported. |
References clipper::Cell_descr::a(), clipper::Cell_descr::alpha_deg(), clipper::Cell_descr::b(), clipper::Cell_descr::beta_deg(), clipper::Cell_descr::c(), cell_, clipper::Coord_orth::coord_frac(), clipper::Coord_frac::coord_grid(), clipper::NXmap< T >::coord_orth(), clipper::Cell::descr(), filename, clipper::Cell_descr::gamma_deg(), clipper::NXmap< T >::get_data(), clipper::NXmap< T >::grid(), grid_map_, grid_sam_, clipper::Util::intr(), clipper::Grid_range::max(), clipper::message, clipper::Grid_range::min(), mode, clipper::Grid::nu(), clipper::Grid::nv(), clipper::Grid::nw(), clipper::Coord_frac::u(), clipper::Coord_frac::v(), and clipper::Coord_frac::w().
CCP4MAPfile::ASUerror clipper::CCP4MAPfile::import_xmap_check_asu | ( | Xmap< T > & | xmap, | |
T | missing | |||
) | const [inline] |
import data to Xmap and check ASU (float/double only)
Import a complete Xmap object. The supplied Xmap object is examined, and if any of the parameters (spacegroup, cell, or grid_sampling) are unset, then they will be set using values from the file. The data is the imported from the file.
If the spacegroups mismatch, the resulting map will obey its spacegroup symmetry, but no expansion will be performed if the file has a higher symmetry and only holds an asymmetric unit.
This version performs a check on the symmatry of the inport map file. If the import map contains less than a complete ASU, or if it contains more than an ASU and symmetry related positions contain inconsistent values, then an error is returned.
This function is only available for float or double maps.
xmap | The Xmap to be imported. |
References asuerr, clipper::Xmap< T >::cell(), cell_, filename, clipper::Xmap< T >::first(), grid_sam_, clipper::Xmap< T >::grid_sampling(), clipper::Xmap< T >::init(), clipper::Util::is_nan(), clipper::Util::is_null(), clipper::Grid_sampling::is_null(), clipper::Cell::is_null(), clipper::Spacegroup::is_null(), clipper::Util::max(), clipper::message, mode, clipper::Xmap_base::Map_reference_coord::set_coord(), clipper::Util::set_null(), clipper::Xmap< T >::spacegroup(), and spacegroup_.