ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkComposeDisplacementFieldsImageFilter.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 itkComposeDisplacementFieldsImageFilter_h
19 #define itkComposeDisplacementFieldsImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
23 
24 namespace itk
25 {
26 
39 template <typename TInputImage, typename TOutputImage = TInputImage>
40 class ITK_TEMPLATE_EXPORT ComposeDisplacementFieldsImageFilter
41  : public ImageToImageFilter<TInputImage, TOutputImage>
42 {
43 public:
48 
50  itkNewMacro( Self );
51 
53  itkStaticConstMacro( ImageDimension, unsigned int,
54  TInputImage::ImageDimension );
55 
56  typedef TInputImage InputFieldType;
57  typedef TOutputImage OutputFieldType;
58 
60  typedef typename OutputFieldType::PixelType PixelType;
61  typedef typename OutputFieldType::PixelType VectorType;
62  typedef typename OutputFieldType::RegionType RegionType;
64 
66  typedef typename OutputFieldType::SpacingType SpacingType;
70 
72  typedef typename VectorType::ComponentType RealType;
75 
77  itkGetModifiableObjectMacro( Interpolator, InterpolatorType );
78 
80  void SetDisplacementField( const InputFieldType *field )
81  {
82  itkDebugMacro( "setting displacement field to " << field );
83  if ( field != this->GetInput( 0 ) )
84  {
85  this->SetInput( 0, field );
86  this->Modified();
87  if( !this->m_Interpolator.IsNull() )
88  {
89  this->m_Interpolator->SetInputImage( field );
90  }
91  }
92  }
94 
99  {
100  return this->GetInput( 0 );
101  }
102 
104  void SetWarpingField( const InputFieldType *field )
105  {
106  itkDebugMacro( "setting warping field to " << field );
107  if ( field != this->GetInput( 1 ) )
108  {
109  this->SetInput( 1, field );
110  }
111  }
113 
118  {
119  return this->GetInput( 1 );
120  }
121 
122  /* Set the interpolator. */
123  virtual void SetInterpolator( InterpolatorType* interpolator );
124 
125 protected:
126 
129 
131  virtual ~ComposeDisplacementFieldsImageFilter() ITK_OVERRIDE;
132 
134  void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE;
135 
137  void BeforeThreadedGenerateData() ITK_OVERRIDE;
138 
140  void ThreadedGenerateData( const RegionType &, ThreadIdType ) ITK_OVERRIDE;
141 
142 private:
143  ITK_DISALLOW_COPY_AND_ASSIGN(ComposeDisplacementFieldsImageFilter);
144 
146  typename InterpolatorType::Pointer m_Interpolator;
147 
148 };
149 
150 } // end namespace itk
151 
152 #ifndef ITK_MANUAL_INSTANTIATION
153 #include "itkComposeDisplacementFieldsImageFilter.hxx"
154 #endif
155 
156 #endif
Base class for all process objects that output image data.
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
VectorInterpolateImageFunction< InputFieldType, RealType > InterpolatorType
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for all vector image interpolaters.
ImageToImageFilter< TInputImage, TOutputImage > Superclass