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"
28 //--------------------------------------------------------------------
29 class DicomRT_ROI : public itk::LightObject
33 typedef DicomRT_ROI Self;
34 typedef itk::SmartPointer<Self> Pointer;
37 void Print(std::ostream & os = std::cout) const;
38 void SetFromBinaryImage(vvImage::Pointer image, int n,
40 std::vector<double> color,
41 std::string filename);
43 int GetROINumber() const;
44 const std::string & GetName() const;
45 const std::string & GetFilename() const;
46 const std::vector<double> & GetDisplayColor() const;
47 vtkPolyData * GetMesh();
48 vvImage * GetImage() const;
50 void SetDisplayColor(double r, double v, double b);
51 std::vector<double> & GetDisplayColor() { return mColor; }
53 double GetBackgroundValueLabelImage() const;
54 void SetBackgroundValueLabelImage(double bg);
56 double GetForegroundValueLabelImage() const;
57 void SetForegroundValueLabelImage(double bg);
59 void SetImage(vvImage::Pointer im);
60 DicomRT_Contour* GetContour(int n);
62 // Compute a vtk mesh from the dicom contours
63 void ComputeMeshFromContour();
64 void ComputeContoursFromImage();
66 // Indicate if the mesh is uptodate according to the dicom
67 void SetDicomUptodateFlag(bool b) { m_DicomUptodateFlag = b; }
68 bool GetDicomUptoDateFlag() const { return m_DicomUptodateFlag; }
69 void SetName(std::string n) { mName = n; }
71 // Read from DICOM RT STRUCT
72 #if GDCM_MAJOR_VERSION == 2
73 bool Read(gdcm::Item * itemInfo, gdcm::Item * itemContour);
74 void UpdateDicomItem();
76 void Read(std::map<int, std::string> & rois, gdcm::SQItem * item);
81 std::string mFilename;
83 std::vector<double> mColor;
84 std::vector<DicomRT_Contour::Pointer> mListOfContours;
85 vtkSmartPointer<vtkPolyData> mMesh;
87 vvImage::Pointer mImage;
88 double mBackgroundValue;
89 double mForegroundValue;
90 bool m_DicomUptodateFlag;
92 #if GDCM_MAJOR_VERSION == 2
93 gdcm::Item * mItemInfo;
94 gdcm::Item * mItemContour;
95 gdcm::SmartPointer<gdcm::SequenceOfItems> mContoursSequenceOfItems;
102 //--------------------------------------------------------------------
104 } // end namespace clitk
105 #endif // CLITKDICOMRT_ROI_H