OpenWalnut
1.5.0dev
|
Reader for the NIfTI file format. More...
#include <WReaderNIfTI.h>
Public Member Functions | |
WReaderNIfTI (std::string fileName) | |
Constructs a loader to be executed in its own thread and ets the data needed for the loader when executed in its own thread. More... | |
virtual std::shared_ptr< WDataSet > | load (DataSetType dataSetType=W_DATASET_NONE) |
Loads the dataset. More... | |
WMatrix< double > | getStandardTransform () const |
Returns a standard transformation. More... | |
WMatrix< double > | getSFormTransform () const |
Returns the SForm transformation stored in the nifti file's header. More... | |
WMatrix< double > | getQFormTransform () const |
Returns the QForm transformation stored in the nifti file's header. More... | |
Public Member Functions inherited from WReader | |
WReader (std::string fname) | |
Creates a read object for file reading. More... | |
OW_API_DEPRECATED void | setFileName (std::string fname) |
Reset the file name and checks if it exists. More... | |
void | setFilename (std::string fname) |
Reset the file name and checks if it exists. More... | |
Protected Types | |
typedef std::shared_ptr< std::vector< WVector3d > > | GradVec |
Shorthand type for a vector of gradients. More... | |
typedef std::shared_ptr< std::vector< float > > | BValues |
Shorthand type for a vector of bvalues. More... | |
Protected Member Functions | |
BValues | readBValuesIfAvailable (unsigned int vDim) |
Reads the additional bval file if available. More... | |
GradVec | readGradientsIfAvailable (unsigned int vDim) |
Reads the additional gradient file if available. More... | |
Private Member Functions | |
template<typename T > | |
std::shared_ptr< std::vector< T > > | copyArray (const T *dataArray, const size_t countVoxels, const size_t vDim) |
This function allows one to copy the data given as a T* by niftilibio into a std::vector< T > More... | |
WMatrix< double > | convertMatrix (const mat44 &in) |
This function converts a 4x4 matrix from the NIfTI libs into the format used by OpenWalnut. More... | |
Private Attributes | |
WMatrix< double > | m_sform |
the sform transform stored in the file header More... | |
WMatrix< double > | m_qform |
the qform transform stored in the file header More... | |
Friends | |
class | WReaderNIfTITest |
Only UnitTests may be friends. More... | |
Additional Inherited Members | |
Protected Attributes inherited from WReader | |
std::string | m_fname |
Absolute path of the file to read from. More... | |
Reader for the NIfTI file format.
For NIfTI just see http://nifti.nimh.nih.gov/.
Definition at line 42 of file WReaderNIfTI.h.
|
protected |
Shorthand type for a vector of bvalues.
The comopents are typically given as floats, as partical b-values start at 0 and are at maximum around 17000 (see: https://dx.doi.org/10.1002/mrm.20642).
Definition at line 96 of file WReaderNIfTI.h.
|
protected |
Shorthand type for a vector of gradients.
Definition at line 91 of file WReaderNIfTI.h.
|
explicit |
Constructs a loader to be executed in its own thread and ets the data needed for the loader when executed in its own thread.
fileName | this file will be loaded |
Definition at line 52 of file WReaderNIfTI.cpp.
|
private |
This function converts a 4x4 matrix from the NIfTI libs into the format used by OpenWalnut.
in | this matrix will be converted. |
Definition at line 74 of file WReaderNIfTI.cpp.
References WMatrix< T >::makeIdentity().
Referenced by WReaderNIfTITest::testMatrixConversion().
|
private |
This function allows one to copy the data given as a T* by niftilibio into a std::vector< T >
dataArray | data to copy |
countVoxels | number of voxels stored in dataArray |
vDim | number of values per voxel |
Definition at line 59 of file WReaderNIfTI.cpp.
Referenced by load(), and WReaderNIfTITest::testCopyArray().
WMatrix< double > WReaderNIfTI::getQFormTransform | ( | ) | const |
Returns the QForm transformation stored in the nifti file's header.
Definition at line 527 of file WReaderNIfTI.cpp.
References m_qform.
Referenced by WMData::load().
WMatrix< double > WReaderNIfTI::getSFormTransform | ( | ) | const |
Returns the SForm transformation stored in the nifti file's header.
Definition at line 522 of file WReaderNIfTI.cpp.
References m_sform.
Referenced by WMData::load().
WMatrix< double > WReaderNIfTI::getStandardTransform | ( | ) | const |
Returns a standard transformation.
Definition at line 517 of file WReaderNIfTI.cpp.
References WMatrix< T >::makeIdentity().
Referenced by WMData::load().
|
virtual |
Loads the dataset.
dataSetType | This parameter can be used to tell the function in advance how it should interprete the data. |
Definition at line 210 of file WReaderNIfTI.cpp.
References copyArray(), and WReader::m_fname.
Referenced by WMData::load(), WMReadSphericalHarmonics::moduleMain(), WReaderNIfTITest::testLoading1(), WReaderNIfTITest::testLoading2(), WReaderNIfTITest::testLoading3(), WReaderNIfTITest::testLoading4(), WReaderNIfTITest::testLoading5(), and WReaderNIfTITest::testLoading6().
|
protected |
Reads the additional bval file if available.
The file format should be (ASCII file):
bval for_x-component of the first gradient followed by a newline bval for x-component of the second gradient followed by a newline ... bval for x-compoennt of the last gradient followed by a newline bval for_y-component of the first gradient followed by a newline ... bval for y-compoennt of the last gradient followed by a newline bval for_z-component of the first gradient followed by a newline ... bval for z-compoennt of the last gradient followed by a newline
For example: three gradients, with bvalues: 0, 1000, and 1000.
0 1000 1000 0 1000 1000 0 1000 1000
for three gradients, where first all bvalues for all x-components must be given, each in a separate line, then all bavlues for all y-components, and finally the same for the z-components. Thus there should be three times of the number of gradients be present in such a file.
vDim | Nifti dimension |
Definition at line 153 of file WReaderNIfTI.cpp.
References wlog::debug(), wlog::error(), and WReader::m_fname.
|
protected |
Reads the additional gradient file if available.
The file format should be (ASCII file): There are three lines, each containing the x-, y-, and z-components of the gradients. The first line contains all x-components of all gradients. Thus each lines should have the same number of values, each separated by whitespace.
x-comp._of_the_first_gradient x-comp._of_the_second_gradient ... x-comp._of_the_last_gradient followed by a newline y-comp._of_the_first_gradient y-comp._of_the_second_gradient ... y-comp._of_the_last_gradient followed by a newline z-comp._of_the_first_gradient z-comp._of_the_second_gradient ... z-comp._of_the_last_gradient followed by a newline
For example: three gradients:
0 -0.530466 -0.294864 0 -0.558441 -0.285613 0 0.637769 -0.911856
vDim | Nifti dimension |
Definition at line 95 of file WReaderNIfTI.cpp.
References wlog::debug(), wlog::error(), and WReader::m_fname.
|
friend |
Only UnitTests may be friends.
Definition at line 47 of file WReaderNIfTI.h.
|
private |
the qform transform stored in the file header
Definition at line 182 of file WReaderNIfTI.h.
Referenced by getQFormTransform().
|
private |
the sform transform stored in the file header
Definition at line 179 of file WReaderNIfTI.h.
Referenced by getSFormTransform().