Orfeo Toolbox  4.2
itkDiffusionTensor3DReconstructionImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkDiffusionTensor3DReconstructionImageFilter_h
19 #define __itkDiffusionTensor3DReconstructionImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "itkSpatialObject.h"
23 #include "itkDiffusionTensor3D.h"
24 #include "vnl/vnl_matrix.h"
25 #include "vnl/vnl_vector_fixed.h"
26 #include "vnl/vnl_matrix_fixed.h"
27 #include "vnl/algo/vnl_svd.h"
28 #include "itkVectorContainer.h"
29 #include "itkVectorImage.h"
30 
31 namespace itk
32 {
123 template< typename TReferenceImagePixelType,
124  typename TGradientImagePixelType = TReferenceImagePixelType,
125  typename TTensorPixelType = double,
126  typename TMaskImageType = Image<unsigned char, 3> >
128  public ImageToImageFilter< Image< TReferenceImagePixelType, 3 >,
129  Image< DiffusionTensor3D< TTensorPixelType >, 3 > >
130 {
131 public:
132 
139 
141  itkNewMacro(Self);
142 
146 
147  typedef TReferenceImagePixelType ReferencePixelType;
148 
149  typedef TGradientImagePixelType GradientPixelType;
150 
152 
156 
158 
160 
161  typedef typename Superclass::OutputImageRegionType
163 
166 
172 
175 
177  typedef TMaskImageType MaskImageType;
178 
180  typedef vnl_matrix_fixed< double, 6, 6 > TensorBasisMatrixType;
181 
182  typedef vnl_matrix< double > CoefficientMatrixType;
183 
185  typedef vnl_vector_fixed< double, 3 > GradientDirectionType;
186 
188  typedef VectorContainer< unsigned int,
190 
192  void AddGradientImage(const GradientDirectionType &, const GradientImageType *image);
193  const GradientImageType *GetGradientImage(unsigned index) const;
194 
202  const GradientImagesType *image);
203 
205  void SetReferenceImage(ReferenceImageType *referenceImage)
206  {
208  {
209  itkExceptionMacro(<< "Cannot call both methods:"
210  << "AddGradientImage and SetGradientImage. Please call only one of them.");
211  }
212 
213  this->ProcessObject::SetNthInput(0, referenceImage);
214 
216  }
217 
220  { return ( static_cast< ReferenceImageType * >( this->ProcessObject::GetInput(0) ) ); }
221 
223  virtual GradientDirectionType GetGradientDirection(unsigned int idx) const
224  {
225  if ( idx >= m_NumberOfGradientDirections )
226  {
227  itkExceptionMacro(<< "Gradient direction " << idx << "does not exist");
228  }
229  return m_GradientDirectionContainer->ElementAt(idx + 1);
230  }
231 
233  void SetMaskImage(MaskImageType *maskImage);
235  void SetMaskSpatialObject(MaskSpatialObjectType *maskSpatialObject);
236 
237 
241  itkSetMacro(Threshold, ReferencePixelType);
242  itkGetConstMacro(Threshold, ReferencePixelType);
243 
250  itkSetMacro(BValue, TTensorPixelType);
251 #ifdef GetBValue
252 #undef GetBValue
253 #endif
254  itkGetConstReferenceMacro(BValue, TTensorPixelType);
255 
256 #ifdef ITK_USE_CONCEPT_CHECKING
257  // Begin concept checking
258  itkConceptMacro( ReferenceEqualityComparableCheck,
260  itkConceptMacro( TensorEqualityComparableCheck,
262  itkConceptMacro( GradientConvertibleToDoubleCheck,
264  itkConceptMacro( DoubleConvertibleToTensorCheck,
266  itkConceptMacro( GradientReferenceAdditiveOperatorsCheck,
268  ReferencePixelType > ) );
269  itkConceptMacro( GradientReferenceAdditiveAndAssignOperatorsCheck,
271  ReferencePixelType > ) );
272 
273  itkConceptMacro( ReferenceOStreamWritableCheck,
275  itkConceptMacro( TensorOStreamWritableCheck,
277  // End concept checking
278 #endif
279 
280 protected:
283  void PrintSelf(std::ostream & os, Indent indent) const;
284 
285  void ComputeTensorBasis();
286 
288 
289  void ThreadedGenerateData(const
290  OutputImageRegionType & outputRegionForThread, ThreadIdType);
291 
294  typedef enum {
299 
300 private:
301 
302  /* Tensor basis coeffs */
304 
306 
309 
312 
315 
318 
320  TTensorPixelType m_BValue;
321 
324 
327 };
328 }
329 
330 #ifndef ITK_MANUAL_INSTANTIATION
332 #endif
333 
334 #endif

Generated at Sat Aug 30 2014 14:34:31 for Orfeo Toolbox with doxygen 1.8.3.1