ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkVariationalRegistrationFilter.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 itkVariationalRegistrationFilter_h
19 #define itkVariationalRegistrationFilter_h
20 
22 #include "itkMultiThreader.h"
23 
28 
29 namespace itk {
30 
101 template< class TFixedImage, class TMovingImage, class TDisplacementField >
103  : public DenseFiniteDifferenceImageFilter< TDisplacementField, TDisplacementField >
104 {
105 public:
109  TDisplacementField, TDisplacementField > Superclass;
112 
114  itkNewMacro(Self);
115 
117  itkTypeMacro(itkVariationalRegistrationFilter, DenseFiniteDifferenceImageFilter );
118 
120  itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
121 
123  typedef TFixedImage FixedImageType;
124  typedef typename FixedImageType::Pointer FixedImagePointer;
125  typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
126 
128  typedef TMovingImage MovingImageType;
129  typedef typename MovingImageType::Pointer MovingImagePointer;
130  typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
131 
133  typedef TDisplacementField DisplacementFieldType;
134  typedef typename DisplacementFieldType::Pointer DisplacementFieldPointer;
135 
137  typedef unsigned char MaskImagePixelType;
142 
145 
148 
154 
161 
163  itkSetObjectMacro( Regularizer, RegularizerType );
164 
166  itkGetConstReferenceObjectMacro( Regularizer, RegularizerType );
167 
169  virtual void SetFixedImage( const FixedImageType * ptr );
170 
172  virtual const FixedImageType * GetFixedImage(void) const;
173 
175  virtual void SetMovingImage( const MovingImageType * ptr );
176 
178  virtual const MovingImageType * GetMovingImage(void) const;
179 
181  virtual void SetMaskImage( const MaskImageType * ptr );
182 
184  virtual const MaskImageType * GetMaskImage(void) const;
185 
188  { this->SetInput( ptr ); }
189 
192  { return this->GetOutput(); }
193 
198  virtual std::vector<SmartPointer<DataObject> >::size_type GetNumberOfValidRequiredInputs() const ITK_OVERRIDE;
199 
204  itkBooleanMacro( SmoothDisplacementField );
205 
210  itkSetMacro( SmoothDisplacementField, bool );
211 
215  itkGetConstMacro( SmoothDisplacementField, bool );
216 
220  itkSetMacro( SmoothUpdateField, bool );
221 
226  itkGetConstMacro( SmoothUpdateField, bool );
227 
231  itkBooleanMacro( SmoothUpdateField );
232 
237  virtual double GetMetric() const;
238 
240  virtual void StopRegistration()
241  { m_StopRegistrationFlag = true; }
242 
243 protected:
246 
248  virtual void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
249 
256  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
257 
262  virtual void GenerateOutputInformation() ITK_OVERRIDE;
263 
266  virtual void CopyInputToOutput() ITK_OVERRIDE;
267 
269  virtual void Initialize() ITK_OVERRIDE;
270 
273  virtual void InitializeIteration() ITK_OVERRIDE;
274 
276  virtual void ApplyUpdate( const TimeStepType& dt ) ITK_OVERRIDE;
277 
283  virtual void VerifyInputInformation() ITK_OVERRIDE {}
284 
287  virtual bool Halt() ITK_OVERRIDE
288  { return (Superclass::Halt() || m_StopRegistrationFlag); }
289 
296 
297 private:
298  VariationalRegistrationFilter(const Self&); //purposely not implemented
299  void operator=(const Self&); //purposely not implemented
300 
303 
306 
310 
311 };
312 
313 }// end namespace itk
314 
315 #ifndef ITK_MANUAL_INSTANTIATION
316 # include "itkVariationalRegistrationFilter.hxx"
317 #endif
318 
319 #endif
virtual void SetMovingImage(const MovingImageType *ptr)
virtual void SetMaskImage(const MaskImageType *ptr)
Base class for force calculation in the variational registration framework.
Light weight base class for most itk classes.
virtual void Initialize() override
Flexible framework for deformable registration of two images using PDE-based variational registration...
virtual const MaskImageType * GetMaskImage(void) const
virtual void ApplyUpdate(const TimeStepType &dt) override
DisplacementFieldType::Pointer DisplacementFieldPointer
virtual void GenerateInputRequestedRegion() override
virtual void PrintSelf(std::ostream &os, Indent indent) const override
Base class for regularization component in the variational registration framework.
virtual void InitializeIteration() override
virtual const MovingImageType * GetMovingImage(void) const
virtual std::vector< SmartPointer< DataObject > >::size_type GetNumberOfValidRequiredInputs() const override
VariationalRegistrationDemonsFunction< FixedImageType, MovingImageType, DisplacementFieldType > DefaultRegistrationFunctionType
virtual DisplacementFieldType * GetDisplacementField()
Image< MaskImagePixelType, ImageDimension > MaskImageType
virtual void SetInput(const InputImageType *image)
virtual void GenerateOutputInformation() override
virtual double GetMetric() const
VariationalRegistrationFunction< FixedImageType, MovingImageType, DisplacementFieldType > RegistrationFunctionType
DenseFiniteDifferenceImageFilter< TDisplacementField, TDisplacementField > Superclass
RegistrationFunctionType * DownCastDifferenceFunctionType()
virtual void SetInitialDisplacementField(DisplacementFieldType *ptr)
MovingImageType::ConstPointer MovingImageConstPointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
This class performs diffusive regularization of a vector field.
VariationalRegistrationRegularizer< DisplacementFieldType > RegularizerType
virtual const FixedImageType * GetFixedImage(void) const
virtual void CopyInputToOutput() override
This class computes different Demon forces in the variational registration framework.
virtual void SetFixedImage(const FixedImageType *ptr)
Templated n-dimensional image class.
Definition: itkImage.h:75
VariationalRegistrationDiffusionRegularizer< DisplacementFieldType > DefaultRegularizerType