ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
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 __itkScalarRegionBasedLevelSetFunction_h 00019 #define __itkScalarRegionBasedLevelSetFunction_h 00020 00021 #include "itkRegionBasedLevelSetFunction.h" 00022 #include "itkNeighborhoodIterator.h" 00023 #include "itkImageRegionConstIterator.h" 00024 #include "itkImageRegionIteratorWithIndex.h" 00025 00026 namespace itk 00027 { 00065 template< class TInputImage, class TFeatureImage, class TSharedData > 00066 class ITK_EXPORT ScalarRegionBasedLevelSetFunction: 00067 public RegionBasedLevelSetFunction< TInputImage, TFeatureImage, TSharedData > 00068 { 00069 public: 00070 typedef ScalarRegionBasedLevelSetFunction Self; 00071 typedef RegionBasedLevelSetFunction< TInputImage, TFeatureImage, TSharedData > Superclass; 00072 typedef SmartPointer< Self > Pointer; 00073 typedef SmartPointer< const Self > ConstPointer; 00074 00075 // itkNewMacro() is purposely not provided since this is an abstract class. 00076 00078 itkTypeMacro(ScalarRegionBasedLevelSetFunction, RegionBasedLevelSetFunction); 00079 00080 itkStaticConstMacro(ImageDimension, unsigned int, TFeatureImage::ImageDimension); 00081 00082 typedef typename Superclass::InputImageType InputImageType; 00083 typedef typename Superclass::InputImageConstPointer InputImageConstPointer; 00084 typedef typename Superclass::InputImagePointer InputImagePointer; 00085 typedef typename Superclass::InputPixelType InputPixelType; 00086 typedef typename Superclass::InputIndexType InputIndexType; 00087 typedef typename Superclass::InputIndexValueType InputIndexValueType; 00088 typedef typename Superclass::InputSizeType InputSizeType; 00089 typedef typename Superclass::InputSizeValueType InputSizeValueType; 00090 typedef typename Superclass::InputRegionType InputRegionType; 00091 typedef typename Superclass::InputPointType InputPointType; 00092 00093 typedef typename Superclass::FeatureImageType FeatureImageType; 00094 typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer; 00095 typedef typename Superclass::FeaturePixelType FeaturePixelType; 00096 typedef typename Superclass::FeatureIndexType FeatureIndexType; 00097 typedef typename Superclass::FeatureOffsetType FeatureOffsetType; 00098 00099 typedef typename Superclass::ScalarValueType ScalarValueType; 00100 typedef typename Superclass::NeighborhoodType NeighborhoodType; 00101 typedef typename Superclass::FloatOffsetType FloatOffsetType; 00102 typedef typename Superclass::RadiusType RadiusType; 00103 typedef typename Superclass::TimeStepType TimeStepType; 00104 typedef typename Superclass::GlobalDataStruct GlobalDataStruct; 00105 typedef typename Superclass::PixelType PixelType; 00106 typedef typename Superclass::VectorType VectorType; 00107 00108 typedef typename Superclass::SharedDataType SharedDataType; 00109 typedef typename Superclass::SharedDataPointer SharedDataPointer; 00110 00111 typedef ImageRegionIteratorWithIndex< InputImageType > ImageIteratorType; 00112 typedef ImageRegionConstIteratorWithIndex< InputImageType > ConstImageIteratorType; 00113 typedef ImageRegionIteratorWithIndex< FeatureImageType > FeatureImageIteratorType; 00114 typedef ImageRegionConstIterator< FeatureImageType > ConstFeatureIteratorType; 00115 00116 typedef std::list< unsigned int > ListPixelType; 00117 typedef typename ListPixelType::const_iterator ListPixelConstIterator; 00118 typedef typename ListPixelType::iterator ListPixelIterator; 00119 typedef Image< ListPixelType, itkGetStaticConstMacro(ImageDimension) > 00120 ListImageType; 00121 00126 void UpdatePixel(const unsigned int & idx, 00127 NeighborhoodIterator< TInputImage > & iterator, 00128 InputPixelType & newValue, 00129 bool & status); 00130 00131 protected: 00132 ScalarRegionBasedLevelSetFunction():Superclass(){} 00133 ~ScalarRegionBasedLevelSetFunction(){} 00134 00135 ScalarValueType ComputeOverlapParameters(const FeatureIndexType & featIndex, 00136 ScalarValueType & product); 00137 00138 // update the background and foreground constants for pixel updates 00139 // Called only when sparse filters are used to prevent iteration through the 00140 // entire image 00141 virtual void UpdateSharedDataInsideParameters(const unsigned int & iId, 00142 const FeaturePixelType & iVal, const ScalarValueType & iChange) = 0; 00143 00144 virtual void UpdateSharedDataOutsideParameters(const unsigned int & iId, 00145 const FeaturePixelType & iVal, const ScalarValueType & iChange) = 0; 00146 00147 private: 00148 ScalarRegionBasedLevelSetFunction(const Self &); //purposely not implemented 00149 void operator=(const Self &); //purposely not implemented 00150 }; 00151 } 00152 00153 #ifndef ITK_MANUAL_INSTANTIATION 00154 #include "itkScalarRegionBasedLevelSetFunction.hxx" 00155 #endif 00156 00157 #endif 00158