ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkPointSet.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 /*=========================================================================
00019  *
00020  *  Portions of this file are subject to the VTK Toolkit Version 3 copyright.
00021  *
00022  *  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00023  *
00024  *  For complete copyright, license and disclaimer of warranty information
00025  *  please refer to the NOTICE file at the top of the ITK source tree.
00026  *
00027  *=========================================================================*/
00028 #ifndef __itkPointSet_h
00029 #define __itkPointSet_h
00030 
00031 #include "itkDataObject.h"
00032 #include "itkDefaultStaticMeshTraits.h"
00033 #include <vector>
00034 #include <set>
00035 
00036 namespace itk
00037 {
00044 template< typename TPointSet >
00045 struct GetPointSetDimension {
00046   itkStaticConstMacro(PointDimension, unsigned int,  TPointSet::PointDimension);
00047 };
00048 
00096 template<
00097   typename TPixelType,
00098   unsigned int VDimension = 3,
00099   typename TMeshTraits = DefaultStaticMeshTraits< TPixelType, VDimension, VDimension >
00100   >
00101 class ITK_EXPORT PointSet:public DataObject
00102 {
00103 public:
00105   typedef PointSet                   Self;
00106   typedef DataObject                 Superclass;
00107   typedef SmartPointer< Self >       Pointer;
00108   typedef SmartPointer< const Self > ConstPointer;
00109 
00111   itkNewMacro(Self);
00112 
00114   itkTypeMacro(PointSet, Object);
00115 
00117   typedef TMeshTraits                    MeshTraits;
00118   typedef typename MeshTraits::PixelType PixelType;
00119 
00121   typedef typename MeshTraits::CoordRepType       CoordRepType;
00122   typedef typename MeshTraits::PointIdentifier    PointIdentifier;
00123   typedef typename MeshTraits::PointType          PointType;
00124   typedef typename MeshTraits::PointsContainer    PointsContainer;
00125   typedef typename MeshTraits::PointDataContainer PointDataContainer;
00126 
00128   itkStaticConstMacro(PointDimension, unsigned int,
00129                       TMeshTraits::PointDimension);
00130 
00132   typedef typename PointsContainer::Pointer         PointsContainerPointer;
00133   typedef typename PointsContainer::ConstPointer    PointsContainerConstPointer;
00134   typedef typename PointDataContainer::Pointer      PointDataContainerPointer;
00135   typedef typename PointDataContainer::ConstPointer PointDataContainerConstPointer;
00136 
00138   typedef typename PointsContainer::ConstIterator    PointsContainerConstIterator;
00139   typedef typename PointsContainer::Iterator         PointsContainerIterator;
00140   typedef typename PointDataContainer::ConstIterator PointDataContainerIterator;
00141 
00143   typedef long RegionType;
00144 
00147   itkGetConstMacro(MaximumNumberOfRegions, RegionType);
00148 protected:
00149 
00152   PointsContainerPointer m_PointsContainer;
00153 
00158   PointDataContainerPointer m_PointDataContainer;
00159 
00160 public:
00162   void PassStructure(Self *inputPointSet);
00163 
00164   virtual void Initialize(void);
00165 
00166   PointIdentifier GetNumberOfPoints(void) const;
00167 
00171   void SetPoints(PointsContainer *);
00172 
00173   PointsContainer * GetPoints(void);
00174 
00175   const PointsContainer * GetPoints(void) const;
00176 
00177   void SetPointData(PointDataContainer *);
00178 
00179   PointDataContainer * GetPointData(void);
00180 
00181   const PointDataContainer * GetPointData(void) const;
00182 
00185   void SetPoint(PointIdentifier, PointType);
00186   bool GetPoint(PointIdentifier, PointType *) const;
00187   PointType GetPoint(PointIdentifier) const;
00189 
00192   void SetPointData(PointIdentifier, PixelType);
00193   bool GetPointData(PointIdentifier, PixelType *) const;
00195 
00197   virtual void UpdateOutputInformation();
00198 
00199   virtual void SetRequestedRegionToLargestPossibleRegion();
00200 
00201   virtual void CopyInformation(const DataObject *data);
00202 
00203   virtual void Graft(const DataObject *data);
00204 
00205   virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
00206 
00207   virtual bool VerifyRequestedRegion();
00208 
00213   virtual void SetRequestedRegion(const DataObject *data);
00214 
00216   virtual void SetRequestedRegion(const RegionType & region);
00217 
00218   itkGetConstMacro(RequestedRegion, RegionType);
00219 
00221   virtual void SetBufferedRegion(const RegionType & region);
00222 
00223   itkGetConstMacro(BufferedRegion, RegionType);
00224 protected:
00226   PointSet();
00227   ~PointSet() {}
00228   virtual void PrintSelf(std::ostream & os, Indent indent) const;
00230 
00231   // If the RegionType is ITK_UNSTRUCTURED_REGION, then the following
00232   // variables represent the maximum number of region that the data
00233   // object can be broken into, which region out of how many is
00234   // currently in the buffered region, and the number of regions and
00235   // the specific region requested for the update. Data objects that
00236   // do not support any division of the data can simply leave the
00237   // MaximumNumberOfRegions as 1. The RequestedNumberOfRegions and
00238   // RequestedRegion are used to define the currently requested
00239   // region. The LargestPossibleRegion is always requested region = 0
00240   // and number of regions = 1;
00241   RegionType m_MaximumNumberOfRegions;
00242   RegionType m_NumberOfRegions;
00243   RegionType m_RequestedNumberOfRegions;
00244   RegionType m_BufferedRegion;
00245   RegionType m_RequestedRegion;
00246 private:
00247   PointSet(const Self &);       //purposely not implemented
00248   void operator=(const Self &); //purposely not implemented
00249 };                              // End Class: PointSet
00250 } // end namespace itk
00251 
00252 // Define instantiation macro for this template.
00253 #define ITK_TEMPLATE_PointSet(_, EXPORT, TypeX, TypeY)     \
00254   namespace itk                                            \
00255   {                                                        \
00256   _( 2 ( class EXPORT PointSet< ITK_TEMPLATE_2 TypeX > ) ) \
00257   namespace Templates                                      \
00258   {                                                        \
00259   typedef PointSet< ITK_TEMPLATE_2 TypeX >                 \
00260   PointSet##TypeY;                                       \
00261   }                                                        \
00262   }
00263 
00264 #if ITK_TEMPLATE_EXPLICIT
00265 #include "Templates/itkPointSet+-.h"
00266 #endif
00267 
00268 #if ITK_TEMPLATE_TXX
00269 #include "itkPointSet.hxx"
00270 #endif
00271 
00272 /*
00273 #ifndef ITK_MANUAL_INSTANTIATION
00274 #include "itkPointSet.hxx"
00275 #endif
00276 */
00277 
00278 #endif
00279