ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkLineSpatialObject.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkLineSpatialObject_h
00019 #define __itkLineSpatialObject_h
00020 
00021 #include <list>
00022 
00023 #include "itkPointBasedSpatialObject.h"
00024 #include "itkLineSpatialObjectPoint.h"
00025 
00026 namespace itk
00027 {
00042 template< unsigned int TDimension = 3 >
00043 class ITK_EXPORT LineSpatialObject:
00044   public PointBasedSpatialObject<  TDimension >
00045 {
00046 public:
00047 
00048   typedef LineSpatialObject                            Self;
00049   typedef PointBasedSpatialObject< TDimension >        Superclass;
00050   typedef SmartPointer< Self >                         Pointer;
00051   typedef SmartPointer< const Self >                   ConstPointer;
00052   typedef double                                       ScalarType;
00053   typedef LineSpatialObjectPoint< TDimension >         LinePointType;
00054   typedef std::vector< LinePointType >                 PointListType;
00055   typedef const PointListType                          ConstPointListType;
00056   typedef typename Superclass::SpatialObjectPointType  SpatialObjectPointType;
00057   typedef typename Superclass::PointType               PointType;
00058   typedef typename Superclass::TransformType           TransformType;
00059   typedef typename Superclass::BoundingBoxType         BoundingBoxType;
00060   typedef VectorContainer< IdentifierType, PointType > PointContainerType;
00061   typedef SmartPointer< PointContainerType >           PointContainerPointer;
00062 
00064   itkNewMacro(Self);
00065 
00067   itkTypeMacro(LineSpatialObject, PointBasedSpatialObject);
00068 
00070   PointListType & GetPoints(void) { return m_Points; }
00071   ConstPointListType & GetPoints(void) const { return m_Points; }
00073 
00075   void SetPoints(PointListType & newPoints);
00076 
00078   const SpatialObjectPointType * GetPoint(IdentifierType id) const
00079   {
00080     return &( m_Points[id] );
00081   }
00082 
00084   SpatialObjectPointType * GetPoint(IdentifierType id) { return &( m_Points[id] ); }
00085 
00087   SizeValueType GetNumberOfPoints(void) const { return m_Points.size(); }
00088 
00091   bool IsEvaluableAt(const PointType & point,
00092                      unsigned int depth = 0, char *name = NULL) const;
00093 
00098   bool ValueAt(const PointType & point, double & value,
00099                unsigned int depth = 0, char *name = NULL) const;
00100 
00102   bool IsInside(const PointType & point,
00103                 unsigned int depth, char *name) const;
00104 
00108   virtual bool IsInside(const PointType & point) const;
00109 
00111   bool ComputeLocalBoundingBox() const;
00112 
00113 protected:
00114   LineSpatialObject(const Self &); //purposely not implemented
00115   void operator=(const Self &);    //purposely not implemented
00116 
00117   PointListType m_Points;
00118 
00119   LineSpatialObject();
00120   virtual ~LineSpatialObject();
00121 
00123   virtual void PrintSelf(std::ostream & os, Indent indent) const;
00124 };
00125 } // end namespace itk
00126 
00127 #ifndef ITK_MANUAL_INSTANTIATION
00128 #include "itkLineSpatialObject.hxx"
00129 #endif
00130 
00131 #endif // __itkLineSpatialObject_h
00132