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 "clitkConfiguration.h"
27 #if CLITK_USE_SYSTEM_GDCM == 1
28 #include <vtkGDCMPolyDataReader.h>
29 #include <vtkRTStructSetProperties.h>
34 //--------------------------------------------------------------------
35 class DicomRT_ROI : public itk::LightObject
39 typedef DicomRT_ROI Self;
40 typedef itk::SmartPointer<Self> Pointer;
43 void Print(std::ostream & os = std::cout) const;
44 void SetFromBinaryImage(vvImage::Pointer image, int n,
46 std::vector<double> color,
47 std::string filename);
49 int GetROINumber() const;
50 void SetROINumber(int);
51 const std::string & GetName() const;
52 const std::string & GetFilename() const;
53 const std::vector<double> & GetDisplayColor() const;
54 vtkPolyData * GetMesh();
55 vvImage * GetImage() const;
57 void SetDisplayColor(double r, double v, double b);
58 std::vector<double> & GetDisplayColor() { return mColor; }
60 double GetBackgroundValueLabelImage() const;
61 void SetBackgroundValueLabelImage(double bg);
63 double GetForegroundValueLabelImage() const;
64 void SetForegroundValueLabelImage(double bg);
66 void SetImage(vvImage::Pointer im);
67 DicomRT_Contour* GetContour(int n);
69 // Compute a vtk mesh from the dicom contours
70 void ComputeMeshFromContour();
71 void ComputeContoursFromImage();
73 // Indicate if the mesh is uptodate according to the dicom
74 void SetDicomUptodateFlag(bool b) { m_DicomUptodateFlag = b; }
75 bool GetDicomUptoDateFlag() const { return m_DicomUptodateFlag; }
76 void SetName(std::string n) { mName = n; }
78 // Read from DICOM RT STRUCT
79 #if GDCM_MAJOR_VERSION == 2
80 bool Read(gdcm::Item * itemInfo, gdcm::Item * itemContour);
81 void UpdateDicomItem();
83 void Read(std::map<int, std::string> & rois, gdcm::SQItem * item);
86 #if CLITK_USE_SYSTEM_GDCM == 1
87 void Read(vtkSmartPointer<vtkGDCMPolyDataReader> & reader, int roiindex);
92 std::string mFilename;
94 std::vector<double> mColor;
95 std::vector<DicomRT_Contour::Pointer> mListOfContours;
96 vtkSmartPointer<vtkPolyData> mMesh;
98 vvImage::Pointer mImage;
99 double mBackgroundValue;
100 double mForegroundValue;
101 bool m_DicomUptodateFlag;
103 #if GDCM_MAJOR_VERSION == 2
104 gdcm::Item * mItemInfo;
105 gdcm::Item * mItemContour;
106 gdcm::SmartPointer<gdcm::SequenceOfItems> mContoursSequenceOfItems;
113 //--------------------------------------------------------------------
115 } // end namespace clitk
116 #endif // CLITKDICOMRT_ROI_H