ITK  4.13.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:
81  typedef BoundingBox Self;
82  typedef Object Superclass;
85 
87  itkTypeMacro(BoundingBox, Object);
88 
90  itkNewMacro(Self);
91 
93  typedef TPointIdentifier PointIdentifier;
94  typedef TCoordRep CoordRepType;
95  typedef TPointsContainer PointsContainer;
96  typedef typename PointsContainer::Pointer PointsContainerPointer;
97  typedef typename PointsContainer::ConstPointer PointsContainerConstPointer;
98 
101 
103  itkStaticConstMacro(PointDimension, unsigned int, VPointDimension);
104 
106  typedef typename PointsContainer::ConstIterator PointsContainerConstIterator;
107  typedef typename PointsContainer::Iterator PointsContainerIterator;
108 
112  void SetPoints(const PointsContainer *);
113 
114  const PointsContainer * GetPoints() const;
115 
117  const PointsContainer * GetCorners();
118 
120  bool ComputeBoundingBox() const;
121 
127  itkGetConstReferenceMacro(Bounds, BoundsArrayType);
128 
131  PointType GetCenter() const;
132 
135  PointType GetMinimum() const;
136 
140  void SetMinimum(const PointType &);
141 
144  PointType GetMaximum() const;
145 
149  void SetMaximum(const PointType &);
150 
155  void ConsiderPoint(const PointType &);
156 
161  AccumulateType GetDiagonalLength2() const;
162 
164  bool IsInside(const PointType &) const;
165 
167  virtual ModifiedTimeType GetMTime(void) const ITK_OVERRIDE;
168 
170  Pointer DeepCopy() const;
171 
172 protected:
173  BoundingBox();
174  virtual ~BoundingBox() ITK_OVERRIDE;
175  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
176 
178 
179 private:
180  ITK_DISALLOW_COPY_AND_ASSIGN(BoundingBox);
181 
182  PointsContainerConstPointer m_PointsContainer;
183  PointsContainerPointer m_CornersContainer;
184  mutable BoundsArrayType m_Bounds;
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
Point< CoordRepType, VPointDimension > PointType
TPointsContainer PointsContainer
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:164
PointsContainer::ConstPointer PointsContainerConstPointer
FixedArray< CoordRepType, VPointDimension *2 > BoundsArrayType
TPointIdentifier PointIdentifier
PointsContainer::ConstIterator PointsContainerConstIterator
PointsContainer::ConstIterator ConstIterator
SizeValueType IdentifierType
Definition: itkIntTypes.h:147
PointsContainer::Iterator PointsContainerIterator
BoundingBox Self
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:59
SmartPointer< const Self > ConstPointer
TCoordRep CoordRepType
SmartPointer< Self > Pointer
NumericTraits< CoordRepType >::AccumulateType AccumulateType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
PointsContainer::Pointer PointsContainerPointer
Base class for most ITK classes.
Definition: itkObject.h:59
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52
Represent and compute information about bounding boxes.