ITK  5.2.0
Insight Toolkit
itkWhitakerSparseLevelSetImage.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 
19 #ifndef itkWhitakerSparseLevelSetImage_h
20 #define itkWhitakerSparseLevelSetImage_h
21 
22 #include "itkLevelSetSparseImage.h"
23 #include "itkLabelObject.h"
24 #include "itkLabelMap.h"
25 
26 namespace itk
27 {
40 template <typename TOutput, unsigned int VDimension>
41 class ITK_TEMPLATE_EXPORT WhitakerSparseLevelSetImage : public LevelSetSparseImage<TOutput, VDimension>
42 {
43 public:
44  ITK_DISALLOW_COPY_AND_MOVE(WhitakerSparseLevelSetImage);
45 
50 
52  itkNewMacro(Self);
53 
56 
57  static constexpr unsigned int Dimension = VDimension;
58 
59  using InputType = typename Superclass::InputType;
60  using OutputType = typename Superclass::OutputType;
61  using OutputRealType = typename Superclass::OutputRealType;
62  using GradientType = typename Superclass::GradientType;
63  using HessianType = typename Superclass::HessianType;
64  using LevelSetDataType = typename Superclass::LevelSetDataType;
65 
66  using LayerIdType = typename Superclass::LayerIdType;
67  using LabelObjectType = typename Superclass::LabelObjectType;
68  using LabelObjectPointer = typename Superclass::LabelObjectPointer;
69  using LabelObjectLengthType = typename Superclass::LabelObjectLengthType;
70  using LabelObjectLineType = typename Superclass::LabelObjectLineType;
71 
72  using LabelMapType = typename Superclass::LabelMapType;
73  using LabelMapPointer = typename Superclass::LabelMapPointer;
74  using LabelMapConstPointer = typename Superclass::LabelMapConstPointer;
76 
77  using LayerType = typename Superclass::LayerType;
78  using LayerIterator = typename Superclass::LayerIterator;
79  using LayerConstIterator = typename Superclass::LayerConstIterator;
80 
81  using LayerMapType = typename Superclass::LayerMapType;
82  using LayerMapIterator = typename Superclass::LayerMapIterator;
83  using LayerMapConstIterator = typename Superclass::LayerMapConstIterator;
84 
86  using Superclass::Evaluate;
88  Evaluate(const InputType & inputIndex) const override;
89 
90 #ifdef ITK_USE_CONCEPT_CHECKING
91  // Begin concept checking
92 
94 
95  // End concept checking
96 #endif // ITK_USE_CONCEPT_CHECKING
97 
98  static inline LayerIdType
100  {
101  return -3;
102  }
103  static inline LayerIdType
105  {
106  return -2;
107  }
108  static inline LayerIdType
110  {
111  return -1;
112  }
113  static inline LayerIdType
115  {
116  return 0;
117  }
118  static inline LayerIdType
120  {
121  return 1;
122  }
123  static inline LayerIdType
125  {
126  return 2;
127  }
128  static inline LayerIdType
130  {
131  return 3;
132  }
133 
135  template <typename TLabel>
138  {
139  using OutputLabelObjectType = LabelObject<TLabel, Dimension>;
140  typename OutputLabelObjectType::Pointer object = OutputLabelObjectType::New();
142 
143  for (LayerIdType status = this->MinusThreeLayer(); status < this->PlusOneLayer(); ++status)
144  {
145  LabelObjectPointer labelObject = this->m_LabelMap->GetLabelObject(status);
146 
147  for (SizeValueType i = 0; i < labelObject->GetNumberOfLines(); ++i)
148  {
149  object->AddLine(labelObject->GetLine(i));
150  }
151  }
152  object->Optimize();
153 
154  return object;
155  }
156 
157 protected:
159  ~WhitakerSparseLevelSetImage() override = default;
160 
162  void
163  InitializeLayers() override;
164 
165  void
166  InitializeInternalLabelList() override;
167 };
168 } // namespace itk
169 
170 #ifndef ITK_MANUAL_INSTANTIATION
171 # include "itkWhitakerSparseLevelSetImage.hxx"
172 #endif
173 
174 #endif // itkWhitakerSparseLevelSetImage_h
itk::WhitakerSparseLevelSetImage
Derived class for the sparse-field representation of level-set function.
Definition: itkWhitakerSparseLevelSetImage.h:41
itk::WhitakerSparseLevelSetImage::ZeroLayer
static LayerIdType ZeroLayer()
Definition: itkWhitakerSparseLevelSetImage.h:114
itk::WhitakerSparseLevelSetImage::MinusThreeLayer
static LayerIdType MinusThreeLayer()
Definition: itkWhitakerSparseLevelSetImage.h:99
itk::LevelSetSparseImage::LayerMapConstIterator
typename LayerMapType::const_iterator LayerMapConstIterator
Definition: itkLevelSetSparseImage.h:83
itk::WhitakerSparseLevelSetImage::MinusOneLayer
static LayerIdType MinusOneLayer()
Definition: itkWhitakerSparseLevelSetImage.h:109
itk::LevelSetSparseImage
Base class for the sparse representation of a level-set function on one Image.
Definition: itkLevelSetSparseImage.h:42
itk::LevelSetSparseImage::LabelObjectLineType
typename LabelObjectType::LineType LabelObjectLineType
Definition: itkLevelSetSparseImage.h:70
itk::LevelSetSparseImage::LayerMapType
std::map< LayerIdType, LayerType > LayerMapType
Definition: itkLevelSetSparseImage.h:81
itk::WhitakerSparseLevelSetImage::MinusTwoLayer
static LayerIdType MinusTwoLayer()
Definition: itkWhitakerSparseLevelSetImage.h:104
itk::LevelSetSparseImage::LabelMapConstPointer
typename LabelMapType::ConstPointer LabelMapConstPointer
Definition: itkLevelSetSparseImage.h:74
itk::DiscreteLevelSetImage::HessianType
typename Superclass::HessianType HessianType
Definition: itkDiscreteLevelSetImage.h:57
itk::LevelSetSparseImage::LayerIdType
int8_t LayerIdType
Definition: itkLevelSetSparseImage.h:64
itk::LevelSetSparseImage::LabelMapPointer
typename LabelMapType::Pointer LabelMapPointer
Definition: itkLevelSetSparseImage.h:73
itk::SmartPointer< Self >
itk::WhitakerSparseLevelSetImage::PlusTwoLayer
static LayerIdType PlusTwoLayer()
Definition: itkWhitakerSparseLevelSetImage.h:124
itk::LabelMap
Templated n-dimensional image to store labeled objects.
Definition: itkLabelMap.h:70
itk::LevelSetSparseImage::LabelObjectPointer
typename LabelObjectType::Pointer LabelObjectPointer
Definition: itkLevelSetSparseImage.h:68
itkLabelMap.h
itk::LevelSetSparseImage::LayerMapIterator
typename LayerMapType::iterator LayerMapIterator
Definition: itkLevelSetSparseImage.h:82
itk::LevelSetSparseImage::LayerType
std::map< InputType, OutputType, Functor::LexicographicCompare > LayerType
Definition: itkLevelSetSparseImage.h:77
itkLevelSetSparseImage.h
itk::LabelObject
The base class for the representation of an labeled binary object in an image.
Definition: itkLabelObject.h:65
itk::DiscreteLevelSetImage::OutputRealType
typename Superclass::OutputRealType OutputRealType
Definition: itkDiscreteLevelSetImage.h:55
itk::DiscreteLevelSetImage::InputType
typename Superclass::InputType InputType
Definition: itkDiscreteLevelSetImage.h:53
itk::LevelSetSparseImage::LabelObjectLengthType
typename LabelObjectType::LengthType LabelObjectLengthType
Definition: itkLevelSetSparseImage.h:69
itk::LevelSetSparseImage::RegionType
typename LabelMapType::RegionType RegionType
Definition: itkLevelSetSparseImage.h:75
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::LevelSetSparseImage::LayerIterator
typename LayerType::iterator LayerIterator
Definition: itkLevelSetSparseImage.h:78
itk::WhitakerSparseLevelSetImage::PlusThreeLayer
static LayerIdType PlusThreeLayer()
Definition: itkWhitakerSparseLevelSetImage.h:129
itk::DiscreteLevelSetImage::OutputType
typename Superclass::OutputType OutputType
Definition: itkDiscreteLevelSetImage.h:54
itk::WhitakerSparseLevelSetImage::GetAsLabelObject
LabelObject< TLabel, Dimension >::Pointer GetAsLabelObject()
Definition: itkWhitakerSparseLevelSetImage.h:137
itk::DiscreteLevelSetImage::LevelSetDataType
typename Superclass::LevelSetDataType LevelSetDataType
Definition: itkDiscreteLevelSetImage.h:58
itkLabelObject.h
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk::LevelSetSparseImage::LayerConstIterator
typename LayerType::const_iterator LayerConstIterator
Definition: itkLevelSetSparseImage.h:79
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::DiscreteLevelSetImage::GradientType
typename Superclass::GradientType GradientType
Definition: itkDiscreteLevelSetImage.h:56
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::WhitakerSparseLevelSetImage::PlusOneLayer
static LayerIdType PlusOneLayer()
Definition: itkWhitakerSparseLevelSetImage.h:119
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293