ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkLevelSetSparseImage.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 
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 :
43  public DiscreteLevelSetImage< TOutput, VDimension >
44 {
45 public:
46  ITK_DISALLOW_COPY_AND_ASSIGN(LevelSetSparseImage);
47 
52 
55 
56  static constexpr unsigned int Dimension = Superclass::Dimension;
57 
58  using InputType = typename Superclass::InputType;
59  using OutputType = typename Superclass::OutputType;
60  using OutputRealType = typename Superclass::OutputRealType;
61  using GradientType = typename Superclass::GradientType;
62  using HessianType = typename Superclass::HessianType;
63  using LevelSetDataType = typename Superclass::LevelSetDataType;
64 
66  using LayerIdListType = std::list< LayerIdType >;
67 
72 
77 
78  using LayerType = std::map< InputType, OutputType,
80  using LayerIterator = typename LayerType::iterator;
81  using LayerConstIterator = typename LayerType::const_iterator;
82 
83  using LayerMapType = std::map< LayerIdType, LayerType >;
84  using LayerMapIterator = typename LayerMapType::iterator;
85  using LayerMapConstIterator = typename LayerMapType::const_iterator;
86 
88  virtual LayerIdType Status( const InputType& inputIndex ) const;
89 
91  const LayerType& GetLayer( LayerIdType value ) const;
92 
94  LayerType& GetLayer( LayerIdType value );
95 
97  void SetLayer( LayerIdType value, const LayerType& layer );
98 
100  virtual void SetLabelMap( LabelMapType* labelMap );
101  itkGetModifiableObjectMacro(LabelMap, LabelMapType );
103 
105  void Graft( const DataObject* data ) override;
106 
108  template< typename TLabel >
109  typename LabelObject< TLabel, VDimension >::Pointer GetAsLabelObject();
110 
111 protected:
112  LevelSetSparseImage() = default;
113  ~LevelSetSparseImage() override = default;
114 
118 
120  virtual void InitializeLayers() = 0;
121 
122  virtual void InitializeInternalLabelList() = 0;
123 
124  bool IsInsideDomain( const InputType& inputIndex ) const override;
125 
127  void Initialize() override;
128 
130  void CopyInformation( const DataObject* data ) override;
131 };
132 
133 }
134 
135 #ifndef ITK_MANUAL_INSTANTIATION
136 #include "itkLevelSetSparseImage.hxx"
137 #endif
138 
139 #endif // itkLevelSetSparseImage_h
typename LabelObjectType::LengthType LabelObjectLengthType
typename LayerMapType::const_iterator LayerMapConstIterator
std::map< InputType, OutputType, Functor::LexicographicCompare > LayerType
typename Superclass::OutputRealType OutputRealType
typename LabelObjectType::Pointer LabelObjectPointer
Base class for the sparse representation of a level-set function on one Image.
typename LayerType::const_iterator LayerConstIterator
std::map< LayerIdType, LayerType > LayerMapType
typename Superclass::LevelSetDataType LevelSetDataType
Abstract class for a level-set function on one Image.
typename LineType::LengthType LengthType
The base class for the representation of an labeled binary object in an image.
Templated n-dimensional image to store labeled objects.
Definition: itkLabelMap.h:70
typename LabelObjectType::LineType LabelObjectLineType
::int8_t int8_t
Definition: itkIntTypes.h:28
typename LabelMapType::ConstPointer LabelMapConstPointer
Order Index instances lexicographically.
Base class for most ITK classes.
Definition: itkObject.h:60
Base class for all data objects in ITK.