Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
Manages random forests for fiber tractography. The preparation of the features from the inputa data and the training process are handled here. The data preprocessing and actual prediction for the tracking process is also performed here. The tracking itself is performed in MLBSTrackingFilter. More...
#include <mitkTrackingForestHandler.h>
Public Types | |
typedef itk::Image< unsigned char, 3 > | ItkUcharImgType |
typedef itk::Image< itk::Vector< float, NumberOfSignalFeatures *2 >, 3 > | InterpolatedRawImageType |
typedef itk::Image< Vector< float, NumberOfSignalFeatures >, 3 > | FeatureImageType |
Public Member Functions | |
TrackingForestHandler () | |
~TrackingForestHandler () | |
void | SetRawData (std::vector< Image::Pointer > images) |
void | AddRawData (Image::Pointer img) |
void | SetTractograms (std::vector< FiberBundle::Pointer > tractograms) |
void | SetMaskImages (std::vector< ItkUcharImgType::Pointer > images) |
void | SetWhiteMatterImages (std::vector< ItkUcharImgType::Pointer > images) |
void | StartTraining () |
void | SaveForest (std::string forestFile) |
void | LoadForest (std::string forestFile) |
void | SetNumTrees (int num) |
void | SetMaxTreeDepth (int depth) |
void | SetStepSize (double step) |
void | SetGrayMatterSamplesPerVoxel (int samples) |
void | SetSampleFraction (double fraction) |
std::shared_ptr< vigra::RandomForest< int > > | GetForest () |
void | InitForTracking () |
calls InputDataValidForTracking() and creates feature images from the war input DWI More... | |
vnl_vector_fixed< double, 3 > | Classify (itk::Point< double, 3 > &pos, int &candidates, vnl_vector_fixed< double, 3 > &olddir, double angularThreshold, double &w, ItkUcharImgType::Pointer mask=nullptr) |
predicts next progression direction at the given position More... | |
bool | IsForestValid () |
true is forest is not null, has more than 0 trees and the correct number of features (NumberOfSignalFeatures + 3) More... | |
Protected Member Functions | |
void | InputDataValidForTracking () |
check if raw data is set and tracking forest is valid More... | |
FeatureImageType::PixelType | GetFeatureValues (itk::Point< float, 3 > itkP) |
get trilinearly interpolated feature values at given world position More... | |
void | InputDataValidForTraining () |
Check if everything is tehere for training (raw datasets, fiber tracts) More... | |
void | PreprocessInputDataForTraining () |
Generate masks if necessary, resample fibers, spherically interpolate raw DWIs. More... | |
void | CalculateFeaturesForTraining () |
Calculate GM and WM features using the interpolated raw data, the WM masks and the fibers. More... | |
void | TrainForest () |
start training process More... | |
InterpolatedRawImageType::PixelType | GetImageValues (itk::Point< float, 3 > itkP, typename InterpolatedRawImageType::Pointer image) |
get trilinearly interpolated raw image values at given world position More... | |
Protected Attributes | |
std::vector< Image::Pointer > | m_RawData |
original input DWI data More... | |
std::shared_ptr< vigra::RandomForest< int > > | m_Forest |
random forest classifier More... | |
std::chrono::time_point< std::chrono::system_clock > | m_StartTime |
std::chrono::time_point< std::chrono::system_clock > | m_EndTime |
std::vector< FiberBundle::Pointer > | m_Tractograms |
training tractograms More... | |
std::vector< ItkUcharImgType::Pointer > | m_MaskImages |
binary mask images to constrain training to a certain area (e.g. brain mask) More... | |
std::vector< ItkUcharImgType::Pointer > | m_WhiteMatterImages |
defines white matter voxels. if not set, theses mask images are automatically generated from the input tractograms More... | |
std::vector< typename InterpolatedRawImageType::Pointer > | m_InterpolatedRawImages |
spherically interpolated and resampled raw datasets More... | |
double | m_WmSampleDistance |
deterines the number of white matter samples (distance of sampling points on each fiber). More... | |
int | m_NumTrees |
number of trees in random forest More... | |
int | m_MaxTreeDepth |
limits the tree depth More... | |
double | m_SampleFraction |
fraction of samples used to train each tree More... | |
unsigned int | m_NumberOfSamples |
stores overall number of samples used for training More... | |
std::vector< unsigned int > | m_GmSamples |
number of gray matter samples More... | |
int | m_GmSamplesPerVoxel |
number of gray matter samplees per voxel. if -1, then the number is automatically chosen to gain an overall number of GM samples close to the number of WM samples. More... | |
vigra::MultiArray< 2, double > | m_FeatureData |
vigra container for training features More... | |
FeatureImageType::Pointer | m_FeatureImage |
feature image used for tracking More... | |
vigra::MultiArray< 2, double > | m_LabelData |
vigra container for training labels More... | |
std::vector< int > | m_DirectionIndices |
maps each of the NumberOfSignalFeatures possible output directions to one of the 2*NumberOfSignalFeatures ODF directions. More... | |
itk::OrientationDistributionFunction< double, NumberOfSignalFeatures *2 > | m_DirContainer |
direction container More... | |
Manages random forests for fiber tractography. The preparation of the features from the inputa data and the training process are handled here. The data preprocessing and actual prediction for the tracking process is also performed here. The tracking itself is performed in MLBSTrackingFilter.
Definition at line 45 of file mitkTrackingForestHandler.h.
typedef itk::Image< Vector< float, NumberOfSignalFeatures > , 3 > mitk::TrackingForestHandler< ShOrder, NumberOfSignalFeatures >::FeatureImageType |
Definition at line 55 of file mitkTrackingForestHandler.h.
typedef itk::Image< itk::Vector< float, NumberOfSignalFeatures*2 > , 3 > mitk::TrackingForestHandler< ShOrder, NumberOfSignalFeatures >::InterpolatedRawImageType |
Definition at line 54 of file mitkTrackingForestHandler.h.
typedef itk::Image<unsigned char, 3> mitk::TrackingForestHandler< ShOrder, NumberOfSignalFeatures >::ItkUcharImgType |
Definition at line 53 of file mitkTrackingForestHandler.h.
mitk::TrackingForestHandler< ShOrder, NumberOfSignalFeatures >::TrackingForestHandler | ( | ) |
Definition at line 27 of file mitkTrackingForestHandler.cpp.
mitk::TrackingForestHandler< ShOrder, NumberOfSignalFeatures >::~TrackingForestHandler | ( | ) |
Definition at line 38 of file mitkTrackingForestHandler.cpp.
|
inline |
Definition at line 58 of file mitkTrackingForestHandler.h.
Referenced by main().
|
protected |
Calculate GM and WM features using the interpolated raw data, the WM masks and the fibers.
Definition at line 484 of file mitkTrackingForestHandler.cpp.
References itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetDirection(), MITK_INFO, and mitk::New().
vnl_vector_fixed< double, 3 > mitk::TrackingForestHandler< ShOrder, NumberOfSignalFeatures >::Classify | ( | itk::Point< double, 3 > & | pos, |
int & | candidates, | ||
vnl_vector_fixed< double, 3 > & | olddir, | ||
double | angularThreshold, | ||
double & | w, | ||
ItkUcharImgType::Pointer | mask = nullptr |
||
) |
predicts next progression direction at the given position
Definition at line 245 of file mitkTrackingForestHandler.cpp.
|
protected |
get trilinearly interpolated feature values at given world position
Definition at line 172 of file mitkTrackingForestHandler.cpp.
|
inline |
Definition at line 81 of file mitkTrackingForestHandler.h.
|
protected |
get trilinearly interpolated raw image values at given world position
Definition at line 43 of file mitkTrackingForestHandler.cpp.
void mitk::TrackingForestHandler< ShOrder, NumberOfSignalFeatures >::InitForTracking | ( | ) |
calls InputDataValidForTracking() and creates feature images from the war input DWI
Definition at line 125 of file mitkTrackingForestHandler.cpp.
References itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetDirection(), mitk::DiffusionPropertyHelper::GetGradientContainer(), mitk::DiffusionPropertyHelper::GetItkVectorImage(), mitk::DiffusionPropertyHelper::GetReferenceBValue(), MITK_INFO, and mitk::New().
|
protected |
check if raw data is set and tracking forest is valid
Definition at line 116 of file mitkTrackingForestHandler.cpp.
References mitkThrow.
|
protected |
Check if everything is tehere for training (raw datasets, fiber tracts)
Definition at line 346 of file mitkTrackingForestHandler.cpp.
References mitkThrow.
bool mitk::TrackingForestHandler< ShOrder, NumberOfSignalFeatures >::IsForestValid | ( | ) |
true is forest is not null, has more than 0 trees and the correct number of features (NumberOfSignalFeatures + 3)
Definition at line 357 of file mitkTrackingForestHandler.cpp.
void mitk::TrackingForestHandler< ShOrder, NumberOfSignalFeatures >::LoadForest | ( | std::string | forestFile | ) |
Definition at line 696 of file mitkTrackingForestHandler.cpp.
References MITK_INFO.
Referenced by main().
|
protected |
Generate masks if necessary, resample fibers, spherically interpolate raw DWIs.
Definition at line 365 of file mitkTrackingForestHandler.cpp.
References mitk::DiffusionPropertyHelper::GetGradientContainer(), mitk::DiffusionPropertyHelper::GetItkVectorImage(), mitk::DiffusionPropertyHelper::GetReferenceBValue(), MITK_INFO, itk::TractDensityImageFilter< OutputImageType >::New(), and mitk::New().
void mitk::TrackingForestHandler< ShOrder, NumberOfSignalFeatures >::SaveForest | ( | std::string | forestFile | ) |
Definition at line 685 of file mitkTrackingForestHandler.cpp.
References MITK_INFO.
Referenced by main().
|
inline |
Definition at line 79 of file mitkTrackingForestHandler.h.
Referenced by main().
|
inline |
Definition at line 67 of file mitkTrackingForestHandler.h.
Referenced by main().
|
inline |
Definition at line 77 of file mitkTrackingForestHandler.h.
Referenced by main().
|
inline |
Definition at line 76 of file mitkTrackingForestHandler.h.
Referenced by main().
|
inline |
Definition at line 57 of file mitkTrackingForestHandler.h.
Referenced by main().
|
inline |
Definition at line 80 of file mitkTrackingForestHandler.h.
Referenced by main().
|
inline |
Definition at line 78 of file mitkTrackingForestHandler.h.
Referenced by main().
|
inline |
Definition at line 59 of file mitkTrackingForestHandler.h.
Referenced by main().
|
inline |
Definition at line 68 of file mitkTrackingForestHandler.h.
Referenced by main().
void mitk::TrackingForestHandler< ShOrder, NumberOfSignalFeatures >::StartTraining | ( | ) |
Definition at line 331 of file mitkTrackingForestHandler.cpp.
References MITK_INFO.
Referenced by main().
|
protected |
start training process
Definition at line 648 of file mitkTrackingForestHandler.cpp.
References MITK_INFO.
|
protected |
direction container
Definition at line 125 of file mitkTrackingForestHandler.h.
|
protected |
maps each of the NumberOfSignalFeatures possible output directions to one of the 2*NumberOfSignalFeatures ODF directions.
Definition at line 124 of file mitkTrackingForestHandler.h.
|
protected |
Definition at line 105 of file mitkTrackingForestHandler.h.
|
protected |
vigra container for training features
Definition at line 119 of file mitkTrackingForestHandler.h.
|
protected |
feature image used for tracking
Definition at line 122 of file mitkTrackingForestHandler.h.
|
protected |
random forest classifier
Definition at line 103 of file mitkTrackingForestHandler.h.
Referenced by mitk::TrackingForestHandler< ShOrder >::GetForest().
|
protected |
number of gray matter samples
Definition at line 117 of file mitkTrackingForestHandler.h.
|
protected |
number of gray matter samplees per voxel. if -1, then the number is automatically chosen to gain an overall number of GM samples close to the number of WM samples.
Definition at line 118 of file mitkTrackingForestHandler.h.
Referenced by mitk::TrackingForestHandler< ShOrder >::SetGrayMatterSamplesPerVoxel().
|
protected |
spherically interpolated and resampled raw datasets
Definition at line 111 of file mitkTrackingForestHandler.h.
|
protected |
vigra container for training labels
Definition at line 123 of file mitkTrackingForestHandler.h.
|
protected |
binary mask images to constrain training to a certain area (e.g. brain mask)
Definition at line 109 of file mitkTrackingForestHandler.h.
Referenced by mitk::TrackingForestHandler< ShOrder >::SetMaskImages().
|
protected |
limits the tree depth
Definition at line 114 of file mitkTrackingForestHandler.h.
Referenced by mitk::TrackingForestHandler< ShOrder >::SetMaxTreeDepth().
|
protected |
stores overall number of samples used for training
Definition at line 116 of file mitkTrackingForestHandler.h.
|
protected |
number of trees in random forest
Definition at line 113 of file mitkTrackingForestHandler.h.
Referenced by mitk::TrackingForestHandler< ShOrder >::SetNumTrees().
|
protected |
original input DWI data
Definition at line 102 of file mitkTrackingForestHandler.h.
Referenced by mitk::TrackingForestHandler< ShOrder >::AddRawData(), and mitk::TrackingForestHandler< ShOrder >::SetRawData().
|
protected |
fraction of samples used to train each tree
Definition at line 115 of file mitkTrackingForestHandler.h.
Referenced by mitk::TrackingForestHandler< ShOrder >::SetSampleFraction().
|
protected |
Definition at line 104 of file mitkTrackingForestHandler.h.
|
protected |
training tractograms
Definition at line 108 of file mitkTrackingForestHandler.h.
Referenced by mitk::TrackingForestHandler< ShOrder >::SetTractograms().
|
protected |
defines white matter voxels. if not set, theses mask images are automatically generated from the input tractograms
Definition at line 110 of file mitkTrackingForestHandler.h.
Referenced by mitk::TrackingForestHandler< ShOrder >::SetWhiteMatterImages().
|
protected |
deterines the number of white matter samples (distance of sampling points on each fiber).
Definition at line 112 of file mitkTrackingForestHandler.h.
Referenced by mitk::TrackingForestHandler< ShOrder >::SetStepSize().