MRC file reader. More...
#include <VolumeViz/readers/SoVRMrcFileReader.h>
Public Member Functions | |
virtual SoType | getTypeId () const |
SoVRMrcFileReader () | |
virtual int | setFilename (const SbString &filename) override |
virtual ReadError | getDataChar (SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim) override |
virtual void | getSubSlice (const SbBox2i32 &subSlice, int sliceNumber, void *data) override |
virtual void | getSubSlice (const SbBox2i32 &subSlice, int sliceNumber, SoBufferObject *dataBuffer) override |
virtual SoVolumeReader::ReaderType | getReaderType () override |
virtual SbBool | isThreadSafe () const override |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Volume reader for the MRC file format.
MRC is a file format that has become industry standard in cryo-electron microscopy (cryoEM) and electron tomography (ET), where the result of the technique is a three-dimensional grid of voxels each with a value corresponding to electron density or electric potential. It was developed by the MRC (Medical Research Council, UK) Laboratory of Molecular Biology. In 2014, the format was standardised. The format specification is available on the CCP-EM website. For details see: http://www.ccpem.ac.uk/mrc_format/mrc2014.php
SoVolumeData automatically selects this reader if a filename is given and the file extension is ".mrc". The application can also explicitly create an instance of this reader and call the SoVolumeData method setReader().
SoVRMrcFileReader loads slices from a single multi-image MRC file. To load a volume from multiple MRC files, see the SoVRRasterStackReader class.
All the images contained in the file should have the same size. If it is not the case, the reader will find the largest image and take all images with the same size.
Supported:
For more information about volume readers see SoVolumeReader.
NOTE: Class available since Open Inventor 10.4.
SoVRMrcFileReader::SoVRMrcFileReader | ( | ) |
Constructor.
static SoType SoVRMrcFileReader::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoVolumeReader.
virtual ReadError SoVRMrcFileReader::getDataChar | ( | SbBox3f & | size, | |
SoDataSet::DataType & | type, | |||
SbVec3i32 & | dim | |||
) | [override, virtual] |
Gets the characteristics (file header) of the data volume. See SoDataSet::setVolumeData().
You can use the convenience method setFilename() to specify the file location, in which case you will not have to open the file yourself. Then you can use the convenience method getBuffer() to read the header in order to get the requested information.NOTE: We strongly recommend that readers implement this version of getDataChar, introduced in VolumeViz 5.1, because it uses SbVec3i32 for the volume dimension.
Implements SoVolumeReader.
virtual SoVolumeReader::ReaderType SoVRMrcFileReader::getReaderType | ( | ) | [inline, override, virtual] |
Returns the reader type.
Reimplemented from SoVolumeReader.
virtual void SoVRMrcFileReader::getSubSlice | ( | const SbBox2i32 & | subSlice, | |
int | sliceNumber, | |||
SoBufferObject * | dataBuffer | |||
) | [override, virtual] |
Same as getSubSlice( const SbBox2i32& subSlice, int sliceNumber, void * data ) but using an SoBufferObject as the target of the data. If not reimplemented then the version with "unsigned char*" parameter is called
subSlice | 2D region of the slice to return. | |
sliceNumber | Slice number on the volume Z axis (first slice is 0). | |
dataBuffer | The target buffer to be filled. |
Reimplemented from SoVolumeReader.
virtual void SoVRMrcFileReader::getSubSlice | ( | const SbBox2i32 & | subSlice, | |
int | sliceNumber, | |||
void * | data | |||
) | [override, virtual] |
Must copy the rectangular part defined by subSlice of the XY slice sliceNumber to the memory referenced by data. Slices will not always be read sequentially.
subSlice | 2D region of the slice to return. | |
sliceNumber | Slice number on the volume Z axis (first slice is 0). | |
data | Copy the data into this buffer. |
You can use the convenience method getBuffer() to read data from file. Note: setFilename() must have been called previously.
Implements SoVolumeReader.
virtual SoType SoVRMrcFileReader::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Reimplemented from SoVolumeReader.
virtual SbBool SoVRMrcFileReader::isThreadSafe | ( | ) | const [override, virtual] |
Return true as this reader is thread safe.
Reimplemented from SoVolumeReader.
virtual int SoVRMrcFileReader::setFilename | ( | const SbString & | filename | ) | [override, virtual] |
Specifies the path of the file. Returns 0 for success. Any other return value indicates failure.
Reimplemented from SoVolumeReader.