ITK  5.2.0
Insight Toolkit
itkLevelSetContainer.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 itkLevelSetContainer_h
20 #define itkLevelSetContainer_h
21 
23 
24 #include "itkLevelSetDenseImage.h"
25 
26 
27 namespace itk
28 {
38 template <typename TIdentifier, typename TLevelSet>
39 class LevelSetContainer : public LevelSetContainerBase<TIdentifier, TLevelSet>
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_MOVE(LevelSetContainer);
43 
48 
50  itkNewMacro(Self);
51 
53 
55 
63 
67 
70 
71  static constexpr unsigned int Dimension = LevelSetType::Dimension;
72 
78 
82 
83 protected:
84  LevelSetContainer() = default;
85  ~LevelSetContainer() override = default;
86 };
87 
92 template <typename TIdentifier, typename TImage>
93 class LevelSetContainer<TIdentifier, LevelSetDenseImage<TImage>>
94  : public LevelSetContainerBase<TIdentifier, LevelSetDenseImage<TImage>>
95 {
96 public:
97  ITK_DISALLOW_COPY_AND_MOVE(LevelSetContainer);
98 
100 
105 
107  itkNewMacro(Self);
108 
110 
112 
119 
123 
126 
127  static constexpr unsigned int Dimension = LevelSetType::Dimension;
128 
134 
138 
140  using LevelSetImagePointer = typename LevelSetImageType::Pointer;
141 
143  void
144  CopyInformationAndAllocate(const Self * iOther, const bool & iAllocate)
145  {
146  LevelSetContainerType internalContainer = iOther->GetContainer();
147  LevelSetContainerConstIteratorType it = internalContainer.begin();
149 
150  LevelSetContainerType newContainer;
151 
152  while (it != internalContainer.end())
153  {
154  if (iAllocate)
155  {
156  LevelSetPointer temp_ls = LevelSetType::New();
157 
158  LevelSetImagePointer image = LevelSetImageType::New();
159  const LevelSetImageType * otherImage = (it->second)->GetImage();
160 
161  image->CopyInformation(otherImage);
162  image->SetBufferedRegion(otherImage->GetBufferedRegion());
163  image->SetRequestedRegion(otherImage->GetRequestedRegion());
164  image->SetLargestPossibleRegion(otherImage->GetLargestPossibleRegion());
165  image->Allocate();
166  image->FillBuffer(NumericTraits<OutputPixelType>::ZeroValue());
167 
168  temp_ls->SetImage(image);
169  newContainer[it->first] = temp_ls;
170  newContainer[it->first]->SetDomainOffset((it->second)->GetDomainOffset());
171  }
172  else
173  {
174  LevelSetPointer temp_ls;
175  newContainer[it->first] = temp_ls;
176  }
177  ++it;
178  }
179 
180  this->SetContainer(newContainer);
181  }
182 
183 protected:
184  LevelSetContainer() = default;
185  ~LevelSetContainer() override = default;
186 };
187 
188 } // namespace itk
189 
190 #endif // itkLevelSetContainer_h
itk::LevelSetContainer::HessianType
typename Superclass::HessianType HessianType
Definition: itkLevelSetContainer.h:62
itk::LevelSetContainerBase::HeavisideConstPointer
typename HeavisideType::ConstPointer HeavisideConstPointer
Definition: itkLevelSetContainerBase.h:73
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::HeavisideConstPointer
typename Superclass::HeavisideConstPointer HeavisideConstPointer
Definition: itkLevelSetContainer.h:125
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::IdListIterator
typename Superclass::IdListIterator IdListIterator
Definition: itkLevelSetContainer.h:130
itk::LevelSetContainer::LevelSetContainerIteratorType
typename Superclass::LevelSetContainerIteratorType LevelSetContainerIteratorType
Definition: itkLevelSetContainer.h:66
itk::LevelSetContainer::LevelSetPointer
typename Superclass::LevelSetPointer LevelSetPointer
Definition: itkLevelSetContainer.h:57
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::GradientType
typename Superclass::GradientType GradientType
Definition: itkLevelSetContainer.h:117
itk::LevelSetContainerBase::LevelSetContainerType
std::map< LevelSetIdentifierType, LevelSetPointer > LevelSetContainerType
Definition: itkLevelSetContainerBase.h:68
itkLevelSetContainerBase.h
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::LevelSetImagePointer
typename LevelSetImageType::Pointer LevelSetImagePointer
Definition: itkLevelSetContainer.h:140
itk::LevelSetContainerBase::HeavisideType
HeavisideStepFunctionBase< OutputRealType, OutputRealType > HeavisideType
Definition: itkLevelSetContainerBase.h:72
itk::LevelSetContainer::DomainIteratorType
typename Superclass::DomainIteratorType DomainIteratorType
Definition: itkLevelSetContainer.h:81
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::LevelSetContainerConstIteratorType
typename Superclass::LevelSetContainerConstIteratorType LevelSetContainerConstIteratorType
Definition: itkLevelSetContainer.h:121
itk::LevelSetDenseImage
Base class for the "dense" representation of a level-set function on one image.
Definition: itkLevelSetDenseImage.h:41
itk::LevelSetDenseImage::ImageType
TImage ImageType
Definition: itkLevelSetDenseImage.h:47
itk::LevelSetContainer::IdListImageType
typename Superclass::IdListImageType IdListImageType
Definition: itkLevelSetContainer.h:75
itk::LevelSetContainer::OutputPixelType
typename Superclass::OutputType OutputPixelType
Definition: itkLevelSetContainer.h:59
itk::LevelSetContainer::LevelSetContainerType
typename Superclass::LevelSetContainerType LevelSetContainerType
Definition: itkLevelSetContainer.h:64
itk::LevelSetContainerBase::LevelSetDomainType
typename DomainMapImageFilterType::LevelSetDomain LevelSetDomainType
Definition: itkLevelSetContainerBase.h:88
itk::LevelSetContainerBase::SetContainer
void SetContainer(const LevelSetContainerType &iContainer)
itk::LevelSetContainerBase::DomainMapImageFilterPointer
typename DomainMapImageFilterType::Pointer DomainMapImageFilterPointer
Definition: itkLevelSetContainerBase.h:87
itk::SmartPointer< Self >
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::OutputPixelType
typename Superclass::OutputType OutputPixelType
Definition: itkLevelSetContainer.h:115
itk::LevelSetContainerBase::IdListType
std::list< LevelSetIdentifierType > IdListType
Definition: itkLevelSetContainerBase.h:77
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::HeavisideType
typename Superclass::HeavisideType HeavisideType
Definition: itkLevelSetContainer.h:124
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::CacheImageType
typename Superclass::CacheImageType CacheImageType
Definition: itkLevelSetContainer.h:132
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::LevelSetDomainType
typename Superclass::LevelSetDomainType LevelSetDomainType
Definition: itkLevelSetContainer.h:136
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::DomainMapImageFilterPointer
typename Superclass::DomainMapImageFilterPointer DomainMapImageFilterPointer
Definition: itkLevelSetContainer.h:135
itk::LevelSetContainer::LevelSetContainer
LevelSetContainer()=default
itk::LevelSetContainer::InputIndexType
typename Superclass::InputIndexType InputIndexType
Definition: itkLevelSetContainer.h:58
itk::LevelSetContainer::GradientType
typename Superclass::GradientType GradientType
Definition: itkLevelSetContainer.h:61
itk::LevelSetContainer::IdListType
typename Superclass::IdListType IdListType
Definition: itkLevelSetContainer.h:73
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::LevelSetContainer::LevelSetIdentifierType
typename Superclass::LevelSetIdentifierType LevelSetIdentifierType
Definition: itkLevelSetContainer.h:54
itk::LevelSetContainerBase::OutputType
typename LevelSetType::OutputType OutputType
Definition: itkLevelSetContainerBase.h:59
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::DomainMapImageFilterType
typename Superclass::DomainMapImageFilterType DomainMapImageFilterType
Definition: itkLevelSetContainer.h:133
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::CopyInformationAndAllocate
void CopyInformationAndAllocate(const Self *iOther, const bool &iAllocate)
Definition: itkLevelSetContainer.h:144
itk::LevelSetContainerBase::LevelSetContainerConstIteratorType
typename LevelSetContainerType::const_iterator LevelSetContainerConstIteratorType
Definition: itkLevelSetContainerBase.h:69
itk::LevelSetContainerBase::LevelSetType
TLevelSet LevelSetType
Definition: itkLevelSetContainerBase.h:56
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::LevelSetContainerIteratorType
typename Superclass::LevelSetContainerIteratorType LevelSetContainerIteratorType
Definition: itkLevelSetContainer.h:122
itk::LevelSetContainer::HeavisideType
typename Superclass::HeavisideType HeavisideType
Definition: itkLevelSetContainer.h:68
itk::LevelSetContainerBase::InputIndexType
typename LevelSetType::InputType InputIndexType
Definition: itkLevelSetContainerBase.h:58
itk::LevelSetContainer::HeavisideConstPointer
typename Superclass::HeavisideConstPointer HeavisideConstPointer
Definition: itkLevelSetContainer.h:69
itk::LevelSetContainer
Container of Level-Sets.
Definition: itkLevelSetContainer.h:39
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::DomainIteratorType
typename Superclass::DomainIteratorType DomainIteratorType
Definition: itkLevelSetContainer.h:137
itk::LevelSetContainerBase::CacheImageType
Image< short, Dimension > CacheImageType
Definition: itkLevelSetContainerBase.h:81
itk::LevelSetContainerBase::GradientType
typename LevelSetType::GradientType GradientType
Definition: itkLevelSetContainerBase.h:61
itkLevelSetDenseImage.h
itk::LevelSetContainer::Dimension
static constexpr unsigned int Dimension
Definition: itkLevelSetContainer.h:71
itk::LevelSetContainer::IdListIterator
typename Superclass::IdListIterator IdListIterator
Definition: itkLevelSetContainer.h:74
itk::LevelSetContainerBase
Container of level set.
Definition: itkLevelSetContainerBase.h:42
itk::LevelSetContainer::CacheImageType
typename Superclass::CacheImageType CacheImageType
Definition: itkLevelSetContainer.h:76
itk::LevelSetContainerBase::DomainIteratorType
typename DomainContainerType::iterator DomainIteratorType
Definition: itkLevelSetContainerBase.h:91
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::HessianType
typename Superclass::HessianType HessianType
Definition: itkLevelSetContainer.h:118
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itk::LevelSetContainerBase::LevelSetIdentifierType
TIdentifier LevelSetIdentifierType
Definition: itkLevelSetContainerBase.h:66
itk::LevelSetContainerBase::HessianType
typename LevelSetType::HessianType HessianType
Definition: itkLevelSetContainerBase.h:62
itk::LevelSetContainer::LevelSetDomainType
typename Superclass::LevelSetDomainType LevelSetDomainType
Definition: itkLevelSetContainer.h:80
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::OutputRealType
typename Superclass::OutputRealType OutputRealType
Definition: itkLevelSetContainer.h:116
itk::LevelSetContainerBase::OutputRealType
typename LevelSetType::OutputRealType OutputRealType
Definition: itkLevelSetContainerBase.h:60
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::LevelSetIdentifierType
typename Superclass::LevelSetIdentifierType LevelSetIdentifierType
Definition: itkLevelSetContainer.h:111
itk::LevelSetContainerBase::DomainMapImageFilterType
LevelSetDomainMapImageFilter< IdListImageType, CacheImageType > DomainMapImageFilterType
Definition: itkLevelSetContainerBase.h:83
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::IdListType
typename Superclass::IdListType IdListType
Definition: itkLevelSetContainer.h:129
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::LevelSetContainerBase::LevelSetContainerIteratorType
typename LevelSetContainerType::iterator LevelSetContainerIteratorType
Definition: itkLevelSetContainerBase.h:70
itk::LevelSetContainer::LevelSetType
typename Superclass::LevelSetType LevelSetType
Definition: itkLevelSetContainer.h:56
itk::LevelSetContainerBase::IdListIterator
typename IdListType::iterator IdListIterator
Definition: itkLevelSetContainerBase.h:78
itk::LevelSetContainer::~LevelSetContainer
~LevelSetContainer() override=default
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::LevelSetPointer
typename Superclass::LevelSetPointer LevelSetPointer
Definition: itkLevelSetContainer.h:113
itk::LevelSetContainerBase::LevelSetPointer
typename LevelSetType::Pointer LevelSetPointer
Definition: itkLevelSetContainerBase.h:57
itk::LevelSetContainerBase::IdListImageType
Image< IdListType, Dimension > IdListImageType
Definition: itkLevelSetContainerBase.h:80
itk::LevelSetContainer::OutputRealType
typename Superclass::OutputRealType OutputRealType
Definition: itkLevelSetContainer.h:60
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::InputIndexType
typename Superclass::InputIndexType InputIndexType
Definition: itkLevelSetContainer.h:114
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44
itk::LevelSetContainer::DomainMapImageFilterPointer
typename Superclass::DomainMapImageFilterPointer DomainMapImageFilterPointer
Definition: itkLevelSetContainer.h:79
itk::LevelSetContainer::LevelSetContainerConstIteratorType
typename Superclass::LevelSetContainerConstIteratorType LevelSetContainerConstIteratorType
Definition: itkLevelSetContainer.h:65
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::LevelSetImageType
typename LevelSetType::ImageType LevelSetImageType
Definition: itkLevelSetContainer.h:139
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::IdListImageType
typename Superclass::IdListImageType IdListImageType
Definition: itkLevelSetContainer.h:131
itk::LevelSetContainer< TIdentifier, LevelSetDenseImage< TImage > >::LevelSetContainerType
typename Superclass::LevelSetContainerType LevelSetContainerType
Definition: itkLevelSetContainer.h:120
itk::LevelSetContainer::DomainMapImageFilterType
typename Superclass::DomainMapImageFilterType DomainMapImageFilterType
Definition: itkLevelSetContainer.h:77