Developer documentation
Version 3.0.3-105-gd3941f44
MR::DWI Namespace Reference

Namespaces

namespace  Directions
 
namespace  FMLS
 
namespace  SDeconv
 
namespace  Tractography
 

Classes

class  Bootstrap
 
class  Fixel_map
 
class  Shell
 
class  Shells
 

Enumerations

enum class  BValueScalingBehaviour { Auto , UserOn , UserOff }
 

Functions

App::OptionGroup GradImportOptions ()
 
App::OptionGroup GradExportOptions ()
 
template<class MatrixType >
void check_DW_scheme (const Header &header, const MatrixType &grad)
 check that the DW scheme matches the DWI data in header More...
 
template<class MatrixType , class IndexVectorType >
Eigen::MatrixXd gen_direction_matrix (const MatrixType &grad, const IndexVectorType &dwi)
 convert the DW encoding matrix in grad into a azimuth/elevation direction set, using only the DWI volumes as per dwi More...
 
template<class MatrixType >
default_type condition_number_for_lmax (const MatrixType &dirs, int lmax)
 
Eigen::MatrixXd load_bvecs_bvals (const Header &header, const std::string &bvecs_path, const std::string &bvals_path)
 load and rectify FSL-style bvecs/bvals DW encoding files More...
 
void save_bvecs_bvals (const Header &, const std::string &, const std::string &)
 export gradient table in FSL format (bvecs/bvals) More...
 
template<class MatrixType >
void set_DW_scheme (Header &header, const MatrixType &G)
 store the DW gradient encoding matrix in a header More...
 
Eigen::MatrixXd parse_DW_scheme (const Header &header)
 parse the DW gradient encoding matrix from a header More...
 
Eigen::MatrixXd get_raw_DW_scheme (const Header &header)
 get the DW scheme as found in the headers or supplied at the command-line More...
 
void clear_DW_scheme (Header &)
 clear any DW gradient encoding scheme from the header More...
 
template<class MatrixType >
void stash_DW_scheme (Header &header, const MatrixType &grad)
 'stash' the DW gradient table More...
 
BValueScalingBehaviour get_cmdline_bvalue_scaling_behaviour ()
 
Eigen::MatrixXd get_DW_scheme (const Header &header, BValueScalingBehaviour bvalue_scaling=BValueScalingBehaviour::Auto)
 get the fully-interpreted DW gradient encoding matrix More...
 
void export_grad_commandline (const Header &header)
 process GradExportOptions command-line options More...
 
template<class MatrixType >
Eigen::MatrixXd compute_SH2amp_mapping (const MatrixType &directions, bool lmax_from_command_line=true, int default_lmax=8)
 get the matrix mapping SH coefficients to amplitudes More...
 
size_t lmax_for_directions (const Eigen::MatrixXd &directions, const bool lmax_from_command_line=true, const int default_lmax=8)
 get the maximum spherical harmonic order given a set of directions More...
 
FORCE_INLINE default_type bzero_threshold ()
 
template<class InputImageType , class OutputImageType , class MatrixType >
void estimate_noise (InputImageType &dwi, OutputImageType &noise, const MatrixType &SH2amp_mapping)
 
template<typename T , class MatrixType >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > grad2bmatrix (const MatrixType &grad, bool dki=false)
 
template<class MatrixType , class VectorTypeOut , class VectorTypeIn >
void dwi2tensor (VectorTypeOut &dt, const MatrixType &binv, VectorTypeIn &dwi)
 
template<class VectorType >
VectorType::Scalar tensor2ADC (const VectorType &dt)
 
template<class VectorType >
VectorType::Scalar tensor2FA (const VectorType &dt)
 
template<class VectorType >
VectorType::Scalar tensor2RA (const VectorType &dt)
 

Variables

App::Option bvalue_scaling_option
 
const char *const bvalue_scaling_description
 
const App::OptionGroup ShellsOption
 

Enumeration Type Documentation

◆ BValueScalingBehaviour

Enumerator
Auto 
UserOn 
UserOff 

Definition at line 223 of file gradient.h.

Function Documentation

◆ bzero_threshold()

FORCE_INLINE default_type MR::DWI::bzero_threshold ( )

