ITK  4.2.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_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(void) const;
115 
117  const PointsContainer * GetCorners(void);
118 
120  bool ComputeBoundingBox(void) const;
121 
127  itkGetConstReferenceMacro(Bounds, BoundsArrayType);
128 
131  PointType GetCenter(void) const;
132 
135  PointType GetMinimum(void) const;
136 
140  void SetMinimum(const PointType &);
141 
144  PointType GetMaximum(void) const;
145 
149  void SetMaximum(const PointType &);
150 
155  void ConsiderPoint(const PointType &);
156 
161  AccumulateType GetDiagonalLength2(void) const;
162 
164  bool IsInside(const PointType &) const;
165 
167  unsigned long GetMTime(void) const;
168 
170  Pointer DeepCopy() const;
171 
172 protected:
173  BoundingBox();
174  virtual ~BoundingBox();
175  void PrintSelf(std::ostream & os, Indent indent) const;
176 
177  typedef typename PointsContainer::ConstIterator ConstIterator;
178 private:
179  BoundingBox(const Self &); //purposely not implemented
180  void operator=(const Self &); //purposely not implemented
181 
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
195