NPL
Neurological Programs and Libraries
|
MRImage can basically be used like an NDArray, with the addition of orientation related additions. More...
#include <mrimage.h>
Inherits npl::NDArray.
Inherited by npl::MRImageStore< 3, double > [virtual]
, npl::MRImageStore< 4, double > [virtual]
, npl::MRImageStore< 5, double > [virtual]
, and npl::MRImageStore< D, T > [virtual]
.
Public Member Functions | |
MRImage () | |
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 int | indexToPoint (size_t len, const int64_t *xyz, double *ras) const =0 |
virtual int | indexToPoint (size_t len, const double *xyz, double *ras) const =0 |
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 =0 |
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 =0 |
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 =0 |
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 =0 |
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 =0 |
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 =0 |
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 =0 |
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 | 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... | |
virtual int | write (std::string filename, double version=1) const =0 |
Write the image to a nifti file. More... | |
ptr< MRImage > | getPtr () |
Returns a pointer to self. More... | |
ptr< const MRImage > | getConstPtr () const |
Returns a constant pointer to self. More... | |
virtual ptr< MRImage > | cloneImage () const =0 |
Create a copy of this image. This is identical to copy() but will return a pointer to an image rather than an NDArray. More... | |
virtual ptr< NDArray > | copy () const =0 |
Performs a deep copy of the entire image and all metadata. 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 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 =0 |
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 =0 |
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 =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 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) |
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... | |
virtual void * | data ()=0 |
virtual const void * | data () const =0 |
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... | |
Public Attributes | |
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 | |
virtual int | writeNifti1Image (gzFile file) const =0 |
virtual int | writeNifti2Image (gzFile file) const =0 |
Protected Attributes | |
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... | |
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... | |
Friends | |
ptr< MRImage > | readNiftiImage (gzFile file, bool verbose) |
|
pure virtualinherited |
|
pure virtualinherited |
|
pure virtualinherited |
|
pure virtualinherited |
|
pure virtualinherited |
|
pure virtualinherited |
|
pure virtualinherited |
Create a copy of this image. This is identical to copy() but will return a pointer to an image rather than an NDArray.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
inlineinherited |
Performs a deep copy of the entire image and all metadata.
Implements npl::NDArray.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
pure 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::NDArray.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
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::NDArray.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
pure 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::NDArray.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
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 |
Creates an identical array, but does not initialize pixel values.
Implements npl::NDArray.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
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 |
Implements npl::NDArray.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
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::NDArray.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
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, |
Implements npl::NDArray.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
pure virtualinherited |
|
pure virtualinherited |
|
pure virtualinherited |
|
pure virtualinherited |
const double& npl::MRImage::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.
row | Row to access |
col | Column to access |
|
pure 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 |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
pure virtualinherited |
|
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. |
Implements npl::NDArray.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
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. |
Implements npl::NDArray.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
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. |
Implements npl::NDArray.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
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. |
Implements npl::NDArray.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
inlineinherited |
const MatrixXd& npl::MRImage::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.
|
pure virtualinherited |
|
pure virtualinherited |
|
pure virtualinherited |
|
pure virtualinherited |
const VectorXd& npl::MRImage::getOrigin | ( | ) | const |
Returns const reference to the origin vector. This is the physical point that corresponds to index 0.
const VectorXd& npl::MRImage::getSpacing | ( | ) | const |
Returns const reference to the spacing vector. This is the physical distance between adjacent indexes.
|
pure 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 |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
pure 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 |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
pure virtual |
|
pure 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 |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
const double& npl::MRImage::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.
row | Row to access |
col | Column to access |
|
virtual |
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. |
|
inline |
|
virtual |
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. |
|
pure virtualinherited |
void npl::MRImage::orientDefault | ( | ) |
Default orientation (dir=ident, space=1 and origin=0), also resizes them. So this could be called without first initializing size.
|
pure 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 |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
double& npl::MRImage::origin | ( | int64_t | row | ) |
Returns reference to a value in the origin vector. This is the physical point that corresponds to index 0.
row | Row to access |
const double& npl::MRImage::origin | ( | int64_t | row | ) | const |
Returns reference to a value in the origin vector. This is the physical point that corresponds to index 0.
row | Row to access |
|
pure 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+ |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
pure 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 |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
pure 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 |
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
void npl::MRImage::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.
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 |
void npl::MRImage::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.
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 |
void npl::MRImage::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.
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. |
void npl::MRImage::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.
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 |
double& npl::MRImage::spacing | ( | int64_t | row | ) |
Returns reference to a value in the spacing vector. This is the physical distance between adjacent indexes.
row | Row to access |
const double& npl::MRImage::spacing | ( | int64_t | row | ) | const |
Returns reference to a value in the spacing vector. This is the physical distance between adjacent indexes.
row | Row to access |
|
pure virtualinherited |
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 virtualinherited |
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 >.
|
inlineinherited |
void npl::MRImage::updateSliceTiming | ( | double | duration, |
int | start, | ||
int | end, | ||
SliceOrderT | order | ||
) |
|
pure virtual |
Write the image to a nifti file.
filename | Filename |
version | Version of nifti to use |
Implements npl::NDArray.
Implemented in npl::MRImageStore< D, T >, npl::MRImageStore< 3, double >, npl::MRImageStore< 4, double >, and npl::MRImageStore< 5, double >.
|
protectedpure virtual |
|
protectedpure virtual |
|
pure virtualinherited |
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 >.
CoordinateT npl::MRImage::m_coordinate |
|
protected |
|
protectedinherited |
|
protected |
|
protected |
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.
SliceOrderT npl::MRImage::m_slice_order |
|
protected |
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.