NPL
Neurological Programs and Libraries
|
MRImageStore is a version of NDArray that has an orientation matrix. Right now it also has additional data that is unique to nifti. Eventually this class will be forked into a subclass, and this will only have the orientation. More...
#include <mrimage.h>
Inherits npl::NDArrayStore< D, T >, and npl::MRImage.
Public Member Functions | |
MRImageStore (std::initializer_list< size_t > a_args) | |
Constructor with initializer list. Orientation will be default (direction = identity, spacing = 1, origin = 0). More... | |
MRImageStore (const std::vector< size_t > &a_args) | |
Constructor with vector. Orientation will be default (direction = identity, spacing = 1, origin = 0). More... | |
MRImageStore (size_t len, const size_t *size) | |
Constructor with array of length len, Orientation will be default (direction = identity, spacing = 1, origin = 0). More... | |
MRImageStore (size_t len, const size_t *size, T *ptr, const std::function< void(void *)> &deleter) | |
Constructor which uses a preexsting array, to graft into the image. No new allocation will be performed, however ownership of the array will be taken, meaning it could be deleted anytime after this constructor completes. More... | |
MRImageStore () | |
Default constructor, uses identity for direction matrix, 1 for spacing and 0 for origin. Image size is 0. More... | |
virtual int | indexToPoint (size_t len, const int64_t *xyz, double *ras) const |
Converts an index in pixel space to RAS, physical/time coordinates. If len < dimensions, additional dimensions are assumed to be 0. If len > dimensions then additional values are ignored, and only the first DIM values will be transformed and written to ras. More... | |
virtual int | indexToPoint (size_t len, const double *xyz, double *ras) const |
Converts an index in pixel space to RAS, physical/time coordinates. If len < dimensions, additional dimensions are assumed to be 0. If len > dimensions then additional values are ignored, and only the first DIM values will be transformed and written to ras. More... | |
virtual int | pointToIndex (size_t len, const double *ras, double *xyz) const |
Converts a point in RAS coordinate system to index. If len < dimensions, additional dimensions are assumed to be 0. If len > dimensions then additional values are ignored, and only the first DIM values will be transformed and written to ras. More... | |
virtual int | pointToIndex (size_t len, const double *ras, int64_t *index) const |
Converts a point in RAS coordinate system to index. If len < dimensions, additional dimensions are assumed to be 0. If len > dimensions then additional values are ignored, and only the first DIM values will be transformed and written to ras. More... | |
virtual int | orientVector (size_t len, const double *xyz, double *ras) const |
Convert a vector in index coordinates to a vector in ras coordinates. Vector is simply multiplied by the internal rotation matrix. More... | |
virtual int | disOrientVector (size_t len, const double *ras, double *xyz) const |
Convert a vector in index coordinates to a vector in ras coordinates. Vector is simply multiplied by the internal rotation matrix. More... | |
virtual bool | pointInsideFOV (size_t len, const double *ras) const |
Returns true if the point is within the field of view of the image. Note, like all coordinates pass to MRImage, if the array given differs from the dimensions of the image, then the result will either pad out zeros and ignore extra values in the input array. More... | |
virtual bool | indexInsideFOV (size_t len, const double *xyz) const |
Returns true if the constinuous index is within the field of view of the image. Note, like all coordinates pass to MRImage, if the array given differs from the dimensions of the image, then the result will either pad out zeros and ignore extra values in the input array. More... | |
virtual bool | indexInsideFOV (size_t len, const int64_t *xyz) const |
Returns true if the constinuous index is within the field of view of the image. Note, like all coordinates pass to MRImage, if the array given differs from the dimensions of the image, then the result will either pad out zeros and ignore extra values in the input array. More... | |
std::string | getUnits (size_t d) |
Returns units of given dimension, note that this is prior to the direction matrix, so if there is oblique orientation you are really looking at a mix of units. More... | |
int | write (std::string filename, double version) const |
Write out nifti image with the current images data. More... | |
void | printSelf () |
Print information about the image. More... | |
virtual ptr< NDArray > | copy () const |
Performs a deep copy of the entire image and all metadata. More... | |
virtual ptr< NDArray > | createAnother () const |
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 |
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 |
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 |
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 |
Create a new image that is a copy of the input, possibly with new dimensions and pixeltype. The new image will have all overlapping pixels copied from the old image. More... | |
virtual ptr< NDArray > | copyCast (PixelT newtype) const |
Create a new image that is a copy of the input, with same dimensions but pxiels cast to newtype. The new image will have all overlapping pixels copied from the old image. More... | |
virtual ptr< NDArray > | copyCast (size_t newdims, const size_t *newsize) const |
Create a new image that is a copy of the input, possibly with new dimensions or size. The new image will have all overlapping pixels copied from the old image. The new image will have the same pixel type as the input image. More... | |
virtual ptr< NDArray > | extractCast (size_t len, const int64_t *index, const size_t *size) const |
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 size_t *size) const |
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. Index assumed to be [0,0,...], so the output image will start at the origin of this image. More... | |
virtual ptr< NDArray > | extractCast (size_t len, const int64_t *index, const size_t *size, PixelT newtype) const |
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 size_t *size, PixelT newtype) const |
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. Index assumed to be [0,0,...], so the output image will start at the origin of this image. More... | |
ptr< MRImage > | cloneImage () const |
Create an exact copy of the current image object, and return a pointer to it. More... | |
T & | operator[] (const int64_t *index) |
T & | operator[] (const std::vector< int64_t > &index) |
T & | operator[] (std::initializer_list< int64_t > index) |
T & | operator[] (int64_t pixel) |
const T & | operator[] (const int64_t *index) const |
const T & | operator[] (const std::vector< int64_t > &index) const |
const T & | operator[] (std::initializer_list< int64_t > index) const |
const T & | operator[] (int64_t pixel) const |
size_t | ndim () const |
size_t | bytes () const |
size_t | bytesper () const |
size_t | elements () const |
size_t | dim (size_t dir) const |
const size_t * | dim () const |
void | resize (const size_t dim[D]) |
Changes the dimensions (size) of the image. This does not affect rank/dimensionality. More... | |
void | resize (std::initializer_list< size_t > dim) |
Changes the dimensions (size) of the image. This does not affect rank/dimensionality. More... | |
PixelT | type () const |
Return enum PixelT type of pixels. More... | |
void * | data () |
Returns a pointer to the data array. Be careful. More... | |
const void * | data () const |
Returns a pointer to the data array. Be careful. More... | |
void | graft (const size_t dim[D], T *ptr, const std::function< void(void *)> &deleter) |
Grafts data of the given dimensions into the image, effectively changing the image size. More... | |
void | zero () |
Sets all elements to zero. More... | |
virtual void * | __getAddr (std::initializer_list< int64_t > index) const |
virtual void * | __getAddr (size_t len, const int64_t *index) const |
virtual void * | __getAddr (const std::vector< int64_t > &index) const |
virtual void * | __getAddr (int64_t i) const |
virtual void * | __getAddr (int64_t x, int64_t y, int64_t z, int64_t t) const |
virtual int64_t | getLinIndex (std::initializer_list< int64_t > index) const |
virtual int64_t | getLinIndex (size_t len, const int64_t *index) const |
virtual int64_t | getLinIndex (const std::vector< int64_t > &index) const |
virtual int64_t | getLinIndex (int64_t x, int64_t y, int64_t z, int64_t t) const |
virtual int64_t | tlen () const |
This function just returns the number of elements in a theoretical fourth dimension (ignoring orgnaization of higher dimensions) 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 |
void | orientDefault () |
Default orientation (dir=ident, space=1 and origin=0), also resizes them. So this could be called without first initializing size. More... | |
bool | isOriented () |
Returns true if the image has a valid orientation. More... | |
void | setOrient (const VectorXd &neworig, const VectorXd &newspace, const MatrixXd &newdir, bool reinit=true, CoordinateT coord=QFORM) |
Update the orientation of the pixels in RAS space. More... | |
const double & | direction (int64_t row, int64_t col) const |
Returns reference to a value in the direction matrix. Each row indicates the direction of the grid in RAS coordinates. This is the rotation of the Index grid. More... | |
const double & | invdirection (int64_t row, int64_t col) const |
Returns reference to a value in the inverse direction matrix. Each row indicates the direction of the grid in RAS coordinates. This is the rotation of the Index grid. More... | |
const MatrixXd & | getDirection () const |
Returns reference to the direction matrix. Each row indicates the direction of the grid in RAS coordinates. This is the rotation of the Index grid. More... | |
void | setDirection (const MatrixXd &newdir, bool reinit, CoordinateT coord=QFORM) |
Updates orientation information. If reinit is given then it will first set direction to the identity. otherwise old values will be left. After this the first min(DIMENSION,dir.rows()) columns and min(DIMENSION,dir.cols()) columns will be copies into the image direction matrix. More... | |
double & | origin (int64_t row) |
Returns reference to a value in the origin vector. This is the physical point that corresponds to index 0. More... | |
const double & | origin (int64_t row) const |
Returns reference to a value in the origin vector. This is the physical point that corresponds to index 0. More... | |
const VectorXd & | getOrigin () const |
Returns const reference to the origin vector. This is the physical point that corresponds to index 0. More... | |
void | setOrigin (const VectorXd &neworigin, bool reinit) |
Sets the origin vector. This is the physical point that corresponds to index 0. Note that min(current, new) elements will be copied. More... | |
double & | spacing (int64_t row) |
Returns reference to a value in the spacing vector. This is the physical distance between adjacent indexes. More... | |
const double & | spacing (int64_t row) const |
Returns reference to a value in the spacing vector. This is the physical distance between adjacent indexes. More... | |
const VectorXd & | getSpacing () const |
Returns const reference to the spacing vector. This is the physical distance between adjacent indexes. More... | |
void | setSpacing (const VectorXd &newspacing, bool reinit) |
Sets the spacing vector. This is the physical point that corresponds to index 0. Note that min(current, new) elements will be copied. More... | |
virtual bool | matchingOrient (ptr< const MRImage > other, bool checkdim, bool checksize, double tol=0.01) const |
Returns true of the other image has matching orientation as this. If checksize = true, then it will also check the size of the two images and return true if both orientation and size match, and false if they don't. More... | |
virtual bool | isIsotropic (bool only3d=true, double tol=0.01) const |
Returns true if the image is isotropic (same spacing in all dimensions). This can be looseened to checking only the first 3 dims with only3d = true. Tolerence in the absolute maximum difference between the first dim and any other dim. More... | |
ptr< MRImage > | getPtr () |
Returns a pointer to self. More... | |
ptr< const MRImage > | getConstPtr () const |
Returns a constant pointer to self. More... | |
virtual void | copyMetadata (ptr< const MRImage > src) |
Copies metadata from another image. This includes slice timing, anything read from nifti files, spacing, orientation etc, but NOT pixel data, size, and dimensionality. More... | |
void | updateSliceTiming (double duration, int start, int end, SliceOrderT order) |
Public Attributes | |
T * | _m_data |
size_t | _m_stride [D] |
size_t | _m_dim [D] |
int | m_freqdim |
int | m_phasedim |
int | m_slicedim |
CoordinateT | m_coordinate |
double | m_slice_duration |
int | m_slice_start |
int | m_slice_end |
SliceOrderT | m_slice_order |
std::map< int64_t, double > | m_slice_timing |
Protected Member Functions | |
int | writeNifti1Image (gzFile file) const |
int | writeNifti2Image (gzFile file) const |
int | writeNifti1Header (gzFile file) const |
int | writeNifti2Header (gzFile file) const |
int | writeJSON (gzFile file) const |
void | updateStrides () |
virtual int | writePixels (gzFile file) const |
virtual int | writeCSV (gzFile file) const |
Protected Attributes | |
std::string | m_units [D] |
Vector of units for each dimension. More... | |
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... | |
MatrixXd | m_direction |
Direction Matrix. Each row indicates the direction of the grid in RAS coordinates. This is the rotation of the Index grid. Note that you should not set this directly,. More... | |
MatrixXd | m_inv_direction |
Inverse of Direction Matrix. More... | |
VectorXd | m_spacing |
Spacing vector. Indicates distance between adjacent pixels in each dimension. Note that you should not set this directly, use setSpacing() instead because it will update the affine Matrix. More... | |
VectorXd | m_origin |
Origin vector. Indicates the RAS coordinates of index [0,0,0,..] Note that you should not set this directly, use setOrigin() instead because it will update the affine Matrix. More... | |
MRImageStore is a version of NDArray that has an orientation matrix. Right now it also has additional data that is unique to nifti. Eventually this class will be forked into a subclass, and this will only have the orientation.
D | Number of dimensions |
T | Pixel type |
npl::MRImageStore< D, T >::MRImageStore | ( | std::initializer_list< size_t > | a_args | ) |
Constructor with initializer list. Orientation will be default (direction = identity, spacing = 1, origin = 0).
a_args | dimensions of input, the length of this initializer list may not be fully used if a_args is longer than D. If it is shorter then D then additional dimensions are left as size 1. |
npl::MRImageStore< D, T >::MRImageStore | ( | const std::vector< size_t > & | a_args | ) |
Constructor with vector. Orientation will be default (direction = identity, spacing = 1, origin = 0).
a_args | dimensions of input, the length of this initializer list may not be fully used if a_args is longer than D. If it is shorter then D then additional dimensions are left as size 1. |
npl::MRImageStore< D, T >::MRImageStore | ( | size_t | len, |
const size_t * | size | ||
) |
Constructor with array of length len, Orientation will be default (direction = identity, spacing = 1, origin = 0).
len | Length of array 'size' |
size | dimensions of input, the length of this initializer list may not be fully used if a_args is longer than D. If it is shorter then D then additional dimensions are left as size 1. |
npl::MRImageStore< D, T >::MRImageStore | ( | size_t | len, |
const size_t * | size, | ||
T * | ptr, | ||
const std::function< void(void *)> & | deleter | ||
) |
Constructor which uses a preexsting array, to graft into the image. No new allocation will be performed, however ownership of the array will be taken, meaning it could be deleted anytime after this constructor completes.
len | Length of array 'size' |
size | dimensions of input, the length of this initializer list may not be fully used if a_args is longer than D. If it is shorter then D then additional dimensions are left as size 1. |
ptr | Pointer to data array, should be allocated with new, and size should be exactly sizeof(T)*size[0]*size[1]*...*size[len-1] |
deleter | Function to use to delete (free) ptr |
npl::MRImageStore< D, T >::MRImageStore | ( | ) |
Default constructor, uses identity for direction matrix, 1 for spacing and 0 for origin. Image size is 0.
|
inlinevirtualinherited |
Implements npl::NDArray.
|
inlinevirtualinherited |
Implements npl::NDArray.
|
inlinevirtualinherited |
Implements npl::NDArray.
|
inlinevirtualinherited |
Implements npl::NDArray.
|
inlinevirtualinherited |
Implements npl::NDArray.
|
virtualinherited |
Implements npl::NDArray.
|
virtualinherited |
Implements npl::NDArray.
|
virtual |
Create an exact copy of the current image object, and return a pointer to it.
Implements npl::MRImage.
|
inlineinherited |
|
virtual |
Performs a deep copy of the entire image and all metadata.
Implements npl::MRImage.
|
virtual |
Create a new image that is a copy of the input, possibly with new dimensions and pixeltype. The new image will have all overlapping pixels copied from the old image.
newdims | Number of dimensions in output image |
newsize | Size of output image |
newtype | Type of pixels in output image |
Implements npl::MRImage.
|
virtual |
Create a new image that is a copy of the input, with same dimensions but pxiels cast to newtype. The new image will have all overlapping pixels copied from the old image.
newtype | Type of pixels in output image |
Implements npl::MRImage.
|
virtual |
Create a new image that is a copy of the input, possibly with new dimensions or size. The new image will have all overlapping pixels copied from the old image. The new image will have the same pixel type as the input image.
newdims | Number of dimensions in output image |
newsize | Size of output image |
Implements npl::MRImage.
Copies metadata from another image. This includes slice timing, anything read from nifti files, spacing, orientation etc, but NOT pixel data, size, and dimensionality.
src | Other image to copy from |
|
virtual |
Creates an identical array, but does not initialize pixel values.
Implements npl::MRImage.
|
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 |
Implements npl::MRImage.
|
virtual |
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 |
Implements npl::MRImage.
|
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, |
Implements npl::MRImage.
|
inlinevirtualinherited |
|
inlinevirtualinherited |
|
virtualinherited |
Implements npl::NDArray.
|
virtualinherited |
Implements npl::NDArray.
|
inherited |
Returns reference to a value in the direction matrix. Each row indicates the direction of the grid in RAS coordinates. This is the rotation of the Index grid.
row | Row to access |
col | Column to access |
|
virtual |
Convert a vector in index coordinates to a vector in ras coordinates. Vector is simply multiplied by the internal rotation matrix.
len | Length of input vector (may be different than dimension - extra values will be ignored, missing values will be assumed zero) |
ras | Input vector in physical space. |
xyz | Output vector in index space ijk. This is the product of the input vector and inverse rotation matrix |
Implements npl::MRImage.
|
virtualinherited |
Implements npl::NDArray.
|
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.
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. |
Implements npl::MRImage.
|
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. Index assumed to be [0,0,...], so the output image will start at the origin of this image.
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. |
Implements npl::MRImage.
|
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.
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. |
Implements npl::MRImage.
|
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. Index assumed to be [0,0,...], so the output image will start at the origin of this image.
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. |
Implements npl::MRImage.
|
inlineinherited |
|
inherited |
Returns reference to the direction matrix. Each row indicates the direction of the grid in RAS coordinates. This is the rotation of the Index grid.
|
virtualinherited |
Implements npl::NDArray.
|
virtualinherited |
Implements npl::NDArray.
|
virtualinherited |
Implements npl::NDArray.
|
virtualinherited |
Implements npl::NDArray.
|
inherited |
Returns const reference to the origin vector. This is the physical point that corresponds to index 0.
|
inherited |
Returns const reference to the spacing vector. This is the physical distance between adjacent indexes.
|
inline |
|
inherited |
Grafts data of the given dimensions into the image, effectively changing the image size.
dim | Dimensions of image |
ptr | Pointer to data which we will take control of |
deleter | Function which can be called on ptr to delete it. |
|
virtual |
Returns true if the constinuous index is within the field of view of the image. Note, like all coordinates pass to MRImage, if the array given differs from the dimensions of the image, then the result will either pad out zeros and ignore extra values in the input array.
len | Length of xyz array |
xyz | Array of continouos indices |
Implements npl::MRImage.
|
virtual |
Returns true if the constinuous index is within the field of view of the image. Note, like all coordinates pass to MRImage, if the array given differs from the dimensions of the image, then the result will either pad out zeros and ignore extra values in the input array.
len | Length of xyz array |
xyz | Array of indices |
Implements npl::MRImage.
|
virtual |
Converts an index in pixel space to RAS, physical/time coordinates. If len < dimensions, additional dimensions are assumed to be 0. If len > dimensions then additional values are ignored, and only the first DIM values will be transformed and written to ras.
len | Length of xyz/ras arrays. |
xyz | Array in xyz... coordinates (maybe as long as you want). |
ras | Corresponding coordinate |
Implements npl::MRImage.
|
virtual |
Converts an index in pixel space to RAS, physical/time coordinates. If len < dimensions, additional dimensions are assumed to be 0. If len > dimensions then additional values are ignored, and only the first DIM values will be transformed and written to ras.
len | Length of xyz/ras arrays. |
xyz | Array in xyz... coordinates (maybe as long as you want). |
ras | Corresponding coordinate |
Implements npl::MRImage.
|
inherited |
Returns reference to a value in the inverse direction matrix. Each row indicates the direction of the grid in RAS coordinates. This is the rotation of the Index grid.
row | Row to access |
col | Column to access |
|
virtualinherited |
Returns true if the image is isotropic (same spacing in all dimensions). This can be looseened to checking only the first 3 dims with only3d = true. Tolerence in the absolute maximum difference between the first dim and any other dim.
only3d | Only check spacing in the first 3 dimensions (default) |
tol | Tolerence in the absolute maximum difference between the first dim and any other dim. |
|
inlineinherited |
|
virtualinherited |
Returns true of the other image has matching orientation as this. If checksize = true, then it will also check the size of the two images and return true if both orientation and size match, and false if they don't.
other | MRimage to compare. |
checkdim | Whether to enforce identical dimensionality. If this is false then the first min(D1,D2) dimensions will be checked, if this is true then mismatched dimensionality will cause this to return a false |
checksize | Whether to enforce identical size as well as orientation |
tol | tolerance for differences in orientation. Because the orientation matrix must undergo floating operationt to convert from Quaternions there are likely to be (small) errors. |
|
virtualinherited |
Implements npl::NDArray.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Default orientation (dir=ident, space=1 and origin=0), also resizes them. So this could be called without first initializing size.
|
virtual |
Convert a vector in index coordinates to a vector in ras coordinates. Vector is simply multiplied by the internal rotation matrix.
len | Length of input vector (may be different than dimension - extra values will be ignored, missing values will be assumed zero) |
xyz | Input vector in index space ijk.... |
ras | Output vector in physical space. This is the product of the input vector and rotation matrix |
Implements npl::MRImage.
|
inherited |
Returns reference to a value in the origin vector. This is the physical point that corresponds to index 0.
row | Row to access |
|
inherited |
Returns reference to a value in the origin vector. This is the physical point that corresponds to index 0.
row | Row to access |
|
virtual |
Returns true if the point is within the field of view of the image. Note, like all coordinates pass to MRImage, if the array given differs from the dimensions of the image, then the result will either pad out zeros and ignore extra values in the input array.
len | Length of RAS array |
ras | Array of Right-handed coordinates Right+, Anterior+, Superior+ |
Implements npl::MRImage.
|
virtual |
Converts a point in RAS coordinate system to index. If len < dimensions, additional dimensions are assumed to be 0. If len > dimensions then additional values are ignored, and only the first DIM values will be transformed and written to ras.
len | Length of xyz/ras arrays. |
ras | Array in RAS... coordinates (may be as long as you want). |
xyz | Corresponding coordinate |
Implements npl::MRImage.
|
virtual |
Converts a point in RAS coordinate system to index. If len < dimensions, additional dimensions are assumed to be 0. If len > dimensions then additional values are ignored, and only the first DIM values will be transformed and written to ras.
len | Length of xyz/ras arrays. |
ras | Array in RAS... coordinates (may be as long as you want). |
index | Corresponding coordinate, rounded to nearest integer |
Implements npl::MRImage.
void npl::MRImageStore< D, T >::printSelf | ( | ) |
Print information about the image.
|
inherited |
Changes the dimensions (size) of the image. This does not affect rank/dimensionality.
dim | New size |
|
inherited |
Changes the dimensions (size) of the image. This does not affect rank/dimensionality.
dim | New size |
|
inherited |
Updates orientation information. If reinit is given then it will first set direction to the identity. otherwise old values will be left. After this the first min(DIMENSION,dir.rows()) columns and min(DIMENSION,dir.cols()) columns will be copies into the image direction matrix.
newdir | Input direction/rotation |
reinit | Whether to reset everything to Identity/0 before applying. You may want to do this if theinput matrices/vectors differ in dimension from this image. |
coord | coordinate system this refers to. Eventually this might include more advanced options (scanner,anat etc). For now it is just QFORM or SFORM |
|
inherited |
Update the orientation of the pixels in RAS space.
neworig | New Origin. |
newspace | New Spacing. |
newdir | New Direction |
reinit | Whether to reset everything to Identity/0 before applying. You may want to do this if theinput matrices/vectors differ in dimension from this image. |
coord | coordinate system this refers to. Eventually this might include more advanced options (scanner,anat etc). For now it is just QFORM or SFORM |
|
inherited |
Sets the origin vector. This is the physical point that corresponds to index 0. Note that min(current, new) elements will be copied.
neworigin | the new origin vector to copy. |
reinit | Whether to reset everything to Identity/0 before applying. You may want to do this if theinput matrices/vectors differ in dimension from this image. |
|
inherited |
Sets the spacing vector. This is the physical point that corresponds to index 0. Note that min(current, new) elements will be copied.
newspacing | the new spacing vector to copy. |
reinit | Set the whole vector to 1s first. This might be useful if you are setting fewer elements than dimensions |
|
inlineinherited |
|
inherited |
Returns reference to a value in the spacing vector. This is the physical distance between adjacent indexes.
row | Row to access |
|
inherited |
Returns reference to a value in the spacing vector. This is the physical distance between adjacent indexes.
row | Row to access |
|
inlinevirtualinherited |
This function just returns the number of elements in a theoretical fourth dimension (ignoring orgnaization of higher dimensions)
Implements npl::NDArray.
|
virtualinherited |
|
inlineinherited |
|
inherited |
|
protectedinherited |
|
virtual |
Write out nifti image with the current images data.
filename | |
version | > 2 or < 2 to indicate whether to use nifti version 2 or nifti version 1. |
Implements npl::MRImage.
|
protectedvirtualinherited |
|
protectedvirtual |
Reimplemented from npl::NDArrayStore< D, T >.
|
protectedvirtual |
Reimplemented from npl::NDArrayStore< D, T >.
|
protectedvirtual |
Implements npl::MRImage.
|
protectedvirtual |
Reimplemented from npl::NDArrayStore< D, T >.
|
protectedvirtual |
Implements npl::MRImage.
|
protectedvirtualinherited |
|
virtualinherited |
Sets all elements to zero.
Implements npl::NDArray.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Origin vector. Indicates the RAS coordinates of index [0,0,0,..] Note that you should not set this directly, use setOrigin() instead because it will update the affine Matrix.
|
inherited |
|
inherited |
|
protectedinherited |
Spacing vector. Indicates distance between adjacent pixels in each dimension. Note that you should not set this directly, use setSpacing() instead because it will update the affine Matrix.
|
protected |