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...
Block & | operator= (const NiftiImage &source)
| Copy assignment operator, which allows a block in one image to be replaced with the contents of another image. More...
NiftiImageData | data () const
| Obtain the data within the block. 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 NiftiImage & | image
| 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

  image | The parent image
  dimension | The dimension along which the block applies (which should be the last)
  index | The location along `dimension`

Exceptions

  runtime_error | If `dimension` is not the last dimension in the image

## Member Function Documentation

## ◆ data()

NiftiImageData RNifti::NiftiImage::Block::data | ( |  | ) | const
| inline

Obtain the data within the block.

Returns
  A `NiftiImageData` object encapsulating the data

## ◆ getData()

template<typename TargetType >

std::vector<TargetType> RNifti::NiftiImage::Block::getData | ( | const bool | useSlope = `true` | ) | const

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

Parameters

  useSlope | If `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

  source | A NiftiImage, containing the data to replace the block with

Returns
  A reference to the block

Exceptions

  runtime_error | If the `source` is incompatible with the block in size or datatype

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

- inst/include/RNifti/NiftiImage.h