]> Creatis software - clitk.git/blob - common/clitkDicomRT_Contour.h
From Benoit P, use clitkDicomRTStruct2Image with image with direction cosine
[clitk.git] / common / clitkDicomRT_Contour.h
1 /*=========================================================================
2   Program:         vv http://www.creatis.insa-lyon.fr/rio/vv
3   Main authors :   XX XX XX
4
5   Authors belongs to: 
6   - University of LYON           http://www.universite-lyon.fr/
7   - Léon Bérard cancer center    http://www.centreleonberard.fr
8   - CREATIS CNRS laboratory      http://www.creatis.insa-lyon.fr
9
10   This software is distributed WITHOUT ANY WARRANTY; without even
11   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12   PURPOSE.  See the copyright notices for more information.
13
14   It is distributed under dual licence
15   - BSD       http://www.opensource.org/licenses/bsd-license.php
16   - CeCILL-B  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17
18   =========================================================================*/
19
20 #ifndef CLITKDICOMRT_CONTOUR_H
21 #define CLITKDICOMRT_CONTOUR_H
22
23 #include "clitkCommon.h" 
24 #include <gdcmFile.h>
25 #if GDCM_MAJOR_VERSION >= 2
26 #else
27 #include <gdcm.h>
28 #include <gdcmSQItem.h>
29 #endif
30 #include <vtkPoints.h>
31 #include <vtkPolyData.h>
32 #include <vtkSmartPointer.h>
33 #include <vtkMatrix4x4.h>
34
35 namespace clitk {
36
37 //--------------------------------------------------------------------
38 class DicomRT_Contour : public itk::LightObject{
39   
40 public:
41   typedef DicomRT_Contour Self;
42   typedef itk::SmartPointer<Self> Pointer;
43   itkNewMacro(Self);
44
45   void Print(std::ostream & os = std::cout) const;
46
47 #if GDCM_MAJOR_VERSION >= 2
48   bool Read(gdcm::Item * item);
49   void UpdateDicomItem();
50 #else
51   bool Read(gdcm::SQItem * item);
52 #endif
53
54   vtkPolyData * GetMesh();
55   void SetMesh(vtkPolyData * mesh);
56   vtkPoints * GetPoints() {return mData;}
57   double GetZ() const {return mZ;}
58   void SetTransformMatrix(vtkMatrix4x4* matrix);
59   double GetTolerance();
60   void SetTolerance(double tol);
61   
62   
63 protected:
64   void ComputeMeshFromDataPoints();
65   void ComputeDataPointsFromMesh();
66   unsigned int mNbOfPoints;
67   std::string mType;
68   vtkSmartPointer<vtkPoints> mData;
69   vtkSmartPointer<vtkPolyData> mMesh;
70   vtkSmartPointer<vtkPoints> mPoints;
71   vtkSmartPointer<vtkMatrix4x4> mTransformMatrix;
72   bool mMeshIsUpToDate;
73   ///Z location of the contour
74   double mZ;
75   double mTolerance;
76   
77 #if GDCM_MAJOR_VERSION >= 2
78   gdcm::Item * mItem;
79 #else
80   gdcm::SQItem * mItem;
81 #endif
82
83 private:
84   DicomRT_Contour();
85   ~DicomRT_Contour();
86 };
87 //--------------------------------------------------------------------
88
89
90
91 } // end namespace clitk
92 #endif // CLITKDICOMRT_CONTOUR_H
93