Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
itkFiniteDiffOdfMaximaExtractionFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkDiffusionTensor3DReconstructionImageFilter.h,v $
5  Language: C++
6  Date: $Date: 2006-03-27 17:01:06 $
7  Version: $Revision: 1.12 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkFiniteDiffOdfMaximaExtractionFilter_h_
18 #define __itkFiniteDiffOdfMaximaExtractionFilter_h_
19 
20 #include "itkImageToImageFilter.h"
21 #include "vnl/vnl_vector_fixed.h"
22 #include "vnl/vnl_matrix.h"
23 #include "vnl/algo/vnl_svd.h"
24 #include "itkVectorContainer.h"
25 #include "itkVectorImage.h"
26 #include <mitkFiberBundle.h>
28 
29 namespace itk{
30 
36 template< class PixelType, int ShOrder, int NrOdfDirections >
38  public ImageToImageFilter< Image< Vector< PixelType, (ShOrder*ShOrder + ShOrder + 2)/2 + ShOrder >, 3 >,
39 Image< Vector< PixelType, 3 >, 3 > >
40 {
41 
42  public:
43 
44  enum Toolkit {
45  FSL,
47  };
48 
53  };
54 
58  typedef ImageToImageFilter< Image< Vector< PixelType, (ShOrder*ShOrder + ShOrder + 2)/2 + ShOrder >, 3 >,
59  Image< Vector< PixelType, 3 >, 3 > > Superclass;
60 
62  itkFactorylessNewMacro(Self)
63  itkCloneMacro(Self)
64 
66  itkTypeMacro(FiniteDiffOdfMaximaExtractionFilter, ImageToImageFilter)
67 
69  typedef typename CoefficientImageType::RegionType CoefficientImageRegionType;
70  typedef typename CoefficientImageType::PixelType CoefficientPixelType;
71 
74 
75  typedef OrientationDistributionFunction<PixelType, NrOdfDirections> OdfType;
76  typedef itk::Image<unsigned char, 3> ItkUcharImgType;
77 
78  typedef vnl_vector_fixed< double, 3 > DirectionType;
79  typedef Image< Vector< float, 3 >, 3> ItkDirectionImage;
80  typedef VectorContainer< unsigned int, ItkDirectionImage::Pointer > ItkDirectionImageContainer;
81 
82  // input
83  itkSetMacro( MaxNumPeaks, unsigned int)
84  itkSetMacro( PeakThreshold, double)
85  itkSetMacro( AbsolutePeakThreshold, double)
86  itkSetMacro( ClusteringThreshold, double)
87  itkSetMacro( AngularThreshold, double)
88  itkSetMacro( MaskImage, ItkUcharImgType::Pointer)
89  itkSetMacro( NormalizationMethod, NormalizationMethods)
90  itkSetMacro( FlipX, bool)
91  itkSetMacro( FlipY, bool)
92  itkSetMacro( FlipZ, bool)
93 
94  // output
95  itkGetMacro( OutputFiberBundle, mitk::FiberBundle::Pointer)
96  itkGetMacro( DirectionImageContainer, ItkDirectionImageContainer::Pointer)
97  itkGetMacro( NumDirectionsImage, ItkUcharImgType::Pointer)
98 
99  itkSetMacro( Toolkit, Toolkit)
100  itkGetMacro( Toolkit, Toolkit)
101 
102  protected:
103  FiniteDiffOdfMaximaExtractionFilter();
104  ~FiniteDiffOdfMaximaExtractionFilter(){}
105 
107  void ThreadedGenerateData( const OutputImageRegionType &outputRegionForThread, ThreadIdType threadID );
109 
111  void FindCandidatePeaks(OdfType& odf, double odfMax, std::vector< DirectionType >& inDirs);
112 
114  std::vector< DirectionType > MeanShiftClustering(std::vector< DirectionType >& inDirs);
115 
117  void Cart2Sph(const std::vector< DirectionType >& dir, vnl_matrix<double>& sphCoords);
118 
120  vnl_matrix<double> CalcShBasis(vnl_matrix<double>& sphCoords);
121 
122  private:
123 
124  NormalizationMethods m_NormalizationMethod;
125  unsigned int m_MaxNumPeaks;
126  double m_PeakThreshold;
127  double m_AbsolutePeakThreshold;
128  vnl_matrix< double > m_ShBasis;
129  double m_ClusteringThreshold;
130  double m_AngularThreshold;
131  const int m_NumCoeffs;
132 
133  mitk::FiberBundle::Pointer m_OutputFiberBundle;
134  ItkDirectionImageContainer::Pointer m_DirectionImageContainer;
135  ItkUcharImgType::Pointer m_NumDirectionsImage;
136  ItkUcharImgType::Pointer m_MaskImage;
137 
138  Toolkit m_Toolkit;
139  bool m_FlipX;
140  bool m_FlipY;
141  bool m_FlipZ;
142 };
143 
144 }
145 
146 #ifndef ITK_MANUAL_INSTANTIATION
148 #endif
149 
150 #endif //__itkFiniteDiffOdfMaximaExtractionFilter_h_
151 
vnl_matrix< double > CalcShBasis(vnl_matrix< double > &sphCoords)
itk::SmartPointer< Self > Pointer
SH coefficient convention (depends on toolkit)
Extract ODF peaks by searching all local maxima on a densely sampled ODF und clustering these maxima ...
DataCollection - Class to facilitate loading/accessing structured data.
normalize all peaks according to their length in comparison to the largest peak (0-1) ...
std::vector< DirectionType > MeanShiftClustering(std::vector< DirectionType > &inDirs)
void FindCandidatePeaks(OdfType &odf, double odfMax, std::vector< DirectionType > &inDirs)
class ITK_EXPORT Image
Represents an ODF for Q-Ball imaging.
VectorContainer< unsigned int, ItkDirectionImage::Pointer > ItkDirectionImageContainer
ImageToImageFilter< Image< Vector< PixelType,(ShOrder *ShOrder+ShOrder+2)/2+ShOrder >, 3 >, Image< Vector< PixelType, 3 >, 3 > > Superclass
itk::Image< double, 3 > InputImageType
void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadID)
OrientationDistributionFunction< PixelType, NrOdfDirections > OdfType
void Cart2Sph(const std::vector< DirectionType > &dir, vnl_matrix< double > &sphCoords)
unsigned short PixelType