Image Data
-
namespace yagit
-
class ImageData
Container storing image and its metadata (size, offset, spacing)
Images are in format (frame, row, column) corresponding to (z, y, x) axes. Coordinates are based on LPS coordinate system.
Note
It doesn’t contain information about the plane in which the image is saved. Instead, it assumes that all images are in the axial plane.
Subclassed by yagit::GammaResult
Public Types
-
using value_type = float
-
using size_type = std::vector<value_type>::size_type
-
using reference = value_type&
-
using const_reference = const value_type&
-
using pointer = std::vector<value_type>::pointer
-
using const_pointer = std::vector<value_type>::const_pointer
Public Functions
-
ImageData()
-
template<typename U>
ImageData(const std::vector<U> &data, const DataSize &size, const DataOffset &offset, const DataSpacing &spacing)
-
ImageData(const Image2D &image2d, const DataOffset &offset, const DataSpacing &spacing)
-
ImageData(const Image3D &image3d, const DataOffset &offset, const DataSpacing &spacing)
-
ImageData(std::vector<value_type> &&data, const DataSize &size, const DataOffset &offset, const DataSpacing &spacing) noexcept
-
inline DataOffset getOffset() const
-
inline DataSpacing getSpacing() const
-
void setSize(const DataSize &size)
Set the size of image (frames, rows, columns)
- Parameters:
size – New size - new number of elements (frames*rows*columns) must be the same as old
-
void setOffset(const DataOffset &offset)
-
void setSpacing(const DataSpacing &spacing)
-
reference at(uint32_t frame, uint32_t row, uint32_t column)
Get image element at position (frame, row, column) with checking that the position is within the valid range.
-
const_reference at(uint32_t frame, uint32_t row, uint32_t column) const
Get image element at position (frame, row, column) with checking that the position is within the valid range.
-
inline reference get(uint32_t frame, uint32_t row, uint32_t column)
Get image element at position (frame, row, column)
-
inline const_reference get(uint32_t frame, uint32_t row, uint32_t column) const
Get image element at position (frame, row, column)
-
inline const_reference get(uint32_t index) const
Get element at index of flattened image.
-
inline const_pointer data() const
-
std::vector<value_type> getData() const
Returns copy of flattened image.
-
Image2D getImage2D(uint32_t frame, ImagePlane plane = ImagePlane::Axial) const
Returns copy of 2D fragment of image.
-
Image3D getImage3D(ImagePlane plane = ImagePlane::Axial) const
Returns copy of 3D image.
-
ImageData getImageData2D(uint32_t frame, ImagePlane plane = ImagePlane::Axial) const
Get the ImageData containing a 2D fragment of current image.
Note
Returned image doesn’t contain information about plane - it is assumed it is axial.
- Parameters:
frame – Frame of plane which will be returned
plane – Image plane according to which 2D image is obtained
- Returns:
ImageData with 2D fragment of current image
-
ImageData getImageData3D(ImagePlane plane) const
Get the ImageData containing a 3D image that is rotated according to chosen plane.
Note
Returned image doesn’t contain information about plane - it is assumed it is axial.
- Parameters:
plane – Image plane according to which image is rotated
- Returns:
ImageData with rotated 3D image
-
value_type min() const
Minimum value of the image.
Warning
If image starts with NaN, then minimum value will be NaN
-
value_type max() const
Maximum value of the image.
Warning
If image starts with NaN, then maximum value will be NaN
-
double sum() const
Sum of image values.
Warning
If image contains NaN, then sum will be Nan
-
double mean() const
Mean of image values.
Warning
If image contains NaN, then mean will be Nan
-
double var() const
Variance of image values.
Warning
If image contains NaN, then variance will be Nan
-
value_type nanmin() const
Minimum value of the image, ignoring any NaNs.
-
value_type nanmax() const
Maximum value of the image, ignoring any NaNs.
-
double nansum() const
Sum of image values, ignoring any NaNs.
-
double nanmean() const
Mean of image values, ignoring any NaNs.
-
double nanvar() const
Variance of image values, ignoring any NaNs.
-
bool containsNan() const
-
bool containsInf() const
-
using value_type = float
-
class ImageData