Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
itkTractsToVectorImageFilter.h
Go to the documentation of this file.
1 #ifndef __itkTractsToVectorImageFilter_h__
2 #define __itkTractsToVectorImageFilter_h__
3 
4 // MITK
5 #include <mitkFiberBundle.h>
6 
7 // ITK
8 #include <itkImageSource.h>
9 #include <itkVectorImage.h>
10 
11 // VTK
12 #include <vtkSmartPointer.h>
13 #include <vtkPolyData.h>
14 #include <vtkCellArray.h>
15 #include <vtkPoints.h>
16 #include <vtkPolyLine.h>
17 
18 using namespace mitk;
19 
20 namespace itk{
21 
25 template< class PixelType >
26 class TractsToVectorImageFilter : public ImageSource< VectorImage< float, 3 > >
27 {
28 
29 public:
31  typedef ProcessObject Superclass;
34 
35  typedef itk::Vector<float,3> OutputVectorType;
36  typedef itk::Image<OutputVectorType, 3> OutputImageType;
37  typedef std::vector< OutputImageType::Pointer > OutputImageContainerType;
38 
39  typedef vnl_vector_fixed< double, 3 > DirectionType;
40  typedef VectorContainer< unsigned int, DirectionType > DirectionContainerType;
41  typedef VectorContainer< unsigned int, DirectionContainerType::Pointer > ContainerType;
43  typedef VectorContainer< unsigned int, ItkDirectionImageType::Pointer > DirectionImageContainerType;
44  typedef itk::Image<unsigned char, 3> ItkUcharImgType;
45  typedef itk::Image<double, 3> ItkDoubleImgType;
46 
47  itkFactorylessNewMacro(Self)
48  itkCloneMacro(Self)
49  itkTypeMacro( TractsToVectorImageFilter, ImageSource )
50 
51  itkSetMacro( SizeThreshold, float)
52  itkGetMacro( SizeThreshold, float)
53  itkSetMacro( AngularThreshold, float)
54  itkGetMacro( AngularThreshold, float)
55  itkSetMacro( NormalizeVectors, bool)
56  itkGetMacro( NormalizeVectors, bool)
57  itkSetMacro( UseWorkingCopy, bool)
58  itkGetMacro( UseWorkingCopy, bool)
59  itkSetMacro( MaxNumDirections, unsigned long)
60  itkGetMacro( MaxNumDirections, unsigned long)
61  itkSetMacro( MaskImage, ItkUcharImgType::Pointer)
62  itkSetMacro( FiberBundle, FiberBundle::Pointer)
63  itkGetMacro( ClusteredDirectionsContainer, ContainerType::Pointer)
64  itkGetMacro( NumDirectionsImage, ItkUcharImgType::Pointer)
65  itkGetMacro( OutputFiberBundle, FiberBundle::Pointer)
66  itkGetMacro( DirectionImageContainer, DirectionImageContainerType::Pointer)
67  itkSetMacro( CreateDirectionImages, bool)
68 
69  void GenerateData() override;
70 
71 protected:
72 
73  DirectionContainerType::Pointer FastClustering(DirectionContainerType::Pointer inDirs, std::vector< double > lengths);
74 // std::vector< DirectionType > Clustering(std::vector< DirectionType >& inDirs);
75 // DirectionContainerType::Pointer MeanShiftClustering(DirectionContainerType::Pointer dirCont);
76 // vnl_vector_fixed<double, 3> ClusterStep(DirectionContainerType::Pointer dirCont, vnl_vector_fixed<double, 3> currentMean);
77 
78  vnl_vector_fixed<double, 3> GetVnlVector(double point[3]);
79  itk::Point<double, 3> GetItkPoint(double point[3]);
80 
81 
82  TractsToVectorImageFilter();
83  virtual ~TractsToVectorImageFilter();
84 
85  FiberBundle::Pointer m_FiberBundle;
86  float m_AngularThreshold;
87  float m_Epsilon;
88  ItkUcharImgType::Pointer m_MaskImage;
89  bool m_NormalizeVectors;
90  itk::Vector<float> m_OutImageSpacing;
91  ContainerType::Pointer m_DirectionsContainer;
92  bool m_UseWorkingCopy;
93  unsigned long m_MaxNumDirections;
94  float m_SizeThreshold;
95  bool m_CreateDirectionImages;
96 
97  // output datastructures
98  ContainerType::Pointer m_ClusteredDirectionsContainer;
99  ItkUcharImgType::Pointer m_NumDirectionsImage;
100  DirectionImageContainerType::Pointer m_DirectionImageContainer;
101  FiberBundle::Pointer m_OutputFiberBundle;
102 };
103 
104 }
105 
106 #ifndef ITK_MANUAL_INSTANTIATION
108 #endif
109 
110 #endif // __itkTractsToVectorImageFilter_h__
Superclass of all classes generating Images (instances of class Image) as output. ...
STL namespace.
DataCollection - Class to facilitate loading/accessing structured data.
vnl_vector_fixed< double, 3 > DirectionType
itk::Image< OutputVectorType, 3 > OutputImageType
Image class for storing images.
Definition: mitkImage.h:76
Base Class for Fiber Bundles;.
VectorContainer< unsigned int, ItkDirectionImageType::Pointer > DirectionImageContainerType
std::vector< OutputImageType::Pointer > OutputImageContainerType
itk::Image< unsigned char, 3 > ItkUcharImgType
Image< Vector< float, 3 >, 3 > ItkDirectionImageType
VectorContainer< unsigned int, DirectionContainerType::Pointer > ContainerType
Extracts the voxel-wise main directions of the input fiber bundle.
VectorContainer< unsigned int, DirectionType > DirectionContainerType