ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkRegionBasedLevelSetFunctionData.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 __itkRegionBasedLevelSetFunctionData_h
19 #define __itkRegionBasedLevelSetFunctionData_h
20 
21 #include "itkLightObject.h"
22 
23 #include "itkVector.h"
24 #include "itkListSample.h"
25 #include "itkKdTreeGenerator.h"
26 
27 #include "itkImageRegionIterator.h"
29 
30 namespace itk
31 {
67 template< typename TInputImage, typename TFeatureImage >
69 {
70 public:
71 
76 
77  itkStaticConstMacro(ImageDimension, unsigned int, TFeatureImage::ImageDimension);
78 
80  itkNewMacro(Self);
81 
83 
84  typedef TInputImage InputImageType;
85  typedef typename InputImageType::Pointer InputImagePointer;
86  typedef typename InputImageType::ConstPointer InputImageConstPointer;
87  typedef typename InputImageType::PixelType InputPixelType;
88  typedef typename InputImageType::RegionType InputRegionType;
89  typedef typename InputImageType::SizeType InputSizeType;
91  typedef typename InputImageType::SpacingType InputSpacingType;
92  typedef typename InputImageType::IndexType InputIndexType;
94  typedef typename InputImageType::PointType InputPointType;
95 
96  typedef TFeatureImage FeatureImageType;
97  typedef typename FeatureImageType::Pointer FeatureImagePointer;
98  typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer;
99  typedef typename FeatureImageType::PixelType FeaturePixelType;
100  typedef typename FeatureImageType::RegionType FeatureRegionType;
101  typedef typename FeatureImageType::SizeType FeatureSizeType;
103  typedef typename FeatureImageType::SpacingType FeatureSpacingType;
104  typedef typename FeatureImageType::IndexType FeatureIndexType;
105  typedef typename FeatureImageType::PointType FeaturePointType;
106 
107  // Allocates m_HeavisideFunctionOfLevelSetImage to have same origin,
108  // spacing and size as image. Also sets the m_Start and m_End indices.
110 
111  // Checks if the given index lies in the domain of the current
112  // level-set function. The domain is defined by the start and end indices.
113  template< typename TIndex >
114  bool VerifyInsideRegion(const TIndex & featureIndex)
115  {
116  for ( unsigned int j = 0; j < ImageDimension; j++ )
117  {
118  if ( ( featureIndex[j] < static_cast< InputIndexValueType >( this->m_Start[j] ) )
119  || ( featureIndex[j] > static_cast< InputIndexValueType >( this->m_End[j] ) ) )
120  {
121  return false;
122  }
123  }
124  return true;
125  }
126 
127  // Get the index into the domain of the current level-set function
128  InputIndexType GetIndex(const FeatureIndexType & featureIndex);
129 
130  // Get the index in the domain of the feature image
131  FeatureIndexType GetFeatureIndex(const InputIndexType & inputIndex);
132 
135 
139 
140 protected:
143 
144 private:
145  RegionBasedLevelSetFunctionData(const Self &); //purposely not implemented
146  void operator=(const Self &); //purposely not implemented
147 };
148 } //end namespace itk
149 
150 #ifndef ITK_MANUAL_INSTANTIATION
151 #include "itkRegionBasedLevelSetFunctionData.hxx"
152 #endif
153 #endif
Light weight base class for most itk classes.
Helper class used to share data in the ScalarChanAndVeseLevelSetFunction.
void CreateHeavisideFunctionOfLevelSetImage(const InputImageType *image)
signed long IndexValueType
Definition: itkIntTypes.h:150
unsigned long SizeValueType
Definition: itkIntTypes.h:143
InputIndexType GetIndex(const FeatureIndexType &featureIndex)
FeatureIndexType GetFeatureIndex(const InputIndexType &inputIndex)