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 const std::string & GetName() const;
51 const std::string & GetFilename() const;
52 const std::vector<double> & GetDisplayColor() const;
53 vtkPolyData * GetMesh();
54 vvImage * GetImage() const;
56 void SetDisplayColor(double r, double v, double b);
57 std::vector<double> & GetDisplayColor() { return mColor; }
59 double GetBackgroundValueLabelImage() const;
60 void SetBackgroundValueLabelImage(double bg);
62 double GetForegroundValueLabelImage() const;
63 void SetForegroundValueLabelImage(double bg);
65 void SetImage(vvImage::Pointer im);
66 DicomRT_Contour* GetContour(int n);
68 // Compute a vtk mesh from the dicom contours
69 void ComputeMeshFromContour();
70 void ComputeContoursFromImage();
72 // Indicate if the mesh is uptodate according to the dicom
73 void SetDicomUptodateFlag(bool b) { m_DicomUptodateFlag = b; }
74 bool GetDicomUptoDateFlag() const { return m_DicomUptodateFlag; }
75 void SetName(std::string n) { mName = n; }
77 // Read from DICOM RT STRUCT
78 #if GDCM_MAJOR_VERSION == 2
79 bool Read(gdcm::Item * itemInfo, gdcm::Item * itemContour);
80 void UpdateDicomItem();
82 void Read(std::map<int, std::string> & rois, gdcm::SQItem * item);
85 #if CLITK_USE_SYSTEM_GDCM == 1
86 void Read(vtkSmartPointer<vtkGDCMPolyDataReader> & reader, int roiindex);
91 std::string mFilename;
93 std::vector<double> mColor;
94 std::vector<DicomRT_Contour::Pointer> mListOfContours;
95 vtkSmartPointer<vtkPolyData> mMesh;
97 vvImage::Pointer mImage;
98 double mBackgroundValue;
99 double mForegroundValue;
100 bool m_DicomUptodateFlag;
102 #if GDCM_MAJOR_VERSION == 2
103 gdcm::Item * mItemInfo;
104 gdcm::Item * mItemContour;
105 gdcm::SmartPointer<gdcm::SequenceOfItems> mContoursSequenceOfItems;
112 //--------------------------------------------------------------------
114 } // end namespace clitk
115 #endif // CLITKDICOMRT_ROI_H