ITK  4.4.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
itk::MRCImageIO Class Reference

#include <itkMRCImageIO.h>

+ Inheritance diagram for itk::MRCImageIO:
+ Collaboration diagram for itk::MRCImageIO:

Detailed Description

An ImageIO class to read the MRC file format. The MRC file format frequently has the extension ".mrc" or ".rec". It is used frequently for electron microscopy and is an emerging standard for cryo-electron tomography and molecular imaging. The format is used to represent 2D, 3D images along with 2D tilt series for tomography.

The header of the file can contain important information which can not be represented in an Image. Therefor the header is placed into the MetaDataDictionary of "this". The key to access this is MetaDataHeaderName ( fix me when renamed ).

See Also
MRCHeaderObject MetaDataDictionary

This implementation is designed to support IO Streaming of arbitrary regions.

As with all ImageIOs this class is designed to work with ImageFileReader and ImageFileWriter, so its direct use is discouraged.

This code was contributed in the Insight Journal paper: "A Streaming IO Base Class and Support for Streaming the MRC and VTK File Format" by Lowekamp B., Chen D.

See Also
ImageFileWriter ImageFileReader ImageIOBase

Definition at line 59 of file itkMRCImageIO.h.

Public Types

typedef SmartPointer< SelfPointer
typedef MRCImageIO Self
typedef StreamingImageIOBase Superclass
- Public Types inherited from itk::StreamingImageIOBase
typedef SmartPointer< SelfPointer
typedef StreamingImageIOBase Self
typedef ImageIOBase Superclass
- Public Types inherited from itk::ImageIOBase
typedef std::vector< std::string > ArrayOfExtensionsType
typedef ::itk::OffsetValueType BufferSizeType
enum  ByteOrder {
enum  FileType {
typedef ::itk::IndexValueType IndexValueType
enum  IOComponentType {
enum  IOPixelType {
typedef SmartPointer< SelfPointer
typedef ImageIOBase Self
typedef ::itk::intmax_t SizeType
typedef ::itk::SizeValueType SizeValueType
typedef LightProcessObject Superclass
- Public Types inherited from itk::LightProcessObject
typedef SmartPointer< const SelfConstPointer
typedef SmartPointer< SelfPointer
typedef LightProcessObject Self
typedef Object Superclass
- Public Types inherited from itk::Object
typedef SmartPointer< const SelfConstPointer
typedef SmartPointer< SelfPointer
typedef Object Self
typedef LightObject Superclass
- Public Types inherited from itk::LightObject
typedef SmartPointer< const SelfConstPointer
typedef SmartPointer< SelfPointer
typedef LightObject Self

Public Member Functions

virtual bool CanReadFile (const char *)
virtual bool CanWriteFile (const char *)
virtual ::itk::LightObject::Pointer CreateAnother (void) const
virtual const char * GetNameOfClass () const
virtual void Read (void *buffer)
virtual void ReadImageInformation ()
virtual void Write (const void *buffer)
virtual void WriteImageInformation (void)
- Public Member Functions inherited from itk::StreamingImageIOBase
virtual bool CanStreamRead (void)
virtual bool CanStreamWrite (void)
virtual ImageIORegion GenerateStreamableReadRegionFromRequestedRegion (const ImageIORegion &requested) const
virtual unsigned int GetActualNumberOfSplitsForWriting (unsigned int numberOfRequestedSplits, const ImageIORegion &pasteRegion, const ImageIORegion &largestPossibleRegion)
- Public Member Functions inherited from itk::ImageIOBase
std::string GetByteOrderAsString (ByteOrder) const
virtual unsigned int GetComponentSize () const
virtual IOComponentType GetComponentType () const
virtual const std::type_info & GetComponentTypeInfo () const
virtual std::vector< double > GetDefaultDirection (unsigned int i) const
virtual itk::SizeValueType GetDimensions (unsigned int i) const
virtual std::vector< double > GetDirection (unsigned int i) const
std::string GetFileTypeAsString (FileType) const
SizeType GetImageSizeInBytes () const
SizeType GetImageSizeInComponents () const
SizeType GetImageSizeInPixels () const
virtual unsigned int GetNumberOfDimensions () const
virtual double GetOrigin (unsigned int i) const
virtual SizeType GetPixelStride () const
virtual double GetSpacing (unsigned int i) const
virtual ImageIORegion GetSplitRegionForWriting (unsigned int ithPiece, unsigned int numberOfActualSplits, const ImageIORegion &pasteRegion, const ImageIORegion &largestPossibleRegion)
const ArrayOfExtensionsTypeGetSupportedReadExtensions () const
const ArrayOfExtensionsTypeGetSupportedWriteExtensions () const
void SetByteOrderToLittleEndian ()
virtual void SetComponentType (const IOComponentType _arg)
virtual void SetDirection (unsigned int i, std::vector< double > &direction)
virtual void SetDirection (unsigned int i, vnl_vector< double > &direction)
void SetFileTypeToBinary ()
void SetNumberOfDimensions (unsigned int)
virtual void SetOrigin (unsigned int i, double origin)
template<class TPixel , unsigned VLength>
void SetPixelTypeInfo (const SymmetricSecondRankTensor< TPixel, VLength > *)
template<typename TPixel >
void SetPixelTypeInfo (const DiffusionTensor3D< TPixel > *)
template<typename TPixel , unsigned VLength>
void SetPixelTypeInfo (const Matrix< TPixel, VLength, VLength > *)
template<typename TPixel >
void SetPixelTypeInfo (const std::complex< TPixel > *)
template<unsigned VLength>
void SetPixelTypeInfo (const Offset< VLength > *)
virtual void SetSpacing (unsigned int i, double spacing)
template<typename TPixel >
void SetTypeInfo (const TPixel *)
virtual bool SupportsDimension (unsigned long dim)
virtual void SetFileName (const char *_arg)
virtual const char * GetFileName () const
virtual void SetDimensions (unsigned int i, unsigned int dim)
virtual void SetIORegion (ImageIORegion _arg)
virtual const ImageIORegionGetIORegion ()
virtual void SetPixelType (const IOPixelType _arg)
virtual IOPixelType GetPixelType () const
virtual void SetNumberOfComponents (unsigned int _arg)
virtual const unsigned int & GetNumberOfComponents ()
virtual void SetUseCompression (bool _arg)
virtual bool GetUseCompression () const
virtual void UseCompressionOn ()
virtual void UseCompressionOff ()
virtual void SetUseStreamedReading (bool _arg)
virtual bool GetUseStreamedReading () const
virtual void UseStreamedReadingOn ()
virtual void UseStreamedReadingOff ()
virtual void SetUseStreamedWriting (bool _arg)
virtual bool GetUseStreamedWriting () const
virtual void UseStreamedWritingOn ()
virtual void UseStreamedWritingOff ()
virtual void SetFileType (const FileType _arg)
virtual FileType GetFileType () const
void SetFileTypeToASCII ()
virtual void SetByteOrder (const ByteOrder _arg)
virtual ByteOrder GetByteOrder () const
void SetByteOrderToBigEndian ()
template<typename TPixel >
void SetPixelTypeInfo (const TPixel *)
template<typename TPixel >
void SetPixelTypeInfo (const RGBPixel< TPixel > *)
template<typename TPixel >
void SetPixelTypeInfo (const RGBAPixel< TPixel > *)
template<typename TPixel , unsigned VLength>
void SetPixelTypeInfo (const Vector< TPixel, VLength > *)
template<typename TPixel >
void SetPixelTypeInfo (const VariableLengthVector< TPixel > *)
template<typename TPixel , unsigned VLength>
void SetPixelTypeInfo (const CovariantVector< TPixel, VLength > *)
template<typename TPixel , unsigned VLength>
void SetPixelTypeInfo (const FixedArray< TPixel, VLength > *)
- Public Member Functions inherited from itk::LightProcessObject
virtual void AbortGenerateDataOff ()
virtual void AbortGenerateDataOn ()
virtual const bool & GetAbortGenerateData ()
virtual void SetAbortGenerateData (bool _arg)
virtual void UpdateOutputData ()
void UpdateProgress (float amount)
virtual void SetProgress (float _arg)
virtual const float & GetProgress ()
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
unsigned long AddObserver (const EventObject &event, Command *) const
virtual void DebugOff () const
virtual void DebugOn () const
CommandGetCommand (unsigned long tag)
bool GetDebug () const
MetaDataDictionaryGetMetaDataDictionary (void)
const MetaDataDictionaryGetMetaDataDictionary (void) const
virtual ModifiedTimeType GetMTime () const
virtual const TimeStampGetTimeStamp () const
bool HasObserver (const EventObject &event) const
void InvokeEvent (const EventObject &)
void InvokeEvent (const EventObject &) const
virtual void Modified () const
virtual void Register () const
void RemoveAllObservers ()
void RemoveObserver (unsigned long tag)
void SetDebug (bool debugFlag) const
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
virtual void SetReferenceCount (int)
virtual void UnRegister () const
- Public Member Functions inherited from itk::LightObject
virtual void Delete ()
virtual int GetReferenceCount () const
 itkCloneMacro (Self)
void Print (std::ostream &os, Indent indent=0) const

Static Public Member Functions

static Pointer New ()

Static Public Attributes

static const char * m_MetaDataHeaderName

Protected Member Functions

virtual SizeType GetHeaderSize (void) const
 MRCImageIO ()
void PrintSelf (std::ostream &os, Indent indent) const
- Protected Member Functions inherited from itk::StreamingImageIOBase
virtual SizeType GetDataPosition (void) const
virtual void OpenFileForReading (std::ifstream &os, const char *filename)
virtual void OpenFileForWriting (std::ofstream &os, const char *filename, bool truncate)
virtual bool ReadBufferAsBinary (std::istream &is, void *buffer, SizeType num)
virtual bool RequestedToStream (void) const
 StreamingImageIOBase ()
virtual bool StreamReadBufferAsBinary (std::istream &os, void *buffer)
virtual bool StreamWriteBufferAsBinary (std::ostream &os, const void *buffer)
virtual bool WriteBufferAsBinary (std::ostream &is, const void *buffer, SizeType num)
- Protected Member Functions inherited from itk::ImageIOBase
void AddSupportedReadExtension (const char *extension)
void AddSupportedWriteExtension (const char *extension)
void ComputeStrides ()
virtual unsigned int GetActualNumberOfSplitsForWritingCanStreamWrite (unsigned int numberOfRequestedSplits, const ImageIORegion &pasteRegion) const
SizeType GetComponentStride () const
virtual const
GetImageRegionSplitter (void) const
virtual unsigned int GetPixelSize () const
SizeType GetRowStride () const
SizeType GetSliceStride () const
virtual ImageIORegion GetSplitRegionForWritingCanStreamWrite (unsigned int ithPiece, unsigned int numberOfActualSplits, const ImageIORegion &pasteRegion) const
 ImageIOBase ()
virtual void ReadBufferAsASCII (std::istream &os, void *buffer, IOComponentType ctype, SizeType numberOfBytesToBeRead)
bool ReadBufferAsBinary (std::istream &os, void *buffer, SizeType numberOfBytesToBeRead)
virtual void Reset (const bool freeDynamic=true)
void Resize (const unsigned int numDimensions, const unsigned int *dimensions)
virtual void WriteBufferAsASCII (std::ostream &os, const void *buffer, IOComponentType ctype, SizeType numberOfBytesToWrite)
 ~ImageIOBase ()
- Protected Member Functions inherited from itk::LightProcessObject
virtual void GenerateData ()
 LightProcessObject ()
 ~LightProcessObject ()
- Protected Member Functions inherited from itk::Object
 Object ()
bool PrintObservers (std::ostream &os, Indent indent) const
virtual void SetTimeStamp (const TimeStamp &time)
virtual ~Object ()
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 LightObject ()
virtual void PrintHeader (std::ostream &os, Indent indent) const
virtual void PrintTrailer (std::ostream &os, Indent indent) const
virtual ~LightObject ()

Private Member Functions

void InternalReadImageInformation (std::ifstream &is)
 MRCImageIO (const Self &)
void operator= (const Self &)
void UpdateHeaderFromImageIO (void)
template<typename TPixelType >
void UpdateHeaderWithMinMaxMean (const TPixelType *bufferBegin)
void UpdateHeaderWithMinMaxMean (const void *bufferBegin)
virtual void WriteImageInformation (const void *bufferBegin)

Private Attributes

MRCHeaderObject::Pointer m_MRCHeader

Additional Inherited Members

- Protected Types inherited from itk::LightObject
typedef int InternalReferenceCountType
- Protected Attributes inherited from itk::ImageIOBase
ByteOrder m_ByteOrder
IOComponentType m_ComponentType
std::vector< SizeValueTypem_Dimensions
std::vector< std::vector
< double > > 
std::string m_FileName
FileType m_FileType
bool m_Initialized
ImageIORegion m_IORegion
unsigned int m_NumberOfComponents
unsigned int m_NumberOfDimensions
std::vector< double > m_Origin
IOPixelType m_PixelType
std::vector< double > m_Spacing
std::vector< SizeTypem_Strides
bool m_UseCompression
bool m_UseStreamedReading
bool m_UseStreamedWriting

Member Typedef Documentation

Definition at line 66 of file itkMRCImageIO.h.

Standard class typedefs.

Definition at line 64 of file itkMRCImageIO.h.

Definition at line 65 of file itkMRCImageIO.h.

Constructor & Destructor Documentation

itk::MRCImageIO::MRCImageIO ( )
itk::MRCImageIO::MRCImageIO ( const Self )

Member Function Documentation

virtual bool itk::MRCImageIO::CanReadFile ( const char *  )

Determine the file type. Returns true if this ImageIO can read the file specified.

Implements itk::ImageIOBase.

virtual bool itk::MRCImageIO::CanWriteFile ( const char *  )

Returns true if this ImageIO can write the specified file.

The methods verifies that the file extension is known to be supported by this class.

Implements itk::ImageIOBase.

virtual::itk::LightObject::Pointer itk::MRCImageIO::CreateAnother ( void  ) const

Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.

Reimplemented from itk::LightProcessObject.

virtual SizeType itk::MRCImageIO::GetHeaderSize ( void  ) const

Overloaded to return the actually header size of the file specified. The header must be read before this methods is called.

Implements itk::StreamingImageIOBase.

virtual const char* itk::MRCImageIO::GetNameOfClass ( ) const

Run-time type information (and related methods).

Reimplemented from itk::StreamingImageIOBase.

void itk::MRCImageIO::InternalReadImageInformation ( std::ifstream &  is)
static Pointer itk::MRCImageIO::New ( )

Method for creation through the object factory.

void itk::MRCImageIO::operator= ( const Self )
void itk::MRCImageIO::PrintSelf ( std::ostream &  os,
Indent  indent 
) const

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from itk::StreamingImageIOBase.

virtual void itk::MRCImageIO::Read ( void *  buffer)

Reads the data from disk into the memory buffer provided.

Implements itk::ImageIOBase.

virtual void itk::MRCImageIO::ReadImageInformation ( )

Read the spacing and dimensions of the image. Assumes SetFileName has been called with a valid file name.

Implements itk::ImageIOBase.

void itk::MRCImageIO::UpdateHeaderFromImageIO ( void  )
template<typename TPixelType >
void itk::MRCImageIO::UpdateHeaderWithMinMaxMean ( const TPixelType *  bufferBegin)

Definition at line 126 of file itkMRCImageIO.h.

References itk::min_max_element().

void itk::MRCImageIO::UpdateHeaderWithMinMaxMean ( const void *  bufferBegin)
virtual void itk::MRCImageIO::Write ( const void *  buffer)

Writes the data to disk from the memory buffer provided. Make sure that the IORegions has been set properly. The buffer is cast to a pointer to the beginning of the image data.

Implements itk::ImageIOBase.

virtual void itk::MRCImageIO::WriteImageInformation ( void  )

Writes the spacing and dimensions of the image. Assumes SetFileName has been called with a valid file name.

Implements itk::ImageIOBase.

Definition at line 75 of file itkMRCImageIO.h.

virtual void itk::MRCImageIO::WriteImageInformation ( const void *  bufferBegin)

Member Data Documentation

const char* itk::MRCImageIO::m_MetaDataHeaderName
Move to itkIOCommon with the other MetaDataDictionary keys, likely rename the symbol to something like ITK_MRCHHeader. (remember to fix class doc too)

Definition at line 105 of file itkMRCImageIO.h.

MRCHeaderObject::Pointer itk::MRCImageIO::m_MRCHeader

Definition at line 156 of file itkMRCImageIO.h.

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