ITK  6.0.0
Insight Toolkit
itkLevelSetSparseImage.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  * https://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 itkLevelSetSparseImage_h
20 #define itkLevelSetSparseImage_h
21 
23 #include "itkObjectFactory.h"
24 
25 #include "itkLabelObject.h"
26 #include "itkLabelMap.h"
28 
29 namespace itk
30 {
31 
41 template <typename TOutput, unsigned int VDimension>
42 class ITK_TEMPLATE_EXPORT LevelSetSparseImage : public DiscreteLevelSetImage<TOutput, VDimension>
43 {
44 public:
45  ITK_DISALLOW_COPY_AND_MOVE(LevelSetSparseImage);
46 
51 
53  itkOverrideGetNameOfClassMacro(LevelSetSparseImage);
54 
55  static constexpr unsigned int Dimension = Superclass::Dimension;
56 
57  using typename Superclass::InputType;
58  using typename Superclass::OutputType;
59  using typename Superclass::OutputRealType;
60  using typename Superclass::GradientType;
61  using typename Superclass::HessianType;
62  using typename Superclass::LevelSetDataType;
63 
64  using LayerIdType = int8_t;
65  using LayerIdListType = std::list<LayerIdType>;
66 
71 
76 
77  using LayerType = std::map<InputType, OutputType, Functor::LexicographicCompare>;
78  using LayerIterator = typename LayerType::iterator;
79  using LayerConstIterator = typename LayerType::const_iterator;
80 
81  using LayerMapType = std::map<LayerIdType, LayerType>;
82  using LayerMapIterator = typename LayerMapType::iterator;
83  using LayerMapConstIterator = typename LayerMapType::const_iterator;
84 
86  virtual LayerIdType
87  Status(const InputType & inputIndex) const;
88 
90  const LayerType &
91  GetLayer(LayerIdType value) const;
92 
94  LayerType &
95  GetLayer(LayerIdType value);
96 
98  void
99  SetLayer(LayerIdType value, const LayerType & layer);
100 
102  virtual void
103  SetLabelMap(LabelMapType * labelMap);
104  itkGetModifiableObjectMacro(LabelMap, LabelMapType);
108  void
109  Graft(const DataObject * data) override;
110 
112  template <typename TLabel>
114  GetAsLabelObject();
115 
116 protected:
117  LevelSetSparseImage() = default;
118  ~LevelSetSparseImage() override = default;
119 
120  LayerMapType m_Layers{};
121  LabelMapPointer m_LabelMap{};
122  LayerIdListType m_InternalLabelList{};
123 
125  virtual void
126  InitializeLayers() = 0;
127 
128  virtual void
129  InitializeInternalLabelList() = 0;
130 
131  bool
132  IsInsideDomain(const InputType & inputIndex) const override;
133 
135  void
136  Initialize() override;
137 
139  void
140  CopyInformation(const DataObject * data) override;
141 };
142 
143 } // namespace itk
144 
145 #ifndef ITK_MANUAL_INSTANTIATION
146 # include "itkLevelSetSparseImage.hxx"
147 #endif
148 
149 #endif // itkLevelSetSparseImage_h
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::LabelObject::LengthType
typename LineType::LengthType LengthType
Definition: itkLabelObject.h:91
itkObjectFactory.h
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::Index
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:68
itk::LevelSetSparseImage< int8_t, VDimension >::LayerMapConstIterator
typename LayerMapType::const_iterator LayerMapConstIterator
Definition: itkLevelSetSparseImage.h:83
itk::LevelSetSparseImage
Base class for the sparse representation of a level-set function on one Image.
Definition: itkLevelSetSparseImage.h:42
itk::LevelSetSparseImage< int8_t, VDimension >::LabelObjectLineType
typename LabelObjectType::LineType LabelObjectLineType
Definition: itkLevelSetSparseImage.h:70
itk::LevelSetSparseImage< int8_t, VDimension >::LayerMapType
std::map< LayerIdType, LayerType > LayerMapType
Definition: itkLevelSetSparseImage.h:81
itk::LevelSetSparseImage< int8_t, VDimension >::LabelMapConstPointer
typename LabelMapType::ConstPointer LabelMapConstPointer
Definition: itkLevelSetSparseImage.h:74
itkDiscreteLevelSetImage.h
itkLexicographicCompare.h
itk::LevelSetSparseImage< int8_t, VDimension >::LayerIdType
int8_t LayerIdType
Definition: itkLevelSetSparseImage.h:64
itk::LevelSetSparseImage< int8_t, VDimension >::LabelMapPointer
typename LabelMapType::Pointer LabelMapPointer
Definition: itkLevelSetSparseImage.h:73
itk::SmartPointer< Self >
itk::LabelMap
Templated n-dimensional image to store labeled objects.
Definition: itkLabelMap.h:70
itk::LevelSetSparseImage< int8_t, VDimension >::LabelObjectPointer
typename LabelObjectType::Pointer LabelObjectPointer
Definition: itkLevelSetSparseImage.h:68
itkLabelMap.h
itk::LevelSetSparseImage< int8_t, VDimension >::LayerIdListType
std::list< LayerIdType > LayerIdListType
Definition: itkLevelSetSparseImage.h:65
itk::LevelSetSparseImage< int8_t, VDimension >::LayerMapIterator
typename LayerMapType::iterator LayerMapIterator
Definition: itkLevelSetSparseImage.h:82
itk::LevelSetSparseImage< int8_t, VDimension >::LayerType
std::map< InputType, OutputType, Functor::LexicographicCompare > LayerType
Definition: itkLevelSetSparseImage.h:77
itk::LabelObject
The base class for the representation of a labeled binary object in an image.
Definition: itkLabelObject.h:65
itk::LevelSetSparseImage< int8_t, VDimension >::LabelObjectLengthType
typename LabelObjectType::LengthType LabelObjectLengthType
Definition: itkLevelSetSparseImage.h:69
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::LevelSetSparseImage< int8_t, VDimension >::LayerIterator
typename LayerType::iterator LayerIterator
Definition: itkLevelSetSparseImage.h:78
itk::LevelSetBase< Index< VDimension >, VDimension, int8_t, ImageBase< VDimension > >::RegionType
IdentifierType RegionType
Definition: itkLevelSetBase.h:66
itkLabelObject.h
itk::DiscreteLevelSetImage
Abstract class for a level-set function on one Image.
Definition: itkDiscreteLevelSetImage.h:36
itk::LabelObjectLine
Definition: itkLabelObjectLine.h:42
itk::LevelSetSparseImage< int8_t, VDimension >::LayerConstIterator
typename LayerType::const_iterator LayerConstIterator
Definition: itkLevelSetSparseImage.h:79
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293