Biomedical Image Analysis Library
The Biomedical Image Analysis Library is a poweful tool for developers, physicians, researchers, engineers, and so on.
|
Magnetic Resonance Image class. More...
#include <NiftiHeader.hpp>
Public Member Functions | |
NiftiHeader () | |
Basic Constructor. More... | |
NiftiHeader (const Vector< size_t > &new_dim, const Vector< float > &new_pixdim, NiftiType new_datatype=NiftiType::INT8, bool one_file=true) | |
Basic Constructor. More... | |
template<class D > | |
NiftiHeader (const Image< D > &img, bool one_file=true) | |
Basic Constructor. More... | |
NiftiHeader (const std::string &filename) | |
Basic Constructor. More... | |
const Vector< size_t > & | Dim () const |
Returns a reference to dimension vector. More... | |
size_t | Size (size_t dms) const |
Returns the size of a given image dimension. More... | |
void | Size (size_t dms, size_t val) |
Updates image dimension size. More... | |
const Vector< float > & | PixelSize () const |
Returns a reference to pixel dimension vector. More... | |
float | PixelSize (size_t dms) const |
Returns the pixel size of a given image dimension. More... | |
void | PixelSize (size_t dms, float val) |
Updates Pixel dimension size. More... | |
short | BitPix () const |
Returns the number of bits per pixel. More... | |
NiftiType | DataType () const |
Returns data type code. More... | |
void | Write (OFile &file, bool one_file) const |
Writes this nifti header to file. More... | |
void | Write (const std::string &filename) const |
Writes this nifti header to file with filename 'filename'. More... | |
void | DataType (NiftiType type) |
Changes header information to support data of type 'type'. More... | |
void | QuaternToMat (const Vector< float > &pixel_dim) |
Translates quaterns to 4x4 matrix used to convert from xyz to ijk space. More... | |
void | MatToQuatern () |
Translates 4x4 matrix used to convert from xyz to ijk space to quaterns. More... | |
std::string | Orientation (size_t row) const |
Returned std::string can be: LR, RL, SI, IS, AP, PA, or Undefined. More... | |
std::string | Orientation () const |
Returned std::string will be a composition of three values containing: LR, RL, SI, IS, AP, or PA, or Undefined std::string. More... | |
bool | UseQuatern () |
Returns a boolean value indicating if this MR image uses quaternion orientation form or not. More... | |
bool | UseAffine () |
Returns a boolean value indicating if this MR image uses affine orientation form or not. More... | |
void | QuaternMatrix (const Matrix< float > mat) |
Assigns mat data to qtm. More... | |
Matrix< float > | QuaternMatrix () const |
returns a copy of qtm. More... | |
void | QuaternOffset (float x, float y, float z) |
Sets quatern offset. More... | |
void | AffineMatrix (const Matrix< float > mat) |
Assigns mat data to stm. More... | |
Matrix< float > | AffineMatrix () const |
returns a copy of stm. More... | |
template<class O > | |
O & | PrintOrientation (O &os) const |
Prints nifti orientation information to output stream 'os'. More... | |
template<class O > | |
O & | Print (O &os) const |
Prints nifti header information to output stream 'os'. More... | |
Static Public Member Functions | |
static NiftiHeader | Read (const std::string &filename) |
Returns a nifti header read from file with filename 'filename'. More... | |
static bool | IsNiftiFile (const std::string &filename) |
Returns true if given file has nifti extension. More... | |
static std::string | HeaderFileName (const std::string &filename) |
Returns nifti header file name associated to filename. More... | |
static std::string | DataFileName (const std::string &filename) |
Returns nifti data file name associated to filename. More... | |
static std::string | ExistingHeaderFileName (const std::string &filename) |
Returns existing nifti header file name associated to filename. More... | |
static std::string | ExistingDataFileName (const std::string &filename) |
Returns existing nifti data file name associated to filename. More... | |
static size_t | AxialDimension (const std::string &orientation) |
Returns the number of the image dimension that corresponds to axial direction. More... | |
static size_t | CoronalDimension (const std::string &orientation) |
Returns the number of the image dimension that corresponds to coronal direction. More... | |
static size_t | SagittalDimension (const std::string &orientation) |
Returns the number of the image dimension that corresponds to sagittal direction. More... | |
static bool | SuperiorInferior (const std::string &orientation) |
Returns true if axial dimension direction is superior-inferior. More... | |
static bool | AnteriorPosterior (const std::string &orientation) |
Returns true if coronal dimension direction is anterior-posterior. More... | |
static void | SwapNBytes (size_t n, int siz, void *ar) |
Swaps bytes of data pointed by ar. Used to read data written by different architectures. More... | |
static bool | IsSwapped (const std::string filename) |
Verifies if header nifti file corresponding to filename must swap bytes order. More... | |
static NiftiType | DataType (const std::string &filename) |
Returns the type of the data in given file. More... | |
static void | DataTypeSizes (int datatype, size_t &nbyper, size_t &swapsize) |
Computes the number of bytes of each element and the bytes to be swapped. More... | |
Static Public Attributes | |
static const short | NIFTI_HEADER_SIZE = 348 |
static const short | ANALYZE_EXTENT = 16384 |
Friends | |
template<class D > | |
class | Image |
Magnetic Resonance Image class.
Definition at line 248 of file NiftiHeader.hpp.
Bial::NiftiHeader::NiftiHeader | ( | ) |
Basic Constructor.
none. |
Bial::NiftiHeader::NiftiHeader | ( | const Vector< size_t > & | new_dim, |
const Vector< float > & | new_pixdim, | ||
NiftiType | new_datatype = NiftiType::INT8 , |
||
bool | one_file = true |
||
) |
Basic Constructor.
new_dim | Vector with MR image dimensions. |
new_pixel_dim | array with pixel dimensions. |
new_datatype | nifti header data type. |
one_file | defines weather it is a header from one or two files image. |
Basic Constructor.
img | base image to extract dimensions and datatype. |
one_file | defines weather it is a header from one or two files image. |
Bial::NiftiHeader::NiftiHeader | ( | const std::string & | filename | ) |
Basic Constructor.
filename | File name. |
Assigns mat data to stm.
mat | a matrix to be set to affine transformation matrix. |
Matrix< float > Bial::NiftiHeader::AffineMatrix | ( | ) | const |
returns a copy of stm.
none. |
|
static |
Returns true if coronal dimension direction is anterior-posterior.
orientation | Image orientation. Must be a composition of three values containing: LR, RL, SI, IS, AP, or PA. Look for NiftiHeader::Orientation() function for examples. |
|
static |
Returns the number of the image dimension that corresponds to axial direction.
orientation | Image orientation. Must be a composition of three values containing: LR, RL, SI, IS, AP, or PA. Look for NiftiHeader::Orientation() function for examples. |
short Bial::NiftiHeader::BitPix | ( | ) | const |
Returns the number of bits per pixel.
none. |
|
static |
Returns the number of the image dimension that corresponds to coronal direction.
orientation | Image orientation. Must be a composition of three values containing: LR, RL, SI, IS, AP, or PA. Look for NiftiHeader::Orientation() function for examples. |
|
static |
Returns nifti data file name associated to filename.
filename | A nifti extension file name. |
NiftiType Bial::NiftiHeader::DataType | ( | ) | const |
Returns data type code.
none. |
void Bial::NiftiHeader::DataType | ( | NiftiType | type | ) |
Changes header information to support data of type 'type'.
type | data type. |
Returns the type of the data in given file.
filename | A nifti extension file name. |
|
static |
Computes the number of bytes of each element and the bytes to be swapped.
datatype | type of image data. |
nbyper | bytes by data element. |
swapsize | size of datas that may be swapped. |
Returns a reference to dimension vector.
none. |
|
static |
Returns existing nifti data file name associated to filename.
filename | A nifti extension file name. |
|
static |
Returns existing nifti header file name associated to filename.
filename | A nifti extension file name. |
|
static |
Returns nifti header file name associated to filename.
filename | A nifti extension file name. |
|
static |
Returns true if given file has nifti extension.
filename | A file name. |
|
static |
Verifies if header nifti file corresponding to filename must swap bytes order.
filename | File name. |
void Bial::NiftiHeader::MatToQuatern | ( | ) |
Translates 4x4 matrix used to convert from xyz to ijk space to quaterns.
none. |
std::string Bial::NiftiHeader::Orientation | ( | size_t | row | ) | const |
Returned std::string can be: LR, RL, SI, IS, AP, PA, or Undefined.
row | The row of orientation. |
std::string Bial::NiftiHeader::Orientation | ( | ) | const |
Returned std::string will be a composition of three values containing: LR, RL, SI, IS, AP, or PA, or Undefined std::string.
none. |
Returns a reference to pixel dimension vector.
none. |
float Bial::NiftiHeader::PixelSize | ( | size_t | dms | ) | const |
Returns the pixel size of a given image dimension.
dms | The dimension of desired pixel size. |
void Bial::NiftiHeader::PixelSize | ( | size_t | dms, |
float | val | ||
) |
Updates Pixel dimension size.
dms | The dimension of desired size. |
val | New size of the pixel dimension. |
O& Bial::NiftiHeader::Print | ( | O & | os | ) | const |
Prints nifti header information to output stream 'os'.
os | An output stream. |
O& Bial::NiftiHeader::PrintOrientation | ( | O & | os | ) | const |
Prints nifti orientation information to output stream 'os'.
os | An output stream. |
Assigns mat data to qtm.
mat | a matrix to be set to quatern matrix. |
Matrix< float > Bial::NiftiHeader::QuaternMatrix | ( | ) | const |
returns a copy of qtm.
none. |
void Bial::NiftiHeader::QuaternOffset | ( | float | x, |
float | y, | ||
float | z | ||
) |
Sets quatern offset.
x | x quatern offset. |
y | y quatern offset. |
z | z quatern offset. |
Translates quaterns to 4x4 matrix used to convert from xyz to ijk space.
pixel_dim | dimensions of the pixel. |
|
static |
Returns a nifti header read from file with filename 'filename'.
filename | A nifti extension file name. |
|
static |
Returns the number of the image dimension that corresponds to sagittal direction.
orientation | Image orientation. Must be a composition of three values containing: LR, RL, SI, IS, AP, or PA. Look for NiftiHeader::Orientation() function for examples. |
size_t Bial::NiftiHeader::Size | ( | size_t | dms | ) | const |
Returns the size of a given image dimension.
dms | The dimension of desired size. |
void Bial::NiftiHeader::Size | ( | size_t | dms, |
size_t | val | ||
) |
Updates image dimension size.
dms | The dimension of desired size. |
val | New size of the dimension. |
|
static |
Returns true if axial dimension direction is superior-inferior.
orientation | Image orientation. Must be a composition of three values containing: LR, RL, SI, IS, AP, or PA. Look for NiftiHeader::Orientation() function for examples. |
|
static |
Swaps bytes of data pointed by ar. Used to read data written by different architectures.
n | number of bytes to be swapped. |
siz | size of the swapped data. |
ar | pointer to data. |
bool Bial::NiftiHeader::UseAffine | ( | ) |
Returns a boolean value indicating if this MR image uses affine orientation form or not.
none. |
bool Bial::NiftiHeader::UseQuatern | ( | ) |
Returns a boolean value indicating if this MR image uses quaternion orientation form or not.
none. |
void Bial::NiftiHeader::Write | ( | OFile & | file, |
bool | one_file | ||
) | const |
Writes this nifti header to file.
file | Opened file for outputting. |
one_file | If it is nii or hdr+img file. |
void Bial::NiftiHeader::Write | ( | const std::string & | filename | ) | const |
Writes this nifti header to file with filename 'filename'.
filename | A nifti extension file name. |
|
friend |
Definition at line 250 of file NiftiHeader.hpp.
|
static |
Definition at line 253 of file NiftiHeader.hpp.
|
static |
Definition at line 252 of file NiftiHeader.hpp.