ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkFiniteDifferenceImageFilter.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 __itkFiniteDifferenceImageFilter_h
19 #define __itkFiniteDifferenceImageFilter_h
20 
21 #include "itkInPlaceImageFilter.h"
23 
24 namespace itk
25 {
131 template< class TInputImage, class TOutputImage >
133  public InPlaceImageFilter< TInputImage, TOutputImage >
134 {
135 public:
136 
142 
145 
147  typedef TInputImage InputImageType;
148  typedef TOutputImage OutputImageType;
149 
151  itkStaticConstMacro(ImageDimension, unsigned int, OutputImageType::ImageDimension);
152 
154  typedef typename TOutputImage::PixelType OutputPixelType;
155  typedef typename TInputImage::PixelType InputPixelType;
157 
161 
167 
170 
172  itkGetConstReferenceMacro(ElapsedIterations, IdentifierType);
173 
177  itkGetConstReferenceObjectMacro(DifferenceFunction,
179 
183  itkSetObjectMacro(DifferenceFunction, FiniteDifferenceFunctionType);
184 
186  itkSetMacro(NumberOfIterations, IdentifierType);
187  itkGetConstReferenceMacro(NumberOfIterations, IdentifierType);
189 
192  itkSetMacro(UseImageSpacing, bool);
193  itkBooleanMacro(UseImageSpacing);
194  itkGetConstReferenceMacro(UseImageSpacing, bool);
196 
199  itkSetMacro(MaximumRMSError, double);
200  itkGetConstReferenceMacro(MaximumRMSError, double);
202 
205  itkSetMacro(RMSChange, double);
206  itkGetConstReferenceMacro(RMSChange, double);
208 
211  itkSetMacro(ManualReinitialization, bool);
212  itkGetConstReferenceMacro(ManualReinitialization, bool);
213  itkBooleanMacro(ManualReinitialization);
215 
216  itkSetMacro( IsInitialized, bool );
217  itkGetMacro( IsInitialized, bool );
218 
219  void SetStateToUninitialized() { this->SetIsInitialized( false ); }
220  void SetStateToInitialized() { this->SetIsInitialized( true ); }
221 
222 #ifdef ITK_USE_STRICT_CONCEPT_CHECKING
223 
224  itkConceptMacro( OutputPixelIsFloatingPointCheck,
226 
228 #endif
229 
230 protected:
231 
233  virtual ~FiniteDifferenceImageFilter();
234 
237 
238  void PrintSelf(std::ostream & os, Indent indent) const;
239 
241  virtual void AllocateUpdateBuffer() = 0;
242 
246  virtual void ApplyUpdate(const TimeStepType& dt) = 0;
247 
253  virtual TimeStepType CalculateChange() = 0;
254 
258  virtual void CopyInputToOutput() = 0;
259 
263  virtual void GenerateData();
264 
276  virtual void GenerateInputRequestedRegion();
277 
280  virtual bool Halt();
281 
291  virtual bool ThreadedHalt( void *itkNotUsed(threadInfo) ) { return this->Halt(); }
292 
298  virtual void Initialize() {}
299 
306  virtual void InitializeIteration()
307  { m_DifferenceFunction->InitializeIteration(); }
308 
321  virtual TimeStepType ResolveTimeStep(const std::vector< TimeStepType >& timeStepList,
322  const std::vector< bool >& valid ) const;
323 
325  itkSetMacro(ElapsedIterations, IdentifierType);
326 
329  virtual void PostProcessOutput() {}
330 
333 
337 
341 
342  double m_RMSChange;
344 
345 private:
346  FiniteDifferenceImageFilter(const Self &); //purposely not implemented
347  void operator=(const Self &); //purposely not implemented
348 
352  void InitializeFunctionCoefficients();
353 
357 
360 };
361 } // end namespace itk
362 
363 // Define instantiation macro for this template.
364 #define ITK_TEMPLATE_FiniteDifferenceImageFilter(_, EXPORT, TypeX, TypeY) \
365  namespace itk \
366  { \
367  _( 2 ( class EXPORT FiniteDifferenceImageFilter< ITK_TEMPLATE_2 TypeX > ) ) \
368  namespace Templates \
369  { \
370  typedef FiniteDifferenceImageFilter< ITK_TEMPLATE_2 TypeX > \
371  FiniteDifferenceImageFilter##TypeY; \
372  } \
373  }
374 
375 #if ITK_TEMPLATE_EXPLICIT
376 #include "Templates/itkFiniteDifferenceImageFilter+-.h"
377 #endif
378 
379 #if ITK_TEMPLATE_TXX
380 #include "itkFiniteDifferenceImageFilter.hxx"
381 #endif
382 
383 #endif
384