RNifti
Fast R and C++ Access to NIfTI Images
Public Member Functions | Public Attributes | List of all members
RNifti::NiftiImage::Block Struct Reference

Inner class referring to a subset of an image. More...

#include <NiftiImage.h>

Public Member Functions

 Block (const NiftiImage &image, const int dimension, const int index)
 Standard constructor for this class. More...
 
Blockoperator= (const NiftiImage &source)
 Copy assignment operator, which allows a block in one image to be replaced with the contents of another image. More...
 
template<typename TargetType >
std::vector< TargetType > getData (const bool useSlope=true) const
 Extract a vector of data from a block, casting it to any required element type. More...
 

Public Attributes

const NiftiImageimage
 The parent image.
 
const int dimension
 The dimension along which the block applies (which should be the last)
 
const int index
 The location along dimension.
 

Detailed Description

Inner class referring to a subset of an image.

Currently must refer to the last dimension in the image, i.e., a volume in a 4D parent image, or a slice in a 3D image

Constructor & Destructor Documentation

◆ Block()

RNifti::NiftiImage::Block::Block ( const NiftiImage image,
const int  dimension,
const int  index 
)
inline

Standard constructor for this class.

Parameters
imageThe parent image
dimensionThe dimension along which the block applies (which should be the last)
indexThe location along dimension
Exceptions
runtime_errorIf dimension is not the last dimension in the image

Member Function Documentation

◆ getData()

template<typename TargetType >
std::vector< TargetType > RNifti::NiftiImage::Block::getData ( const bool  useSlope = true) const
inline

Extract a vector of data from a block, casting it to any required element type.

Parameters
useSlopeIf true, the default, then the data will be adjusted for the slope and intercept stored with the image, if any
Note
If the slope and intercept are applied, there is no guarantee that the adjusted values will fit within the requested type. No check is made for this

◆ operator=()

Block& RNifti::NiftiImage::Block::operator= ( const NiftiImage source)
inline

Copy assignment operator, which allows a block in one image to be replaced with the contents of another image.

Parameters
sourceA NiftiImage, containing the data to replace the block with
Returns
A reference to the block
Exceptions
runtime_errorIf the source is incompatible with the block in size or datatype

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