ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkBoundingBox.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  *
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 namespace itk
36 {
70 template<
71  typename TPointIdentifier = IdentifierType,
72  int VPointDimension = 3,
73  typename TCoordRep = float,
74  typename TPointsContainer =
75  VectorContainer< TPointIdentifier, Point< TCoordRep, VPointDimension > >
76  >
77 class ITK_TEMPLATE_EXPORT BoundingBox:public Object
78 {
79 public:
80  ITK_DISALLOW_COPY_AND_ASSIGN(BoundingBox);
81 
83  using Self = BoundingBox;
84  using Superclass = Object;
87 
89  itkTypeMacro(BoundingBox, Object);
90 
92  itkNewMacro(Self);
93 
95  using PointIdentifier = TPointIdentifier;
96  using CoordRepType = TCoordRep;
97  using PointsContainer = TPointsContainer;
98  using PointsContainerPointer = typename PointsContainer::Pointer;
99  using PointsContainerConstPointer = typename PointsContainer::ConstPointer;
100 
103 
105  static constexpr unsigned int PointDimension = VPointDimension;
106 
108  using PointsContainerConstIterator = typename PointsContainer::ConstIterator;
109  using PointsContainerIterator = typename PointsContainer::Iterator;
110 
114  void SetPoints(const PointsContainer *);
115 
116  const PointsContainer * GetPoints() const;
117 
119  const PointsContainer * GetCorners();
120 
122  bool ComputeBoundingBox() const;
123 
129  itkGetConstReferenceMacro(Bounds, BoundsArrayType);
130 
133  PointType GetCenter() const;
134 
137  PointType GetMinimum() const;
138 
142  void SetMinimum(const PointType &);
143 
146  PointType GetMaximum() const;
147 
151  void SetMaximum(const PointType &);
152 
157  void ConsiderPoint(const PointType &);
158 
163  AccumulateType GetDiagonalLength2() const;
164 
166  bool IsInside(const PointType &) const;
167 
169  ModifiedTimeType GetMTime() const override;
170 
172  Pointer DeepCopy() const;
173 
174 protected:
175  BoundingBox();
176  ~BoundingBox() override = default;
177  void PrintSelf(std::ostream & os, Indent indent) const override;
178 
179  using ConstIterator = typename PointsContainer::ConstIterator;
180 
181 private:
185  mutable TimeStamp m_BoundsMTime; // The last time the bounds
186  // were computed.
187 };
188 } // end namespace itk
189 
190 #ifndef ITK_MANUAL_INSTANTIATION
191 #include "itkBoundingBox.hxx"
192 #endif
193 
194 #endif
TCoordRep CoordRepType
typename PointsContainer::Pointer PointsContainerPointer
typename PointsContainer::ConstPointer PointsContainerConstPointer
Define numeric traits for std::vector.
BoundsArrayType m_Bounds
PointsContainerPointer m_CornersContainer
TPointIdentifier PointIdentifier
TPointsContainer PointsContainer
SizeValueType IdentifierType
Definition: itkIntTypes.h:87
typename PointsContainer::ConstIterator PointsContainerConstIterator
PointsContainerConstPointer m_PointsContainer
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:60
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:104
typename PointsContainer::Iterator PointsContainerIterator
TimeStamp m_BoundsMTime
typename NumericTraits< CoordRepType >::AccumulateType AccumulateType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename PointsContainer::ConstIterator ConstIterator
Base class for most ITK classes.
Definition: itkObject.h:60
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52
Represent and compute information about bounding boxes.