ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkInvertDisplacementFieldImageFilter.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 itkInvertDisplacementFieldImageFilter_h
19 #define itkInvertDisplacementFieldImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
24 #include "itkSimpleFastMutexLock.h"
25 
26 namespace itk
27 {
28 
40 template <typename TInputImage, typename TOutputImage = TInputImage>
42  : public ImageToImageFilter<TInputImage, TOutputImage>
43 {
44 public:
49 
51  itkNewMacro( Self );
52 
54  itkStaticConstMacro( ImageDimension, unsigned int, TInputImage::ImageDimension );
55 
56  typedef TInputImage InputFieldType;
57  typedef TOutputImage OutputFieldType;
58 
61 
63  typedef typename OutputFieldType::PixelType PixelType;
64  typedef typename OutputFieldType::PixelType VectorType;
65  typedef typename OutputFieldType::RegionType RegionType;
66  typedef typename OutputFieldType::IndexType IndexType;
67 
68  typedef typename OutputFieldType::PointType PointType;
69  typedef typename OutputFieldType::SpacingType SpacingType;
70  typedef typename OutputFieldType::PointType OriginType;
71  typedef typename OutputFieldType::SizeType SizeType;
72  typedef typename OutputFieldType::DirectionType DirectionType;
73 
75  typedef typename VectorType::ComponentType RealType;
80 
82  itkGetModifiableObjectMacro( Interpolator, InterpolatorType );
83 
85  void SetDisplacementField( const InputFieldType *field )
86  {
87  itkDebugMacro( "setting deformation field to " << field );
88  if ( field != this->GetInput( 0 ) )
89  {
90  this->SetInput( 0, field );
91  this->Modified();
92  if( ! this->m_Interpolator.IsNull() )
93  {
94  this->m_Interpolator->SetInputImage( field );
95  }
96  }
97  }
99 
104  {
105  return this->GetInput( 0 );
106  }
107 
109  itkSetInputMacro( InverseFieldInitialEstimate, InverseDisplacementFieldType );
110  itkGetInputMacro( InverseFieldInitialEstimate, InverseDisplacementFieldType );
112 
113  /* Set the interpolator. */
114  virtual void SetInterpolator( InterpolatorType* interpolator );
115 
116  /* Set/Get the number of iterations */
117  itkSetMacro( MaximumNumberOfIterations, unsigned int );
118  itkGetConstMacro( MaximumNumberOfIterations, unsigned int );
119 
120  /* Set/Get the mean stopping criterion */
121  itkSetMacro( MeanErrorToleranceThreshold, RealType );
122  itkGetConstMacro( MeanErrorToleranceThreshold, RealType );
123 
124  /* Set/Get the max stopping criterion */
125  itkSetMacro( MaxErrorToleranceThreshold, RealType );
126  itkGetConstMacro( MaxErrorToleranceThreshold, RealType );
127 
128  /* Get the max norm */
129  itkGetConstMacro( MaxErrorNorm, RealType );
130 
131  /* Get the mean norm */
132  itkGetConstMacro( MeanErrorNorm, RealType );
133 
134 /* Should we force the boundary to have zero displacement? */
135  itkSetMacro( EnforceBoundaryCondition, bool );
136  itkGetMacro( EnforceBoundaryCondition, bool );
137 
138 protected:
139 
142 
145 
147  void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE;
148 
150  void GenerateData() ITK_OVERRIDE;
151 
153  void ThreadedGenerateData( const RegionType &, ThreadIdType ) ITK_OVERRIDE;
154 
155 private:
156  InvertDisplacementFieldImageFilter( const Self& ); //purposely not implemented
157  void operator=( const Self& ); //purposely not implemented
158 
161 
163 
166 
167  // internal ivars necessary for multithreading basic operations
168 
171 
179 
180 };
181 
182 } // end namespace itk
183 
184 #ifndef ITK_MANUAL_INSTANTIATION
185 #include "itkInvertDisplacementFieldImageFilter.hxx"
186 #endif
187 
188 #endif
Critical section locking class that can be allocated on the stack.
ImageToImageFilter< TInputImage, TOutputImage > Superclass
VectorInterpolateImageFunction< InputFieldType, RealType > InterpolatorType
VectorLinearInterpolateImageFunction< InputFieldType, RealType > DefaultInterpolatorType
Base class for all process objects that output image data.
void PrintSelf(std::ostream &os, Indent indent) const override
virtual void SetInput(const InputImageType *image)
virtual void SetInterpolator(InterpolatorType *interpolator)
const InputImageType * GetInput() const
virtual void Modified() const
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
bool IsNull() const
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.
Iteratively estimate the inverse field of a displacement field.
Templated n-dimensional image class.
Definition: itkImage.h:75
Linearly interpolate a vector image at specified positions.
void ThreadedGenerateData(const RegionType &, ThreadIdType) override