Developer documentation
Version 3.0.3-105-gd3941f44
MR::Formats::Base Class Referenceabstract

the interface for classes that support the various image formats. More...

#include "formats/list.h"

Inheritance diagram for MR::Formats::Base:
MR::Formats::DICOM MR::Formats::MGH MR::Formats::MGZ MR::Formats::MRI MR::Formats::MRtrix MR::Formats::MRtrix_GZ MR::Formats::MRtrix_sparse MR::Formats::NIfTI1 MR::Formats::NIfTI1_GZ MR::Formats::NIfTI2 MR::Formats::NIfTI2_GZ MR::Formats::PAR MR::Formats::Pipe MR::Formats::XDS

Public Member Functions

 Base (const char *desc)
 
virtual ~Base ()
 
virtual std::unique_ptr< ImageIO::Baseread (Header &H) const =0
 read image file(s) and fill the Image::Header H with the appropriate information. More...
 
virtual bool check (Header &H, size_t num_axes) const =0
 check whether the Image::Header H can be created using this handler. More...
 
virtual std::unique_ptr< ImageIO::Basecreate (Header &H) const =0
 create the image corresponding to the Image::Header H. More...
 

Public Attributes

const char * description
 a short human-readable description of the image format More...
 

Detailed Description

the interface for classes that support the various image formats.

All image formats supported by MRtrix are handled by a class derived from the Formats::Base. An instance of each of these classes is added to the list in the file list.cpp.

Definition at line 42 of file list.h.

Constructor & Destructor Documentation

◆ Base()

MR::Formats::Base::Base ( const char *  desc)
inline

Definition at line 44 of file list.h.

◆ ~Base()

virtual MR::Formats::Base::~Base ( )
inlinevirtual

Definition at line 45 of file list.h.

Member Function Documentation

◆ check()

virtual bool MR::Formats::Base::check ( Header H,
size_t  num_axes 
) const
pure virtual

check whether the Image::Header H can be created using this handler.

This function will check whether this handler can write images in the format suggested by the filename. It will then check whether the format can handle the number of dimensions requested, and modify the header appropriately if needed.

Returns
true if this format handler can write this type of file, false otherwise.
Note
this function should throw an Exception in case of error, or if this image format cannot support the header information.

Implemented in MR::Formats::Pipe, MR::Formats::DICOM, MR::Formats::MRtrix, MR::Formats::MRtrix_GZ, MR::Formats::NIfTI1, MR::Formats::NIfTI2, MR::Formats::NIfTI1_GZ, MR::Formats::NIfTI2_GZ, MR::Formats::MRI, MR::Formats::XDS, MR::Formats::MGH, MR::Formats::MGZ, MR::Formats::PAR, and MR::Formats::MRtrix_sparse.

◆ create()

virtual std::unique_ptr< ImageIO::Base > MR::Formats::Base::create ( Header H) const
pure virtual

create the image corresponding to the Image::Header H.

This function will create images in the corresponding format, assuming the header has been validated using the check() function beforehand.

Note
this function should throw an Exception in case of error.

Implemented in MR::Formats::Pipe, MR::Formats::DICOM, MR::Formats::MRtrix, MR::Formats::MRtrix_GZ, MR::Formats::NIfTI1, MR::Formats::NIfTI2, MR::Formats::NIfTI1_GZ, MR::Formats::NIfTI2_GZ, MR::Formats::MRI, MR::Formats::XDS, MR::Formats::MGH, MR::Formats::MGZ, MR::Formats::PAR, and MR::Formats::MRtrix_sparse.

◆ read()

virtual std::unique_ptr< ImageIO::Base > MR::Formats::Base::read ( Header H) const
pure virtual

read image file(s) and fill the Image::Header H with the appropriate information.

This function will check whether this handler can read images in the format suggested by the filename. It will then attempt to read the corresponding image, and update the Image::Header H with the relevant information.

Returns
true if this Format handler can read this type of file, false otherwise. If true, this function should fill the Header H with all the relevant information as read from the images before returning.
Note
this function should throw an Exception in case of error.

Implemented in MR::Formats::Pipe, MR::Formats::DICOM, MR::Formats::MRtrix, MR::Formats::MRtrix_GZ, MR::Formats::NIfTI1, MR::Formats::NIfTI2, MR::Formats::NIfTI1_GZ, MR::Formats::NIfTI2_GZ, MR::Formats::MRI, MR::Formats::XDS, MR::Formats::MGH, MR::Formats::MGZ, MR::Formats::PAR, and MR::Formats::MRtrix_sparse.

Member Data Documentation

◆ description

const char* MR::Formats::Base::description

a short human-readable description of the image format

Definition at line 47 of file list.h.


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