22 #ifndef __itkMLBSTrackingFilter_h_
23 #define __itkMLBSTrackingFilter_h_
25 #include <itkImageToImageFilter.h>
26 #include <itkVectorContainer.h>
27 #include <itkVectorImage.h>
28 #include <vtkSmartPointer.h>
29 #include <vtkPolyData.h>
30 #include <vtkCellArray.h>
31 #include <vtkPoints.h>
32 #include <vtkPolyLine.h>
33 #include <vtkCleanPolyData.h>
35 #include <itkMersenneTwisterRandomVariateGenerator.h>
37 #include <itkSimpleFastMutexLock.h>
44 #include <vigra/random_forest.hxx>
45 #include <vigra/multi_array.hxx>
46 #include <vigra/random_forest_hdf5_impex.hxx>
53 template<
int ShOrder=6,
int NumImageFeatures=100 >
54 class MLBSTrackingFilter :
public ImageToImageFilter< VectorImage< short, 3 >, Image< double, 3 > >
62 typedef ImageToImageFilter< VectorImage< short, 3 >, Image< double, 3 > >
Superclass;
69 itkFactorylessNewMacro(Self)
91 itkGetMacro( FiberPolyData, PolyDataType )
92 itkSetMacro(
SeedImage, ItkUcharImgType::Pointer)
93 itkSetMacro( MaskImage, ItkUcharImgType::Pointer)
94 itkSetMacro( SeedsPerVoxel,
int)
95 itkSetMacro( StepSize,
double)
96 itkSetMacro( MinTractLength,
double )
97 itkSetMacro( MaxTractLength,
double )
98 itkSetMacro( AngularThreshold,
double )
99 itkSetMacro( SamplingDistance,
double )
100 itkSetMacro( NumberOfSamples,
int )
101 itkSetMacro( StoppingRegions, ItkUcharImgType::Pointer)
102 itkSetMacro( DemoMode,
bool )
103 itkSetMacro( RemoveWmEndFibers,
bool )
104 itkSetMacro( AposterioriCurvCheck,
bool )
105 itkSetMacro( AvoidStop,
bool )
106 itkSetMacro( RandomSampling,
bool )
118 double FollowStreamline(itk::Point<double, 3> pos, vnl_vector_fixed<double,3> dir,
FiberType* fib,
double tractLength,
bool front);
120 vnl_vector_fixed<double,3>
GetNewDirection(itk::Point<double, 3>& pos, vnl_vector_fixed<double,3>& olddir);
126 void ThreadedGenerateData(
const InputImageRegionType &outputRegionForThread, ThreadIdType threadId)
override;
165 std::chrono::time_point<std::chrono::system_clock>
m_EndTime;
173 #ifndef ITK_MANUAL_INSTANTIATION
177 #endif //__itkMLBSTrackingFilter_h_
Superclass::InputImageRegionType InputImageRegionType
double FollowStreamline(itk::Point< double, 3 > pos, vnl_vector_fixed< double, 3 > dir, FiberType *fib, double tractLength, bool front)
Start streamline in one direction.
bool m_AposterioriCurvCheck
double GetRandDouble(double min=-1, double max=1)
Image< Vector< float, NumImageFeatures >, 3 > FeatureImageType
InputImageType::Pointer m_InputImage
itk::SmartPointer< Self > Pointer
mitk::PointSet::Pointer m_SamplingPointset
volatile bool m_PauseTracking
std::chrono::time_point< std::chrono::system_clock > m_EndTime
void ThreadedGenerateData(const InputImageRegionType &outputRegionForThread, ThreadIdType threadId) override
vtkSmartPointer< vtkCellArray > m_Cells
itk::Image< unsigned char, 3 > SeedImage
vtkSmartPointer< vtkPoints > m_Points
SmartPointer< const Self > ConstPointer
std::vector< FiberType > BundleType
vtkSmartPointer< vtkPolyData > PolyDataType
void SetForestHandler(mitk::TrackingForestHandler< ShOrder > fh)
DataCollection - Class to facilitate loading/accessing structured data.
double m_SamplingDistance
mitk::TrackingForestHandler< ShOrder > m_ForestHandler
void CalculateNewPosition(itk::Point< double, 3 > &pos, vnl_vector_fixed< double, 3 > &dir)
Calculate next integration step.
Performes deterministic streamline tracking on the input tensor image.
std::vector< PolyDataType > m_PolyDataContainer
int CheckCurvature(FiberType *fib, bool front)
mitk::PointSet::Pointer m_AlternativePointset
bool IsValidPosition(itk::Point< double, 3 > &pos)
Are we outside of the mask image?
ImageToImageFilter< VectorImage< short, 3 >, Image< double, 3 > > Superclass
vnl_vector_fixed< double, 3 > GetNewDirection(itk::Point< double, 3 > &pos, vnl_vector_fixed< double, 3 > &olddir)
Determine new direction by sample voting at the current position taking the last progression directio...
ItkUcharImgType::Pointer m_SeedImage
ItkUcharImgType::Pointer m_MaskImage
void AfterThreadedGenerateData() override
itk::Image< double, 3 > InputImageType
std::deque< itk::Point< double > > FiberType
itk::Image< unsigned char, 3 > ItkUcharImgType
void BuildFibers(bool check)
SimpleFastMutexLock m_Mutex
Superclass::InputImageType InputImageType
double m_AngularThreshold
itk::Image< double, 3 > ItkDoubleImgType
itk::Image< float, 3 > ItkFloatImgType
std::chrono::time_point< std::chrono::system_clock > m_StartTime
void BeforeThreadedGenerateData() override
bool m_BuildFibersFinished
PolyDataType m_FiberPolyData
ItkUcharImgType::Pointer m_StoppingRegions
double RoundToNearest(double num)
SmartPointer< Self > Pointer