NPL
Neurological Programs and Libraries
|
Pure virtual interface to interact with an ND array. More...
#include <ndarray.h>
Inherits enable_shared_from_this< NDArray >.
Inherited by npl::NDArrayStore< 1, double > [virtual]
, npl::NDArrayStore< 2, double > [virtual]
, npl::NDArrayStore< 3, double > [virtual]
, npl::NDArrayStore< D, double > [virtual]
, npl::MRImage [virtual]
, and npl::NDArrayStore< D, T > [virtual]
.
Public Member Functions | |
virtual size_t | ndim () const =0 |
virtual size_t | bytes () const =0 |
virtual size_t | bytesper () const =0 |
virtual size_t | elements () const =0 |
virtual size_t | dim (size_t dir) const =0 |
virtual const size_t * | dim () const =0 |
virtual PixelT | type () const =0 |
Return enum PixelT type of pixels. More... | |
bool | floatType () const |
Returns true if the stored type is FLOAT32, FLOAT64, or FLOAT128, ie is a pure float type. More... | |
bool | complexType () const |
Returns true if the stored type is COMPLEX256, COMPLEX128, or COMPLEX64, ie is a complex floating point type. More... | |
bool | signedType () const |
Returns true if the stored type is a variant of signed integer . More... | |
bool | unsignedType () const |
Returns true if the stored type is a variant of unsigned signed integer. More... | |
ptr< NDArray > | getPtr () |
ptr< const NDArray > | getConstPtr () const |
virtual void * | data ()=0 |
virtual const void * | data () const =0 |
virtual ptr< NDArray > | copy () const =0 |
Performs a deep copy of the entire array. More... | |
virtual ptr< NDArray > | createAnother () const =0 |
Creates an identical array, but does not initialize pixel values. More... | |
virtual ptr< NDArray > | createAnother (size_t newdims, const size_t *newsize, PixelT newtype) const =0 |
Create a new array that is the same underlying type as this. If this is an image then it will also copy the metdata, but NOT the pixels. More... | |
virtual ptr< NDArray > | createAnother (PixelT newtype) const =0 |
Create a new array that is the same underlying type as this, but with a different pixel type. More... | |
virtual ptr< NDArray > | createAnother (size_t newdims, const size_t *newsize) const =0 |
Create a new array that is the same underlying type as this, and same pixel type and orientation as this, but with a different size. More... | |
virtual ptr< NDArray > | copyCast (size_t newdims, const size_t *newsize, PixelT newtype) const =0 |
Create a new array that is a copy of the input, possibly with new dimensions and pixeltype. The new array will have all overlapping pixels copied from the old array. More... | |
virtual ptr< NDArray > | copyCast (PixelT newtype) const =0 |
Create a new array that is a copy of the input, with same dimensions but pxiels cast to newtype. The new array will have all overlapping pixels copied from the old array. More... | |
virtual ptr< NDArray > | copyCast (size_t newdims, const size_t *newsize) const =0 |
Create a new array that is a copy of the input, possibly with new dimensions or size. The new array will have all overlapping pixels copied from the old array. The new array will have the same pixel type as the input array. More... | |
virtual ptr< NDArray > | extractCast (size_t len, const int64_t *index, const size_t *size) const =0 |
extracts a region of this image. Zeros in the size variable indicate dimension to be removed. More... | |
virtual ptr< NDArray > | extractCast (size_t len, const size_t *size) const =0 |
extracts a region of this image. Zeros in the size variable indicate dimension to be removed. More... | |
virtual ptr< NDArray > | extractCast (size_t len, const int64_t *index, const size_t *size, PixelT newtype) const =0 |
extracts a region of this image. Zeros in the size variable indicate dimension to be removed. More... | |
virtual ptr< NDArray > | extractCast (size_t len, const size_t *size, PixelT newtype) const =0 |
extracts a region of this image. Zeros in the size variable indicate dimension to be removed. More... | |
virtual int | write (std::string filename, double version=1) const =0 |
Write the image to a nifti file. More... | |
virtual void | zero ()=0 |
Sets all elements to zero. More... | |
virtual void * | __getAddr (std::initializer_list< int64_t > index) const =0 |
virtual void * | __getAddr (size_t len, const int64_t *index) const =0 |
virtual void * | __getAddr (const std::vector< int64_t > &index) const =0 |
virtual void * | __getAddr (int64_t i) const =0 |
virtual void * | __getAddr (int64_t x, int64_t y, int64_t z, int64_t t) const =0 |
virtual int64_t | getLinIndex (std::initializer_list< int64_t > index) const =0 |
virtual int64_t | getLinIndex (size_t len, const int64_t *index) const =0 |
virtual int64_t | getLinIndex (const std::vector< int64_t > &index) const =0 |
virtual int64_t | getLinIndex (int64_t x, int64_t y, int64_t z, int64_t t) const =0 |
virtual int64_t | tlen () const =0 |
This function just returns the number of elements in a theoretical fourth dimension (ignoring orgnaization of higher dimensions) More... | |
Protected Member Functions | |
NDArray () | |
Protected Attributes | |
std::function< void(void *)> | m_freefunc |
The function which should be called when deleting data. By default this will just be delete[], but if data is grafted or if. More... | |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
inline |
Performs a deep copy of the entire array.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, npl::MRImageStore< 5, double >, npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, npl::NDArrayStore< 3, double >, and npl::MRImage.
|
pure virtual |
Create a new array that is a copy of the input, possibly with new dimensions and pixeltype. The new array will have all overlapping pixels copied from the old array.
newdims | Number of dimensions in copied output |
newsize | Size of output, this array should be of size newdims |
newtype | Type of pixels in output array |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, npl::MRImageStore< 5, double >, npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, npl::NDArrayStore< 3, double >, and npl::MRImage.
Create a new array that is a copy of the input, with same dimensions but pxiels cast to newtype. The new array will have all overlapping pixels copied from the old array.
newtype | Type of pixels in output array |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, npl::MRImageStore< 5, double >, npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, npl::NDArrayStore< 3, double >, and npl::MRImage.
|
pure virtual |
Create a new array that is a copy of the input, possibly with new dimensions or size. The new array will have all overlapping pixels copied from the old array. The new array will have the same pixel type as the input array.
newdims | Number of dimensions in output array |
newsize | Input array of length newdims that gives the size of output array, |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, npl::MRImageStore< 5, double >, npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, npl::NDArrayStore< 3, double >, and npl::MRImage.
Creates an identical array, but does not initialize pixel values.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, npl::MRImageStore< 5, double >, npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, npl::NDArrayStore< 3, double >, and npl::MRImage.
|
pure virtual |
Create a new array that is the same underlying type as this. If this is an image then it will also copy the metdata, but NOT the pixels.
newdims | Number of dimensions in copied output |
newsize | Size of output, this array should be of size newdims |
newtype | Type of pixels in output array |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, npl::MRImageStore< 5, double >, npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, npl::NDArrayStore< 3, double >, and npl::MRImage.
Create a new array that is the same underlying type as this, but with a different pixel type.
newtype | Type of pixels in output array |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, npl::MRImageStore< 5, double >, npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, npl::NDArrayStore< 3, double >, and npl::MRImage.
|
pure virtual |
Create a new array that is the same underlying type as this, and same pixel type and orientation as this, but with a different size.
newdims | Number of dimensions in output array |
newsize | Input array of length newdims that gives the size of output array, |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, npl::MRImageStore< 5, double >, npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, npl::NDArrayStore< 3, double >, and npl::MRImage.
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
extracts a region of this image. Zeros in the size variable indicate dimension to be removed.
len | Length of index/newsize arrays |
index | Index to start copying from. |
size | Size of output image. Note length 0 dimensions will be removed, while length 1 dimensions will be left. |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, npl::MRImageStore< 5, double >, npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, npl::NDArrayStore< 3, double >, and npl::MRImage.
|
pure virtual |
extracts a region of this image. Zeros in the size variable indicate dimension to be removed.
len | Length of index/size arrays |
size | Size of output image. Note length 0 dimensions will be removed, while length 1 dimensions will be left. |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, npl::MRImageStore< 5, double >, npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, npl::NDArrayStore< 3, double >, and npl::MRImage.
|
pure virtual |
extracts a region of this image. Zeros in the size variable indicate dimension to be removed.
len | Length of index/size arrays |
index | Index to start copying from. |
size | Size of output image. Note length 0 dimensions will be removed, while length 1 dimensions will be left. |
newtype | Pixel type of output image. |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, npl::MRImageStore< 5, double >, npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, npl::NDArrayStore< 3, double >, and npl::MRImage.
|
pure virtual |
extracts a region of this image. Zeros in the size variable indicate dimension to be removed.
len | Length of index/size arrays |
size | Size of output image. Note length 0 dimensions will be removed, while length 1 dimensions will be left. |
newtype | Pixel type of output image. |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, npl::MRImageStore< 5, double >, npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, npl::NDArrayStore< 3, double >, and npl::MRImage.
|
inline |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
inline |
|
pure virtual |
This function just returns the number of elements in a theoretical fourth dimension (ignoring orgnaization of higher dimensions)
Implemented in npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, and npl::NDArrayStore< 3, double >.
|
pure virtual |
Return enum PixelT type of pixels.
Implemented in npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, and npl::NDArrayStore< 3, double >.
|
inline |
|
pure virtual |
Write the image to a nifti file.
filename | Filename |
version | Version of nifti to use |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, npl::MRImageStore< 5, double >, npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, npl::NDArrayStore< 3, double >, and npl::MRImage.
|
pure virtual |
Sets all elements to zero.
Implemented in npl::NDArrayStore< D, T >, npl::NDArrayStore< D, double >, npl::NDArrayStore< 1, double >, npl::NDArrayStore< 2, double >, and npl::NDArrayStore< 3, double >.
|
protected |