Definition at line 67 of file shells.h.

◆ check_DW_scheme()

template<class MatrixType >
void MR::DWI::check_DW_scheme ( const Header header,
const MatrixType &  grad 
)
inline

check that the DW scheme matches the DWI data in header

Note
This is mostly for internal use. If you have obtained the DW scheme using DWI::get_DW_scheme(), it should already by guaranteed to match the corresponding header.

Definition at line 50 of file gradient.h.

◆ clear_DW_scheme()

void MR::DWI::clear_DW_scheme ( Header )

clear any DW gradient encoding scheme from the header

◆ compute_SH2amp_mapping()

template<class MatrixType >
Eigen::MatrixXd MR::DWI::compute_SH2amp_mapping ( const MatrixType &  directions,
bool  lmax_from_command_line = true,
int  default_lmax = 8 
)

get the matrix mapping SH coefficients to amplitudes

Computes the matrix mapping SH coefficients to the directions specified in directions (in spherical coordinates), up to a given lmax. By default, this is computed from the number of DW directions, up to a maximum value of default_lmax (defaults to 8), or the value specified using c -lmax command-line option (if lmax_from_command_line is true). If the resulting DW scheme is ill-posed (condition number less than 10), lmax will be reduced until it becomes sufficiently well conditioned (unless overridden on the command-line).

Note that this uses get_valid_DW_scheme() to get the DW_scheme, so will check for the -grad option as required.

Definition at line 264 of file gradient.h.

◆ condition_number_for_lmax()

template<class MatrixType >
default_type MR::DWI::condition_number_for_lmax ( const MatrixType &  dirs,
int  lmax 
)

Definition at line 98 of file gradient.h.

◆ dwi2tensor()

template<class MatrixType , class VectorTypeOut , class VectorTypeIn >
void MR::DWI::dwi2tensor ( VectorTypeOut &  dt,
const MatrixType &  binv,
VectorTypeIn &  dwi 
)
inline

Definition at line 79 of file tensor.h.

◆ estimate_noise()

template<class InputImageType , class OutputImageType , class MatrixType >
void MR::DWI::estimate_noise ( InputImageType &  dwi,
OutputImageType &  noise,
const MatrixType &  SH2amp_mapping 
)
inline

Definition at line 76 of file noise_estimator.h.

◆ export_grad_commandline()

void MR::DWI::export_grad_commandline ( const Header header)

process GradExportOptions command-line options

this checks for the -export_grad_mrtrix & -export_grad_fsl options, and exports the DW schemes if and as requested.

◆ gen_direction_matrix()

template<class MatrixType , class IndexVectorType >
Eigen::MatrixXd MR::DWI::gen_direction_matrix ( const MatrixType &  grad,
const IndexVectorType &  dwi 
)
inline

convert the DW encoding matrix in grad into a azimuth/elevation direction set, using only the DWI volumes as per dwi

Definition at line 75 of file gradient.h.

◆ get_cmdline_bvalue_scaling_behaviour()

BValueScalingBehaviour MR::DWI::get_cmdline_bvalue_scaling_behaviour ( )

◆ get_DW_scheme()

Eigen::MatrixXd MR::DWI::get_DW_scheme ( const Header header,
BValueScalingBehaviour  bvalue_scaling = BValueScalingBehaviour::Auto 
)

get the fully-interpreted DW gradient encoding matrix

find and validate the DW gradient encoding matrix, using the following procedure:

  • if the -grad option has been supplied, then load the matrix assuming it is in MRtrix format, and return it;
  • if the -fslgrad option has been supplied, then load and rectify the bvecs/bvals pair using load_bvecs_bvals() and return it;
  • if the DW_scheme member of the header is non-empty, return it;
  • validate the DW scheme and ensure it matches the header;
  • if bvalue_scaling is true (the default), scale the b-values accordingly, but only if non-unit vectors are detected;
  • normalise the gradient vectors;
  • update the header with this information

◆ get_raw_DW_scheme()

Eigen::MatrixXd MR::DWI::get_raw_DW_scheme ( const Header header)

get the DW scheme as found in the headers or supplied at the command-line

return the DW gradient encoding matrix found from the command-line arguments, or if not provided that way, as stored in the header. This return the scheme prior to any modification or validation.

