Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkPointSet.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkPointSet.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-25 12:24:12 $
00007   Version:   $Revision: 1.27 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012   Portions of this code are covered under the VTK copyright.
00013   See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
00014 
00015      This software is distributed WITHOUT ANY WARRANTY; without even 
00016      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00017      PURPOSE.  See the above copyright notices for more information.
00018 
00019 =========================================================================*/
00020 #ifndef __itkPointSet_h
00021 #define __itkPointSet_h
00022 
00023 #include "itkDataObject.h"
00024 #include "itkPoint.h"
00025 #include "itkDefaultStaticMeshTraits.h"
00026 #include "itkPointLocator.h"
00027 #include "itkBoundingBox.h"
00028 #include <vector>
00029 #include <set>
00030 
00031 
00032 namespace itk
00033 {
00034 
00041 template <typename TPointSet>
00042 struct GetPointSetDimension
00043 {
00044   itkStaticConstMacro(PointDimension, unsigned int,  TPointSet::PointDimension);
00045 }; 
00046 
00086 template <
00087   typename TPixelType,
00088   unsigned int VDimension = 3,
00089   typename TMeshTraits = DefaultStaticMeshTraits< TPixelType, VDimension, VDimension >
00090   >
00091 class ITK_EXPORT PointSet: public DataObject
00092 {
00093 public:
00095   typedef PointSet                  Self;
00096   typedef DataObject                Superclass;
00097   typedef SmartPointer<Self>        Pointer;
00098   typedef SmartPointer<const Self>  ConstPointer;
00099 
00101   itkNewMacro(Self);
00102 
00104   itkTypeMacro(PointSet, Object);
00105 
00107   typedef TMeshTraits                                   MeshTraits;
00108   typedef typename MeshTraits::PixelType                PixelType;  
00109 
00111   typedef typename MeshTraits::CoordRepType             CoordRepType;  
00112   typedef typename MeshTraits::PointIdentifier          PointIdentifier;
00113   typedef typename MeshTraits::PointType                PointType;
00114   typedef typename MeshTraits::PointsContainer          PointsContainer;
00115   typedef typename MeshTraits::PointDataContainer       PointDataContainer;
00116 
00118   itkStaticConstMacro(PointDimension, unsigned int,
00119                       TMeshTraits::PointDimension);
00120 
00123   typedef PointLocator<PointIdentifier,itkGetStaticConstMacro(PointDimension),
00124                        CoordRepType,PointsContainer>  PointLocatorType;
00125   typedef BoundingBox<PointIdentifier,itkGetStaticConstMacro(PointDimension),
00126                       CoordRepType,PointsContainer>   BoundingBoxType;
00128 
00130   typedef typename PointsContainer::Pointer          PointsContainerPointer;
00131   typedef typename PointsContainer::ConstPointer     PointsContainerConstPointer;
00132   typedef typename PointDataContainer::Pointer       PointDataContainerPointer;
00133   typedef typename PointDataContainer::ConstPointer  PointDataContainerConstPointer;
00134   typedef typename PointLocatorType::Pointer         PointLocatorPointer;
00135   typedef typename BoundingBoxType::Pointer          BoundingBoxPointer;
00136 
00138   typedef typename
00139           PointsContainer::ConstIterator        PointsContainerConstIterator;
00140   typedef typename
00141           PointsContainer::Iterator             PointsContainerIterator;
00142   typedef typename
00143           PointDataContainer::ConstIterator     PointDataContainerIterator;
00144 
00146   typedef long                                  RegionType;
00147 
00150   itkGetConstMacro( MaximumNumberOfRegions, RegionType );
00151 
00152 protected:
00155   PointsContainerPointer  m_PointsContainer;
00156 
00161   PointDataContainerPointer  m_PointDataContainer;
00162 
00165   PointLocatorPointer m_PointLocator;
00166 
00169   BoundingBoxPointer m_BoundingBox;
00170 
00171 public:
00173   void PassStructure(Self* inputPointSet);
00174   virtual void Initialize(void);
00175   unsigned long GetNumberOfPoints(void) const;
00177 
00181   void SetPoints(PointsContainer*);
00182   PointsContainer * GetPoints(void);
00183   const PointsContainer * GetPoints(void) const;
00184   void SetPointData(PointDataContainer*);
00185   PointDataContainer * GetPointData(void);
00186   const PointDataContainer * GetPointData(void) const;
00188 
00191   void SetPoint(PointIdentifier, PointType);
00192   bool GetPoint(PointIdentifier, PointType*) const;
00194 
00197   void SetPointData(PointIdentifier, PixelType);
00198   bool GetPointData(PointIdentifier, PixelType*) const;
00200 
00203   const BoundingBoxType * GetBoundingBox(void) const;
00204 
00207   bool FindClosestPoint(CoordRepType* /*coords[PointDimension]*/,
00208                         PointIdentifier* pointId);
00209 
00211   virtual void UpdateOutputInformation();
00212   virtual void SetRequestedRegionToLargestPossibleRegion();
00213   virtual void CopyInformation(const DataObject *data);
00214   virtual void Graft(const DataObject *data);
00215   virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
00216   virtual bool VerifyRequestedRegion();
00218 
00223   virtual void SetRequestedRegion(DataObject *data);
00224 
00226   virtual void SetRequestedRegion( const RegionType & region );
00227   itkGetConstMacro( RequestedRegion, RegionType );
00229 
00231   virtual void SetBufferedRegion( const RegionType & region );
00232   itkGetConstMacro( BufferedRegion, RegionType );
00234 
00235 
00236 protected:
00238   PointSet();
00239   ~PointSet() {}
00240   virtual void PrintSelf(std::ostream& os, Indent indent) const;
00242 
00243   // If the RegionType is ITK_UNSTRUCTURED_REGION, then the following
00244   // variables represent the maximum number of region that the data
00245   // object can be broken into, which region out of how many is
00246   // currently in the buffered region, and the number of regions and
00247   // the specific region requested for the update. Data objects that
00248   // do not support any division of the data can simply leave the
00249   // MaximumNumberOfRegions as 1. The RequestedNumberOfRegions and
00250   // RequestedRegion are used to define the currently requested
00251   // region. The LargestPossibleRegion is always requested region = 0
00252   // and number of regions = 1;
00253   RegionType m_MaximumNumberOfRegions;
00254   RegionType m_NumberOfRegions;
00255   RegionType m_RequestedNumberOfRegions;
00256   RegionType m_BufferedRegion;
00257   RegionType m_RequestedRegion;
00258 
00259 private:
00260   PointSet(const Self&); //purposely not implemented
00261   void operator=(const Self&); //purposely not implemented
00262 
00263 }; // End Class: PointSet
00264 
00265 } // end namespace itk
00266 
00267 
00268 // Define instantiation macro for this template.
00269 #define ITK_TEMPLATE_PointSet(_, EXPORT, x, y) namespace itk { \
00270   _(2(class EXPORT PointSet< ITK_TEMPLATE_2 x >)) \
00271   namespace Templates { typedef PointSet< ITK_TEMPLATE_2 x > \
00272                                             PointSet##y; } \
00273   }
00274 
00275 #if ITK_TEMPLATE_EXPLICIT
00276 # include "Templates/itkPointSet+-.h"
00277 #endif
00278 
00279 #if ITK_TEMPLATE_TXX
00280 # include "itkPointSet.txx"
00281 #endif
00282 
00283 /*
00284 #ifndef ITK_MANUAL_INSTANTIATION
00285 #include "itkPointSet.txx"
00286 #endif
00287 */
00288 
00289 
00290 #endif
00291 

Generated at Tue Sep 15 04:22:14 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000