ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkScalarChanAndVeseSparseLevelSetImageFilter.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 __itkScalarChanAndVeseSparseLevelSetImageFilter_h
00019 #define __itkScalarChanAndVeseSparseLevelSetImageFilter_h
00020 
00021 #include "itkMultiphaseSparseFiniteDifferenceImageFilter.h"
00022 #include "itkRegionOfInterestImageFilter.h"
00023 #include "itkScalarChanAndVeseLevelSetFunction.h"
00024 
00025 namespace itk
00026 {
00063 template< class TInputImage, class TFeatureImage, class TOutputImage,
00064           class TFunction = ScalarChanAndVeseLevelSetFunction< TInputImage, TFeatureImage >,
00065           class TSharedData = typename TFunction::SharedDataType,
00066           typename TIdCell = unsigned int >
00067 class ITK_EXPORT ScalarChanAndVeseSparseLevelSetImageFilter:
00068   public MultiphaseSparseFiniteDifferenceImageFilter< TInputImage, TFeatureImage,
00069                                                       TOutputImage, TFunction, TIdCell >
00070 {
00071 public:
00072   typedef ScalarChanAndVeseSparseLevelSetImageFilter Self;
00073   typedef MultiphaseSparseFiniteDifferenceImageFilter< TInputImage,
00074                                                        TFeatureImage, TOutputImage, TFunction, TIdCell >     Superclass;
00075   typedef SmartPointer< Self >       Pointer;
00076   typedef SmartPointer< const Self > ConstPointer;
00077 
00079   itkNewMacro(Self);
00080 
00082   itkTypeMacro(ScalarChanAndVeseSparseLevelSetImageFilter,
00083                MultiphaseSparseFiniteDifferenceImageFilter);
00084 
00085   itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
00086 
00088   typedef typename Superclass::InputImageType    InputImageType;
00089   typedef typename Superclass::InputImagePointer InputImagePointer;
00090   typedef typename Superclass::InputPointType    InputPointType;
00091   typedef typename Superclass::ValueType         ValueType;
00092   typedef typename Superclass::InputSpacingType  InputSpacingType;
00093 
00094   typedef TFeatureImage                             FeatureImageType;
00095   typedef typename FeatureImageType::Pointer        FeatureImagePointer;
00096   typedef typename FeatureImageType::PixelType      FeaturePixelType;
00097   typedef typename FeatureImageType::IndexType      FeatureIndexType;
00098   typedef typename FeatureIndexType::IndexValueType FeatureIndexValueType;
00099   typedef typename FeatureImageType::RegionType     FeatureRegionType;
00100 
00102   typedef TOutputImage                        OutputImageType;
00103   typedef typename OutputImageType::IndexType IndexType;
00104   typedef typename OutputImageType::PixelType OutputPixelType;
00105 
00106   typedef typename Superclass::TimeStepType TimeStepType;
00107   typedef typename Superclass::FiniteDifferenceFunctionType
00108   FiniteDifferenceFunctionType;
00109 
00110   typedef typename Superclass::IdCellType IdCellType;
00111 
00112   typedef TFunction                      FunctionType;
00113   typedef typename FunctionType::Pointer FunctionPtr;
00114 
00115   typedef TSharedData                      SharedDataType;
00116   typedef typename SharedDataType::Pointer SharedDataPointer;
00117 
00118   typedef RegionOfInterestImageFilter< FeatureImageType, FeatureImageType > ROIFilterType;
00119   typedef typename ROIFilterType::Pointer                                   ROIFilterPointer;
00120 
00121 #ifdef ITK_USE_CONCEPT_CHECKING
00122 
00123   itkConceptMacro( OutputHasNumericTraitsCheck,
00124                    ( Concept::HasNumericTraits< OutputPixelType > ) );
00125 
00127 #endif
00128 
00131   virtual void SetFeatureImage(const FeatureImagePointer f)
00132   {
00133     this->SetInput(f);
00134   }
00135 
00136 protected:
00137   ScalarChanAndVeseSparseLevelSetImageFilter()
00138   {
00139     this->SetNumberOfLayers(2); // Narrow-band usage
00140     this->m_SharedData = SharedDataType::New();
00141   }
00142 
00143   ~ScalarChanAndVeseSparseLevelSetImageFilter() {}
00144 
00145   SharedDataPointer m_SharedData;
00146 
00147   virtual void Initialize();
00148 
00149   virtual void InitializeIteration();
00150 
00151   virtual void UpdatePixel(unsigned int functionIndex,
00152                            unsigned int idx, NeighborhoodIterator< InputImageType > & iterator,
00153                            ValueType & newValue, bool & status);
00154 };
00155 } //end namespace itk
00156 
00157 #ifndef ITK_MANUAL_INSTANTIATION
00158 #include "itkScalarChanAndVeseSparseLevelSetImageFilter.hxx"
00159 #endif
00160 
00161 #endif
00162