00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkRegularSphereMeshSource_h
00018 #define __itkRegularSphereMeshSource_h
00019
00020 #include "itkMesh.h"
00021 #include "itkMeshSource.h"
00022 #include "itkTriangleCell.h"
00023 #include "itkMapContainer.h"
00024
00025 namespace itk
00026 {
00027
00039 template <class TOutputMesh>
00040 class ITK_EXPORT RegularSphereMeshSource : public MeshSource<TOutputMesh>
00041 {
00042 public:
00044 typedef RegularSphereMeshSource Self;
00045 typedef itk::MeshSource<TOutputMesh> Superclass;
00046 typedef itk::SmartPointer<Self> Pointer;
00047 typedef itk::SmartPointer<const Self> ConstPointer;
00048
00050 itkNewMacro(Self);
00051
00053 itkTypeMacro(RegularSphereMeshSource, MeshSource);
00054
00056 typedef TOutputMesh OutputMeshType;
00057 typedef typename OutputMeshType::MeshTraits MeshTraits;
00058 typedef typename OutputMeshType::PointType PointType;
00059 typedef typename MeshTraits::PixelType PixelType;
00060
00062 typedef typename OutputMeshType::Pointer OutputMeshPointer;
00063 typedef typename OutputMeshType::CellTraits CellTraits;
00064 typedef typename OutputMeshType::PointsContainerPointer PointsContainerPointer;
00065 typedef typename OutputMeshType::PointsContainer PointsContainer;
00066
00068 typedef itk::CellInterface<PixelType, CellTraits> CellInterfaceType;
00069 typedef itk::TriangleCell<CellInterfaceType> TriCellType;
00070 typedef typename TriCellType::SelfAutoPointer TriCellAutoPointer;
00071 typedef typename TriCellType::CellAutoPointer CellAutoPointer;
00072
00073 typedef std::pair<unsigned long,unsigned long> IndexPairType;
00074 typedef itk::MapContainer<IndexPairType, unsigned long> PointMapType;
00075 typedef typename PointType::VectorType VectorType;
00076
00077
00080 itkSetMacro(Resolution, unsigned int);
00081 itkGetConstMacro(Resolution, unsigned int);
00083
00085 itkSetMacro( Center, PointType );
00086 itkGetConstMacro( Center, PointType );
00088
00092 itkSetMacro( Scale, VectorType );
00093 itkGetConstMacro( Scale, VectorType );
00095
00096 protected:
00097 RegularSphereMeshSource();
00098 ~RegularSphereMeshSource() {}
00099 void PrintSelf(std::ostream& os, itk::Indent indent) const;
00100
00101 void GenerateData();
00102
00103 PointType Divide( const PointType & p1, const PointType & p2) const;
00104
00105 void AddCell( OutputMeshType * mesh, const unsigned long * pointIds, unsigned long idx);
00106
00108 PointType m_Center;
00109
00111 unsigned int m_Resolution;
00112
00114 VectorType m_Scale;
00115
00116
00117 private:
00118 RegularSphereMeshSource(const Self&);
00119 void operator=(const Self&);
00120 };
00121
00122 }
00123
00124 #ifndef ITK_MANUAL_INSTANTIATION
00125 #include "itkRegularSphereMeshSource.txx"
00126 #endif
00127
00128 #endif //_itkRegularSphereMeshSource_h
00129