ImFusion SDK 4.3
ImFusion::MetaImage Namespace Reference

Support for loading and saving MetaImage files. More...

Detailed Description

Support for loading and saving MetaImage files.

MetaImage files are either split into header (.mhd) and data (.raw) files, or stored in a single (.mha) file containing the combined header information and image data.

Classes

class  MetaImageHeader
 
struct  SaveOptions
 Most properties of a MetaImage header can be deduced from a SharedImageSet, the ones in SaveOptions can not. More...
 

Functions

bool save (const std::string &headerFileName, const SharedImageSet &img, SaveOptions opts={})
 Save a SharedImageSet in MetaImage format.
 
std::unique_ptr< SharedImageSetload (const std::string &headerFileName, MetaImageHeader *outHeader=nullptr, bool prepare=false, bool strictSyntax=false, bool ignoreHalfPixelOffset=false, SharedImageSet *outContainer=nullptr, bool *outSuccess=nullptr, Progress *prog=nullptr)
 Load a MetaImage file into a SharedImageSet.
 
bool save (const std::string &headerFileName, const SharedImage &img, SaveOptions opts={})
 Convenience functions:
 
bool save (const std::string &headerFileName, const MemImage &img, SaveOptions opts={})
 
std::shared_ptr< SharedImageloadSharedImage (const std::string &headerFileName, MetaImageHeader *outHeader=nullptr, bool prepare=false, bool strictSyntax=false, bool ignoreHalfPixelOffset=false, bool *outSuccess=nullptr)
 

Variables

const int currentImFusionMetaImageVersion = 1
 Version of this loader.
 

Function Documentation

◆ save()

bool save ( const std::string & headerFileName,
const SharedImageSet & img,
SaveOptions opts = {} )

Save a SharedImageSet in MetaImage format.

Parameters
headerFileNameFilename extension determines whether to use .mha or .mhd format, if no extension is given .mhd extension appended.
imgimage(s) to save.

◆ load()

std::unique_ptr< SharedImageSet > load ( const std::string & headerFileName,
MetaImageHeader * outHeader = nullptr,
bool prepare = false,
bool strictSyntax = false,
bool ignoreHalfPixelOffset = false,
SharedImageSet * outContainer = nullptr,
bool * outSuccess = nullptr,
Progress * prog = nullptr )

Load a MetaImage file into a SharedImageSet.

Parameters
headerFileNameThe absolute path of the MetaImage header file.
headerStore the read MetaImageHeader in *outHeader if not nullptr.
prepareIf (prepare || m_msb), call MemImage::prepare on the result,
outContainerAn optional SharedImageSet into which to load the data. In this case (if outSuccess != nullptr), *outSuccess = true on success and nullptr is returned.
strictSyntaxdetermines whether or not to fail when unexpected data is encountered (such as trailing non-whitespace characters after numbers).
ignoreHalfPixelOffsetshould be set if no half-pixel offset to the Position/Orientation provided should be applied. Returns nullptr on failure.

◆ loadSharedImage()

std::shared_ptr< SharedImage > loadSharedImage ( const std::string & headerFileName,
MetaImageHeader * outHeader = nullptr,
bool prepare = false,
bool strictSyntax = false,
bool ignoreHalfPixelOffset = false,
bool * outSuccess = nullptr )
Parameters
outSuccessIf more than one image is present in the dataset, outSuccess is set to false and first image returned.
Search Tab / S to search, Esc to close