ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkMultiphaseDenseFiniteDifferenceImageFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkMultiphaseDenseFiniteDifferenceImageFilter_h
00019 #define __itkMultiphaseDenseFiniteDifferenceImageFilter_h
00020 
00021 #include "itkMultiphaseFiniteDifferenceImageFilter.h"
00022 #include "itkBinaryThresholdImageFilter.h"
00023 #include "itkSignedMaurerDistanceMapImageFilter.h"
00024 #include "itkNumericTraits.h"
00025 #include "itkNeighborhoodAlgorithm.h"
00026 
00027 #include <list>
00028 
00029 namespace itk
00030 {
00100 template< class TInputImage, class TFeatureImage, class TOutputImage, class TFunction,
00101           typename TIdCell = unsigned int >
00102 class ITK_EXPORT MultiphaseDenseFiniteDifferenceImageFilter:
00103   public MultiphaseFiniteDifferenceImageFilter< TInputImage, TFeatureImage,
00104                                                 TOutputImage, TFunction, TIdCell >
00105 {
00106 public:
00107 
00109   typedef MultiphaseDenseFiniteDifferenceImageFilter Self;
00110   typedef MultiphaseFiniteDifferenceImageFilter< TInputImage,
00111                                                  TFeatureImage, TOutputImage, TFunction, TIdCell >       Superclass;
00112   typedef SmartPointer< Self >       Pointer;
00113   typedef SmartPointer< const Self > ConstPointer;
00114 
00116   itkTypeMacro(MultiphaseDenseFiniteDifferenceImageFilter, ImageToImageFilter);
00117 
00120   itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
00121 
00123   typedef typename Superclass::InputImageType      InputImageType;
00124   typedef typename Superclass::InputImagePointer   InputImagePointer;
00125   typedef typename Superclass::InputRegionType     InputRegionType;
00126   typedef typename Superclass::InputSizeType       InputSizeType;
00127   typedef typename Superclass::InputSizeValueType  InputSizeValueType;
00128   typedef typename Superclass::InputIndexType      InputIndexType;
00129   typedef typename Superclass::InputIndexValueType InputIndexValueType;
00130   typedef typename Superclass::InputPixelType      InputPixelType;
00131   typedef typename Superclass::InputPointType      InputPointType;
00132   typedef typename Superclass::InputSpacingType    InputSpacingType;
00133   typedef typename InputImageType::ValueType       ValueType;
00134 
00135   typedef typename Superclass::FeatureImageType    FeatureImageType;
00136   typedef typename Superclass::FeatureSizeType     FeatureSizeType;
00137   typedef typename Superclass::FeatureImagePointer FeatureImagePointer;
00138   typedef typename Superclass::FeatureRegionType   FeatureRegionType;
00139   typedef typename Superclass::FeatureSpacingType  FeatureSpacingType;
00140   typedef typename Superclass::FeaturePointType    FeaturePointType;
00141   typedef typename Superclass::FeaturePixelType    FeaturePixelType;
00142 
00143   typedef typename Superclass::OutputImageType      OutputImageType;
00144   typedef typename Superclass::OutputImagePointer   OutputImagePointer;
00145   typedef typename Superclass::OutputRegionType     OutputRegionType;
00146   typedef typename Superclass::OutputSizeType       OutputSizeType;
00147   typedef typename Superclass::OutputSizeValueType  SizeValueType;
00148   typedef typename Superclass::OutputIndexType      OutputIndexType;
00149   typedef typename Superclass::OutputIndexValueType OutputIndexValueType;
00150   typedef typename OutputImageType::PixelType       OutputPixelType;
00151 
00152   typedef typename Superclass::IdCellType IdCellType;
00153 
00154   typedef BinaryThresholdImageFilter< InputImageType, InputImageType > ThresholdFilterType;
00155   typedef typename ThresholdFilterType::Pointer                        ThresholdFilterPointer;
00156 
00157   typedef SignedMaurerDistanceMapImageFilter< InputImageType, InputImageType > MaurerType;
00158   typedef typename MaurerType::Pointer                                         MaurerPointer;
00159 
00160   typedef typename Superclass::FiniteDifferenceFunctionType       FiniteDifferenceFunctionType;
00161   typedef typename Superclass::FiniteDifferenceFunctionPointer    FiniteDifferenceFunctionPointer;
00162   typedef typename FiniteDifferenceFunctionType::NeighborhoodType NeighborhoodIteratorType;
00163 
00165   typedef typename Superclass::TimeStepType TimeStepType;
00166 
00167   typedef NeighborhoodAlgorithm::ImageBoundaryFacesCalculator< InputImageType > FaceCalculatorType;
00168   typedef typename FaceCalculatorType::FaceListType                             FaceListType;
00169 
00170   void SetFunctionCount(const IdCellType & n);
00171 
00172 #ifdef ITK_USE_CONCEPT_CHECKING
00173 
00174   itkConceptMacro( OutputTimesDoubleCheck,
00175                    ( Concept::MultiplyOperator< OutputPixelType, double > ) );
00176   itkConceptMacro( OutputAdditiveOperatorsCheck,
00177                    ( Concept::AdditiveOperators< OutputPixelType > ) );
00178   itkConceptMacro( InputConvertibleToOutputCheck,
00179                    ( Concept::Convertible< FeaturePixelType, OutputPixelType > ) );
00180 
00182 #endif
00183 
00184   itkSetMacro(ReinitializeCounter, unsigned int);
00185   itkGetMacro(ReinitializeCounter, unsigned int);
00186 protected:
00187   MultiphaseDenseFiniteDifferenceImageFilter()
00188   {
00189     this->m_ReinitializeCounter = 1;
00190     // FIXME: this->m_UpdateCounter really used?
00191     // this->m_UpdateCounter = 0;        // FIXME: Should this be a bool ?
00192   }
00193 
00194   ~MultiphaseDenseFiniteDifferenceImageFilter() {}
00195 
00196   virtual void PrintSelf(std::ostream &, Indent indent) const;
00197 
00201   virtual void CopyInputToOutput();
00202 
00203   virtual void PostProcessOutput();
00204 
00208   virtual void ApplyUpdate(TimeStepType dt);
00209 
00210   unsigned int m_ReinitializeCounter;  // FIXME: Should this be a boolean ?
00211   // unsigned int m_UpdateCounter;        // FIXME: Should this be a boolean ?
00212 private:
00213   MultiphaseDenseFiniteDifferenceImageFilter(const Self &);
00214   void operator=(const Self &); //purposely not implemented
00215 
00218   virtual void AllocateUpdateBuffer();
00219 
00223   virtual TimeStepType CalculateChange();
00224 
00226   std::vector< InputImagePointer > m_UpdateBuffers;
00227 };
00228 } // end namespace itk
00229 
00230 #ifndef ITK_MANUAL_INSTANTIATION
00231 #include "itkMultiphaseDenseFiniteDifferenceImageFilter.hxx"
00232 #endif
00233 
00234 #endif
00235