clipper::CCP4MAPfile Class Reference

MAP import/export parent class for clipper objects. More...

#include <ccp4_map_io.h>

List of all members.

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 Spacegroupspacegroup () const
 get file spacegroup
const Cellcell () const
 get file cell
const Grid_samplinggrid_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

Detailed Description

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Parameters:
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().

Parameters:
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).

Parameters:
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.

Returns:
The spacegroup.

References spacegroup_.

const Cell & clipper::CCP4MAPfile::cell (  )  const

get file cell

Get the base cell from the MTZ file.

Returns:
The cell.

References cell_.

const Grid_sampling & clipper::CCP4MAPfile::grid_sampling (  )  const

get file grid_sampling

Get the grid sampling from the MTZ file.

Returns:
The grid sampling.

References grid_sam_.

template<class T >
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.

Parameters:
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_.

template<class T >
void clipper::CCP4MAPfile::export_xmap ( const Xmap< T > &  xmap  )  [inline]
template<class T >
void clipper::CCP4MAPfile::import_nxmap ( NXmap< T > &  nxmap  )  const [inline]

import data to NXmap

Parameters:
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().

template<class T >
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.

Parameters:
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().

template<class T >
CCP4MAPfile::ASUerror clipper::CCP4MAPfile::import_xmap_check_asu ( Xmap< T > &  xmap,
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.

Parameters:
xmap The Xmap to be imported.
Returns:
The ASU check flag

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_.


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

Generated on 4 Jan 2010 for Clipper_ccp4 by  doxygen 1.6.1