Note
This is mostly for internal use. In general, you should use DWI::get_DW_scheme()

◆ grad2bmatrix()

template<typename T , class MatrixType >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > MR::DWI::grad2bmatrix ( const MatrixType &  grad,
bool  dki = false 
)
inline

Definition at line 30 of file tensor.h.

◆ GradExportOptions()

App::OptionGroup MR::DWI::GradExportOptions ( )

◆ GradImportOptions()

App::OptionGroup MR::DWI::GradImportOptions ( )

◆ lmax_for_directions()

size_t MR::DWI::lmax_for_directions ( const Eigen::MatrixXd &  directions,
const bool  lmax_from_command_line = true,
const int  default_lmax = 8 
)
inline

get the maximum spherical harmonic order given a set of directions

Computes the maximum spherical harmonic order lmax given a set of directions on the sphere. This may be less than the value requested at the command-line, or that calculated from the number of directions, if the resulting transform matrix is ill-posed.

Definition at line 324 of file gradient.h.

◆ load_bvecs_bvals()

Eigen::MatrixXd MR::DWI::load_bvecs_bvals ( const Header header,
const std::string &  bvecs_path,
const std::string &  bvals_path 
)

load and rectify FSL-style bvecs/bvals DW encoding files

This will load the bvecs/bvals files at the path specified, and convert them to the format expected by MRtrix. This involves rotating the vectors into the scanner frame of reference, and may also involve re-ordering and/or inverting of the vector elements to match the re-ordering performed by MRtrix for non-axial scans.

◆ parse_DW_scheme()

Eigen::MatrixXd MR::DWI::parse_DW_scheme ( const Header header)

parse the DW gradient encoding matrix from a header

extract the DW gradient encoding matrix stored in the header if one is present. This is expected to be stored in the Header::keyval() structure, under the key 'dw_scheme'.

Note
This is mostly for internal use. In general, you should use DWI::get_DW_scheme()

◆ save_bvecs_bvals()

void MR::DWI::save_bvecs_bvals ( const Header ,
const std::string &  ,
const std::string &   
)

export gradient table in FSL format (bvecs/bvals)

This will take the gradient table information from a header and export it to a bvecs/bvals file pair. In addition to splitting the information over two files, the vectors must be reoriented; firstly to change from scanner space to image space, and then to compensate for the fact that FSL defines its vectors with regards to the data strides in the image file.

◆ set_DW_scheme()

template<class MatrixType >
void MR::DWI::set_DW_scheme ( Header header,
const MatrixType &  G 
)

store the DW gradient encoding matrix in a header

this will store the DW gradient encoding matrix into the Header::keyval() structure of header, under the key 'dw_scheme'.

Definition at line 155 of file gradient.h.

◆ stash_DW_scheme()

template<class MatrixType >
void MR::DWI::stash_DW_scheme ( Header header,
const MatrixType &  grad 
)

'stash' the DW gradient table

Store the used DW gradient table to Header::keyval() key 'prior_dw_scheme', and delete the key 'dw_scheme' if it exists. This means that the scheme will no longer be identified by function parse_DW_scheme(), but still resides within the header data and can be extracted manually. This should be used when diffusion-weighted images are used to generate something that is not diffusion_weighted volumes.

Definition at line 212 of file gradient.h.

◆ tensor2ADC()

template<class VectorType >
VectorType::Scalar MR::DWI::tensor2ADC ( const VectorType &  dt)
inline

Definition at line 88 of file tensor.h.

◆ tensor2FA()

template<class VectorType >
VectorType::Scalar MR::DWI::tensor2FA ( const VectorType &  dt)
inline

Definition at line 95 of file tensor.h.

◆ tensor2RA()

template<class VectorType >
VectorType::Scalar MR::DWI::tensor2RA ( const VectorType &  dt)
inline

Definition at line 107 of file tensor.h.

Variable Documentation

◆ bvalue_scaling_description

const char* const MR::DWI::bvalue_scaling_description
extern

◆ bvalue_scaling_option

App::Option MR::DWI::bvalue_scaling_option
extern

◆ ShellsOption

const App::OptionGroup MR::DWI::ShellsOption
extern