ITK  5.0.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:
44  ITK_DISALLOW_COPY_AND_ASSIGN(ComposeDisplacementFieldsImageFilter);
45 
50 
52  itkNewMacro( Self );
53 
55  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
56 
57  using InputFieldType = TInputImage;
58  using OutputFieldType = TOutputImage;
59 
61  using PixelType = typename OutputFieldType::PixelType;
62  using VectorType = typename OutputFieldType::PixelType;
65 
67  using SpacingType = typename OutputFieldType::SpacingType;
71 
73  using RealType = typename VectorType::ComponentType;
76 
78  itkGetModifiableObjectMacro( Interpolator, InterpolatorType );
79 
81  void SetDisplacementField( const InputFieldType *field )
82  {
83  itkDebugMacro( "setting displacement field to " << field );
84  if ( field != this->GetInput( 0 ) )
85  {
86  this->SetInput( 0, field );
87  this->Modified();
88  if( !this->m_Interpolator.IsNull() )
89  {
90  this->m_Interpolator->SetInputImage( field );
91  }
92  }
93  }
95 
100  {
101  return this->GetInput( 0 );
102  }
103 
105  void SetWarpingField( const InputFieldType *field )
106  {
107  itkDebugMacro( "setting warping field to " << field );
108  if ( field != this->GetInput( 1 ) )
109  {
110  this->SetInput( 1, field );
111  }
112  }
114 
119  {
120  return this->GetInput( 1 );
121  }
122 
123  /* Set the interpolator. */
124  virtual void SetInterpolator( InterpolatorType* interpolator );
125 
126 protected:
127 
130 
132  ~ComposeDisplacementFieldsImageFilter() override = default;
133 
135  void PrintSelf( std::ostream& os, Indent indent ) const override;
136 
138  void BeforeThreadedGenerateData() override;
139 
141  void DynamicThreadedGenerateData( const RegionType & ) override;
142 
143 
144 private:
147 
148 };
149 
150 } // end namespace itk
151 
152 #ifndef ITK_MANUAL_INSTANTIATION
153 #include "itkComposeDisplacementFieldsImageFilter.hxx"
154 #endif
155 
156 #endif
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
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.