ImFusion SDK 4.3
NiftiIO Class Reference

#include <ImFusion/IO/NiftiIO.h>

Class for reading and writing Nifti images. More...

Detailed Description

Class for reading and writing Nifti images.

Nifti image files have one of two extensions, .nii or .nii.gz. The file is designed to hold a time series of 3D images. For this reason this class loads the image data into a SharedImageSet, even though in many cases there is only one 3D image stored in the file.

Note
The Nifti file format specifies image pixel coordinates in the Left-Posterior-Superior (LPS) coordinate frame while the ImFusion Suite displays images in the Right-Anterior-Superior (RAS) coordinate frame. The NiftiIO class reads and writes the image data as it is stored on disc, i.e. in LPS coordinates, so no tranformation is applied to to the matrix of the SharedImageSet. The NiftiIoAlgorithm on the other hand does transform the matrix so that the Nifti files loaded in the ImFusion Suite appear properly. For more details on coordinate systems and the Nifti file format see the following links: https://www.slicer.org/wiki/Coordinate_systems https://brainder.org/2012/09/23/the-nifti-file-format/

Static Public Member Functions

static std::unique_ptr< SharedImageSetreadImage (const std::string &filename, Progress *progress=nullptr, bool keepRasCoordinates=false)
 Reads a Nifti file into a SharedImageSet.
 
static bool writeImage (const std::string &filename, const SharedImageSet &sis, bool convertToRasCoordinates=true)
 Writes a SharedImageSet as a Nifti file.
 

Member Function Documentation

◆ readImage()

static std::unique_ptr< SharedImageSet > readImage ( const std::string & filename,
Progress * progress = nullptr,
bool keepRasCoordinates = false )
static

Reads a Nifti file into a SharedImageSet.

If the sform affine transformation, that is used, otherwise the qform rigid transform is used. cf. https://brainder.org/2012/09/23/the-nifti-file-format/ (section on 'Orientation information') for more details

Parameters
keepRasCoordinatesFlag whether to keep the image in the Nifti RAS coordinate system or transform to LPS used by ImFusion

◆ writeImage()

static bool writeImage ( const std::string & filename,
const SharedImageSet & sis,
bool convertToRasCoordinates = true )
static

Writes a SharedImageSet as a Nifti file.

The given filename must have extension .nii or .nii.gz. The SharedImageSet's matrix is set as the sform affine transformation, and the rotation and translation are extracted and set asthe qform rigid transform. cf. https://brainder.org/2012/09/23/the-nifti-file-format/ (section on 'Orientation information') for more details

Parameters
convertToRasCoordinatesFlag whether to keep the image in the ImFusion LPS coordinate system or transform to RAS

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close