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

itkBinaryMask3DMeshSource.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkBinaryMask3DMeshSource.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/23 21:50:46 $
00007   Version:   $Revision: 1.6 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkBinaryMask3DMeshSource_h
00018 #define __itkBinaryMask3DMeshSource_h
00019 
00020 #include "vnl/vnl_matrix_fixed.h"
00021 #include "itkMesh.h"
00022 #include "itkMeshSource.h"
00023 #include "itkVector.h"
00024 #include "itkCellInterface.h"
00025 #include "itkTriangleCell.h"
00026 #include "itkCovariantVector.h"
00027 #include "itkDefaultStaticMeshTraits.h"
00028 #include "itkImageRegionIterator.h"
00029 
00030 namespace itk
00031 {
00032 
00044 template <class TOutputMesh>
00045 class ITK_EXPORT BinaryMask3DMeshSource : public MeshSource<TOutputMesh>
00046 {
00047 public:
00049   typedef BinaryMask3DMeshSource         Self;
00050   typedef MeshSource<TOutputMesh>  Superclass;
00051   typedef SmartPointer<Self>  Pointer;
00052   typedef SmartPointer<const Self>  ConstPointer;
00053 
00055   itkNewMacro(Self);  
00056 
00058   itkTypeMacro(BinaryMask3DMeshSource, MeshSource);
00059 
00061   typedef TOutputMesh OutputMeshType;
00062   typedef typename OutputMeshType::MeshTraits   OMeshTraits;
00063   typedef typename OutputMeshType::PointType    OPointType;
00064   typedef typename OMeshTraits::PixelType       OPixelType;  
00065 
00067   typedef typename OutputMeshType::Pointer OutputMeshPointer;
00068   typedef typename OutputMeshType::CellTraits CellTraits;
00069   typedef typename OutputMeshType::PointsContainerPointer PointsContainerPointer;
00070   typedef typename OutputMeshType::PointsContainer   PointsContainer;
00071   typedef typename OutputMeshType::CellsContainerPointer CellsContainerPointer;
00072   typedef typename OutputMeshType::CellsContainer   CellsContainer;
00073   typedef CovariantVector<double, 2>     doubleVector;
00074   typedef CovariantVector<int, 2>        intVector;
00075   
00078   typedef CellInterface<OPixelType, CellTraits>  TCellInterface;
00079   typedef TriangleCell<TCellInterface> TriCell;
00080   typedef typename TriCell::SelfAutoPointer TriCellAutoPointer;
00081 
00082 
00083   typedef Image<unsigned short, 3> BinaryImageType;
00086   typedef typename BinaryImageType::Pointer         BinaryImagePointer;
00087      
00089   typedef typename BinaryImageType::IndexType       BinaryImageIndexType;
00090 
00091   typedef ImageRegionIterator<BinaryImageType> BinaryImageIterator;
00092 
00093   itkSetMacro(BinaryImage, BinaryImageType::Pointer);
00094   itkSetMacro(ObjectValue, unsigned char);
00095 
00096   itkGetMacro(NumberOfNodes, unsigned long);
00097   itkGetMacro(NumberOfCells, unsigned long);
00098 
00099 protected:
00100   BinaryMask3DMeshSource();
00101   ~BinaryMask3DMeshSource() {};
00102   void PrintSelf(std::ostream& os, Indent indent) const;
00103 
00104   void GenerateData();
00105 
00106 private:
00107   BinaryMask3DMeshSource(const Self&); //purposely not implemented
00108   void operator=(const Self&); //purposely not implemented
00109 
00110   typedef typename BinaryImageType::SizeType BinaryImageSizeType;
00111 
00112   void CreateMesh();
00113   void XFlip ( unsigned char *tp );
00114   void YFlip ( unsigned char *tp );
00115   void ZFlip ( unsigned char *tp );
00116   void XRotation ( unsigned char *tp );
00117   void YRotation ( unsigned char *tp );
00118   void ZRotation ( unsigned char *tp );
00119   void inverse ( unsigned char *tp );
00120   void InitializeLUT();
00121   void AddCells( unsigned char celltype, unsigned char celltran, int index );
00122   void AddNodes( int index, unsigned char *nodesid, unsigned long *globalnodesid, unsigned long **currentrowtmp, unsigned long **currentframetmp );
00123   void CellTransfer( unsigned char *nodesid, unsigned char celltran );
00124   unsigned long SearchThroughLastRow( int index, int start, int end );
00125   unsigned long SearchThroughLastFrame( int index, int start, int end );
00126 
00127   unsigned char m_LUT[256][2];
00128 
00129   unsigned long m_LastVoxel[14];
00130   unsigned long m_CurrentVoxel[14];
00131 
00132   unsigned long **m_LastRow;
00133   unsigned long **m_LastFrame;
00134   unsigned long **m_CurrentRow;
00135   unsigned long **m_CurrentFrame;
00136 
00137   unsigned short m_CurrentRowIndex;
00138   unsigned short m_CurrentFrameIndex;
00139   unsigned short m_LastRowNum;
00140   unsigned short m_LastFrameNum;
00141   unsigned short m_CurrentRowNum;
00142   unsigned short m_CurrentFrameNum;
00143   unsigned char  m_AvailableNodes[14];
00144 
00145   double m_LocationOffset[14][3];
00146 
00147   unsigned long m_NumberOfNodes;
00148   unsigned long m_NumberOfCells;
00149   int m_NodeLimit;
00150   int m_CellLimit;
00151   int m_ImageWidth;
00152   int m_ImageHeight;
00153   int m_ImageDepth;
00154   int m_ColFlag;
00155   int m_RowFlag;
00156   int m_FrameFlag;
00157   int m_LastRowIndex;
00158   int m_LastVoxelIndex;
00159   int m_LastFrameIndex;
00160   unsigned char m_PointFound;
00161   unsigned char m_ObjectValue;
00162 
00163   BinaryImageType::Pointer m_BinaryImage;
00164 };
00165 
00166 } // end namespace itk
00167 #ifndef ITK_MANUAL_INSTANTIATION
00168 #include "itkBinaryMask3DMeshSource.txx"
00169 #endif
00170 #endif

Generated at Wed Mar 12 01:12:48 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000