ITK  6.0.0
Insight Toolkit
itkBoundingBox.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 *
20 * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21 *
22 * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23 *
24 * For complete copyright, license and disclaimer of warranty information
25 * please refer to the NOTICE file at the top of the ITK source tree.
26 *
27 *=========================================================================*/
28#ifndef itkBoundingBox_h
29#define itkBoundingBox_h
30
31#include "itkPoint.h"
32#include "itkVectorContainer.h"
33#include "itkIntTypes.h"
34
35#include <array>
36
37namespace itk
38{
39
66template <typename TPointIdentifier = IdentifierType,
67 unsigned int VPointDimension = 3,
68 typename TCoordRep = float,
69 typename TPointsContainer = VectorContainer<TPointIdentifier, Point<TCoordRep, VPointDimension>>>
70class ITK_TEMPLATE_EXPORT BoundingBox : public Object
71{
72public:
73 ITK_DISALLOW_COPY_AND_MOVE(BoundingBox);
74
80
82 itkOverrideGetNameOfClassMacro(BoundingBox);
83
85 itkNewMacro(Self);
86
87 /* Number of corners of this bounding box. Equals `pow(2, VPointDimension)` */
88 static constexpr SizeValueType NumberOfCorners = SizeValueType{ 1 } << VPointDimension;
89
91 using PointIdentifier = TPointIdentifier;
92 using CoordRepType = TCoordRep;
93 using PointsContainer = TPointsContainer;
96
99
101 static constexpr unsigned int PointDimension = VPointDimension;
102
104 using PointsContainerConstIterator = typename PointsContainer::ConstIterator;
105 using PointsContainerIterator = typename PointsContainer::Iterator;
106
110 void
112
113 const PointsContainer *
114 GetPoints() const;
115
121 std::array<PointType, NumberOfCorners>
123
125 itkLegacyMacro(const PointsContainer * GetCorners());
126
128 bool
130
136 itkGetConstReferenceMacro(Bounds, BoundsArrayType);
137
141 GetCenter() const;
142
146 GetMinimum() const;
147
151 void
153
157 GetMaximum() const;
158
162 void
164
169 void
171
178
180 bool
181 IsInside(const PointType &) const;
182
185 GetMTime() const override;
186
188 Pointer
189 DeepCopy() const;
190
191protected:
192 BoundingBox() = default;
193 ~BoundingBox() override = default;
194 void
195 PrintSelf(std::ostream & os, Indent indent) const override;
196
197 using ConstIterator = typename PointsContainer::ConstIterator;
198
199private:
200 PointsContainerConstPointer m_PointsContainer{};
201#if !defined(ITK_LEGACY_REMOVE)
202 PointsContainerPointer m_CornersContainer{ PointsContainer::New() };
203#endif
204 mutable BoundsArrayType m_Bounds{};
205 mutable TimeStamp m_BoundsMTime{}; // The last time the bounds
206 // were computed.
207};
208} // end namespace itk
209
210#ifndef ITK_MANUAL_INSTANTIATION
211# include "itkBoundingBox.hxx"
212#endif
213
214#endif
Represent and compute information about bounding boxes.
void SetMinimum(const PointType &)
bool IsInside(const PointType &) const
typename PointsContainer::ConstPointer PointsContainerConstPointer
PointType GetMaximum() const
typename PointsContainer::Pointer PointsContainerPointer
PointType GetMinimum() const
const PointsContainer * GetPoints() const
TCoordRep CoordRepType
typename PointsContainer::ConstIterator PointsContainerConstIterator
~BoundingBox() override=default
std::array< PointType, NumberOfCorners > ComputeCorners() const
void SetPoints(const PointsContainer *)
ModifiedTimeType GetMTime() const override
typename PointsContainer::Iterator PointsContainerIterator
BoundingBox()=default
typename PointsContainer::ConstIterator ConstIterator
bool ComputeBoundingBox() const
TPointIdentifier PointIdentifier
itkLegacyMacro(const PointsContainer *GetCorners())
PointType GetCenter() const
void SetMaximum(const PointType &)
void PrintSelf(std::ostream &os, Indent indent) const override
void ConsiderPoint(const PointType &)
typename NumericTraits< CoordRepType >::AccumulateType AccumulateType
TPointsContainer PointsContainer
Pointer DeepCopy() const
AccumulateType GetDiagonalLength2() const
Simulate a standard C array with copy semantics.
Definition: itkFixedArray.h:54
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Base class for most ITK classes.
Definition: itkObject.h:62
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:54
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:61
SmartPointer< const Self > ConstPointer
static Pointer New()
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
SizeValueType IdentifierType
Definition: itkIntTypes.h:90
SizeValueType ModifiedTimeType
Definition: itkIntTypes.h:105
unsigned long SizeValueType
Definition: itkIntTypes.h:86