Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
itkResidualImageFilter.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 /*=========================================================================
17 
18 Program: Tensor ToolKit - TTK
19 Module: $URL: svn://scm.gforge.inria.fr/svn/ttk/trunk/Algorithms/itkTensorImageToDiffusionImageFilter.h $
20 Language: C++
21 Date: $Date: 2010-06-07 13:39:13 +0200 (Mo, 07 Jun 2010) $
22 Version: $Revision: 68 $
23 
24 Copyright (c) INRIA 2010. All rights reserved.
25 See LICENSE.txt for details.
26 
27 This software is distributed WITHOUT ANY WARRANTY; without even
28 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
29 PURPOSE. See the above copyright notices for more information.
30 
31 =========================================================================*/
32 #ifndef _itk_ResidualImageFilter_h_
33 #define _itk_ResidualImageFilter_h_
34 
35 #include "itkImageToImageFilter.h"
36 #include <itkDiffusionTensor3D.h>
37 
38 
39 namespace itk
40 {
41 
42  template <class TInputScalarType, class TOutputScalarType>
44  : public ImageToImageFilter<itk::VectorImage<TInputScalarType,3>, itk::Image<TOutputScalarType,3> >
45  {
46 
47  public:
48 
49  typedef TInputScalarType InputScalarType;
50  typedef itk::VectorImage<InputScalarType,3> InputImageType;
52  typedef typename InputImageType::RegionType InputImageRegionType;
53 
54  typedef TOutputScalarType OutputScalarType;
55  typedef itk::Image<OutputScalarType,3> OutputImageType;
57  typedef typename OutputImageType::RegionType OutputImageRegionType;
58 
60  typedef ImageToImageFilter<InputImageType, OutputImageType> Superclass;
61 
64 
65  typedef vnl_vector_fixed< double, 3 > GradientDirectionType;
66  typedef itk::VectorContainer< unsigned int,
67  GradientDirectionType > GradientDirectionContainerType;
68 
69 
70  typedef itk::Image<InputScalarType,3> BaselineImageType;
71 
72  itkTypeMacro (ResidualImageFilter, ImageToImageFilter);
73 
74  itkStaticConstMacro (ImageDimension, unsigned int,
75  OutputImageType::ImageDimension);
76 
77  itkFactorylessNewMacro(Self)
78  itkCloneMacro(Self)
79 
80  void SetSecondDiffusionImage(typename InputImageType::Pointer diffImage)
81  {
82  m_SecondDiffusionImage = diffImage;
83  }
84 
85 
86  std::vector<double> GetQ1()
87  {
88  return m_Q1;
89  }
90 
91  std::vector<double> GetQ3()
92  {
93  return m_Q3;
94  }
95 
96  std::vector<double> GetMeans()
97  {
98  return m_Means;
99  }
100 
101  std::vector<double> GetPercentagesOfOutliers()
102  {
103  return m_PercentagesOfOutliers;
104  }
105 
106  std::vector< std::vector<double> > GetOutliersPerSlice()
107  {
108  return m_OutliersPerSlice;
109  }
110 
111  void SetGradients(GradientDirectionContainerType* grads)
112  {
113  m_Gradients = grads;
114  }
115 
116  void SetBaseLineImage(BaselineImageType* baseline)
117  {
118  m_BaseLineImage = baseline;
119  }
120 
121  void SetB0Threshold(InputScalarType threshold)
122  {
123  m_B0Threshold = threshold;
124  }
125 
126  itkSetMacro(B0Index, int)
127 
128 
129  protected:
131  {
132  m_B0Threshold = 30.0; // default value. allow user to redefine
133  };
135 
136  void PrintSelf (std::ostream& os, Indent indent) const
137  {
138  Superclass::PrintSelf (os, indent);
139  }
140 
141 
142  void GenerateData();
143 
144  private:
145 
146  ResidualImageFilter (const Self&);
147  void operator=(const Self&);
148 
149  typename InputImageType::Pointer m_SecondDiffusionImage;
150 
151  std::vector<double> m_Means, m_Q1, m_Q3, m_PercentagesOfOutliers;
152 
153 
154 
155  // 'Outer' vector: slices, 'Inner' volumes
156  std::vector< std::vector<double> > m_OutliersPerSlice;
157 
158  GradientDirectionContainerType* m_Gradients;
159 
160  typename BaselineImageType::Pointer m_BaseLineImage;
161 
162  InputScalarType m_B0Threshold;
163 
164  int m_B0Index;
165 
166  };
167 
168 
169 } // end of namespace
170 
171 
172 #ifndef ITK_MANUAL_INSTANTIATION
174 #endif
175 
176 
177 #endif
void SetGradients(GradientDirectionContainerType *grads)
std::vector< double > GetQ3()
itk::SmartPointer< Self > Pointer
itk::VectorImage< InputScalarType, 3 > InputImageType
itk::Image< OutputScalarType, 3 > OutputImageType
void SetBaseLineImage(BaselineImageType *baseline)
OutputImageType::PixelType OutputPixelType
itk::VectorContainer< unsigned int, GradientDirectionType > GradientDirectionContainerType
ImageToImageFilter< InputImageType, OutputImageType > Superclass
TOutputScalarType OutputScalarType
std::vector< std::vector< double > > GetOutliersPerSlice()
itk::Image< InputScalarType, 3 > BaselineImageType
InputImageType::RegionType InputImageRegionType
std::vector< double > GetMeans()
itkStaticConstMacro(ImageDimension, unsigned int, OutputImageType::ImageDimension)
std::vector< double > GetPercentagesOfOutliers()
SmartPointer< const Self > ConstPointer
InputImageType::PixelType InputPixelType
void PrintSelf(std::ostream &os, Indent indent) const
std::vector< double > GetQ1()
SmartPointer< Self > Pointer
unsigned short PixelType
void SetSecondDiffusionImage(typename InputImageType::Pointer diffImage)
vnl_vector_fixed< double, 3 > GradientDirectionType
OutputImageType::RegionType OutputImageRegionType
void SetB0Threshold(InputScalarType threshold)