Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
itkResampleDwiImageFilter.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/itkResampleDwiImageFilter.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_ResampleDwiImageFilter_h_
33 #define _itk_ResampleDwiImageFilter_h_
34 
35 #include <itkImageToImageFilter.h>
36 #include <itkVectorImage.h>
37 #include <itkPointShell.h>
38 
39 namespace itk
40 {
41 
45 template <class TScalarType>
47  : public ImageToImageFilter<itk::VectorImage<TScalarType,3>, itk::VectorImage<TScalarType,3> >
48 {
49 
50 public:
51 
57  };
58 
62  typedef ImageToImageFilter< itk::VectorImage<TScalarType,3>, itk::VectorImage<TScalarType,3> >
64 
65  typedef itk::Vector< double, 3 > DoubleVectorType;
66  typedef itk::VectorImage<TScalarType,3> DwiImageType;
67  typedef itk::Image<TScalarType,3> DwiChannelType;
68 
70  itkFactorylessNewMacro(Self)
71  itkCloneMacro(Self)
72 
74  itkTypeMacro(ResampleDwiImageFilter, ImageToImageFilter)
75 
76  itkSetMacro( Interpolation, Interpolation )
77 
78  void SetSamplingFactor(DoubleVectorType sampling)
79  {
80  m_NewSpacing = this->GetInput()->GetSpacing();
81  m_NewSpacing[0] /= sampling[0];
82  m_NewSpacing[1] /= sampling[1];
83  m_NewSpacing[2] /= sampling[2];
84  m_NewImageRegion = this->GetInput()->GetLargestPossibleRegion();
85  m_NewImageRegion.SetSize(0, m_NewImageRegion.GetSize(0)*sampling[0]);
86  m_NewImageRegion.SetSize(1, m_NewImageRegion.GetSize(1)*sampling[1]);
87  m_NewImageRegion.SetSize(2, m_NewImageRegion.GetSize(2)*sampling[2]);
88  }
89  void SetNewSpacing(DoubleVectorType spacing)
90  {
91  DoubleVectorType oldSpacing = this->GetInput()->GetSpacing();
92  DoubleVectorType sampling;
93  sampling[0] = oldSpacing[0]/spacing[0];
94  sampling[1] = oldSpacing[1]/spacing[1];
95  sampling[2] = oldSpacing[2]/spacing[2];
96 
97  m_NewSpacing = spacing;
98  m_NewImageRegion = this->GetInput()->GetLargestPossibleRegion();
99  m_NewImageRegion.SetSize(0, m_NewImageRegion.GetSize(0)*sampling[0]);
100  m_NewImageRegion.SetSize(1, m_NewImageRegion.GetSize(1)*sampling[1]);
101  m_NewImageRegion.SetSize(2, m_NewImageRegion.GetSize(2)*sampling[2]);
102  }
103  void SetNewImageSize(ImageRegion<3> region)
104  {
105  ImageRegion<3> oldRegion = this->GetInput()->GetLargestPossibleRegion();
106  DoubleVectorType sampling;
107  sampling[0] = (double)region.GetSize(0)/oldRegion.GetSize(0);
108  sampling[1] = (double)region.GetSize(1)/oldRegion.GetSize(1);
109  sampling[2] = (double)region.GetSize(2)/oldRegion.GetSize(2);
110 
111  m_NewImageRegion = region;
112  m_NewSpacing = this->GetInput()->GetSpacing();
113  m_NewSpacing[0] /= sampling[0];
114  m_NewSpacing[1] /= sampling[1];
115  m_NewSpacing[2] /= sampling[2];
116  }
117 
118  virtual void UpdateOutputInformation();
119 
120  virtual void PropagateRequestedRegion(){}
121 
122  virtual void PropagateRequestedRegion(itk::DataObject *output){}
123 
124  virtual void VerifyInputInformation(){}
125 
126  protected:
129 
130  void GenerateData();
131 
132  DoubleVectorType m_NewSpacing;
133  ImageRegion<3> m_NewImageRegion;
135 };
136 
137 
138 } // end of namespace
139 
140 
141 #ifndef ITK_MANUAL_INSTANTIATION
143 #endif
144 
145 
146 #endif
virtual void UpdateOutputInformation()
itk::Vector< double, 3 > DoubleVectorType
SmartPointer< const Self > ConstPointer
itk::VectorImage< TScalarType, 3 > DwiImageType
virtual void PropagateRequestedRegion(itk::DataObject *output)
itk::Image< TScalarType, 3 > DwiChannelType
Resample DWI channel by channel.
void SetNewSpacing(DoubleVectorType spacing)
void SetSamplingFactor(DoubleVectorType sampling)
void SetNewImageSize(ImageRegion< 3 > region)
ImageToImageFilter< itk::VectorImage< TScalarType, 3 >, itk::VectorImage< TScalarType, 3 > > Superclass