1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
3 Main authors : XX XX XX
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
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.
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
18 =========================================================================*/
20 #ifndef CLITKDICOMRT_ROI_H
21 #define CLITKDICOMRT_ROI_H
23 #include "clitkDicomRT_Contour.h"
26 #include <vtkMatrix4x4.h>
27 #include "clitkConfiguration.h"
28 #if CLITK_USE_SYSTEM_GDCM == 1
29 #include <vtkGDCMPolyDataReader.h>
30 #include <vtkRTStructSetProperties.h>
35 //--------------------------------------------------------------------
36 class DicomRT_ROI : public itk::LightObject
40 typedef DicomRT_ROI Self;
41 typedef itk::SmartPointer<Self> Pointer;
44 void Print(std::ostream & os = std::cout) const;
45 void SetFromBinaryImage(vvImage::Pointer image, int n,
47 std::vector<double> color,
48 std::string filename);
50 int GetROINumber() const;
51 void SetROINumber(int);
52 const std::string & GetName() const;
53 const std::string & GetFilename() const;
54 const std::vector<double> & GetDisplayColor() const;
55 vtkPolyData * GetMesh();
56 vvImage * GetImage() const;
58 void SetDisplayColor(double r, double v, double b);
59 std::vector<double> & GetDisplayColor() { return mColor; }
61 double GetBackgroundValueLabelImage() const;
62 void SetBackgroundValueLabelImage(double bg);
64 double GetForegroundValueLabelImage() const;
65 void SetForegroundValueLabelImage(double bg);
67 void SetImage(vvImage::Pointer im);
68 DicomRT_Contour* GetContour(int n);
70 void SetTransformMatrix(vtkMatrix4x4* matrix);
72 // Compute a vtk mesh from the dicom contours
73 void ComputeMeshFromContour();
74 void ComputeContoursFromImage();
76 // Indicate if the mesh is uptodate according to the dicom
77 void SetDicomUptodateFlag(bool b) { m_DicomUptodateFlag = b; }
78 bool GetDicomUptoDateFlag() const { return m_DicomUptodateFlag; }
79 void SetName(std::string n) { mName = n; }
81 // Read from DICOM RT STRUCT
82 #if GDCM_MAJOR_VERSION == 2
83 bool Read(gdcm::Item * itemInfo, gdcm::Item * itemContour);
84 void UpdateDicomItem();
86 void Read(std::map<int, std::string> & rois, gdcm::SQItem * item);
89 #if CLITK_USE_SYSTEM_GDCM == 1
90 void Read(vtkSmartPointer<vtkGDCMPolyDataReader> & reader, int roiindex);
95 std::string mFilename;
97 std::vector<double> mColor;
98 std::vector<DicomRT_Contour::Pointer> mListOfContours;
99 vtkSmartPointer<vtkPolyData> mMesh;
100 vtkSmartPointer<vtkMatrix4x4> mTransformMatrix;
101 bool mMeshIsUpToDate;
102 vvImage::Pointer mImage;
103 double mBackgroundValue;
104 double mForegroundValue;
105 bool m_DicomUptodateFlag;
107 #if GDCM_MAJOR_VERSION == 2
108 gdcm::Item * mItemInfo;
109 gdcm::Item * mItemContour;
110 gdcm::SmartPointer<gdcm::SequenceOfItems> mContoursSequenceOfItems;
117 //--------------------------------------------------------------------
119 } // end namespace clitk
120 #endif // CLITKDICOMRT_ROI_H