]> Creatis software - clitk.git/blob - common/clitkDicomRT_ROI.h
itk4 migration
[clitk.git] / common / clitkDicomRT_ROI.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_ROI_H
21 #define CLITKDICOMRT_ROI_H
22
23 #include "clitkDicomRT_Contour.h"
24 #include "vvImage.h"
25
26 namespace clitk {
27
28 //--------------------------------------------------------------------
29 class DicomRT_ROI : public itk::LightObject
30 {
31   
32 public:
33   typedef DicomRT_ROI Self;
34   typedef itk::SmartPointer<Self> Pointer;
35   itkNewMacro(Self);
36
37   void Print(std::ostream & os = std::cout) const;
38   void SetFromBinaryImage(vvImage * image, int n, 
39         std::string name, 
40         std::vector<double> color, 
41         std::string filename);
42
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;
49
50   void SetDisplayColor(double r, double v, double b);
51   std::vector<double> & GetDisplayColor() { return mColor; }
52   
53   double GetBackgroundValueLabelImage() const;
54   void SetBackgroundValueLabelImage(double bg);
55   
56   double GetForegroundValueLabelImage() const;
57   void SetForegroundValueLabelImage(double bg);
58   
59   void SetImage(vvImage * im);
60   DicomRT_Contour* GetContour(int n);
61
62   // Compute a vtk mesh from the dicom contours
63   void ComputeMeshFromContour();
64   void ComputeContoursFromImage();
65   
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; }
70
71   // Read from DICOM RT STRUCT
72 #if GDCM_MAJOR_VERSION == 2
73   bool Read(gdcm::Item * itemInfo, gdcm::Item * itemContour);
74   void UpdateDicomItem();
75 #else
76   void Read(std::map<int, std::string> & rois, gdcm::SQItem * item);
77 #endif
78
79 protected:
80   std::string mName;
81   std::string mFilename;
82   int mNumber;
83   std::vector<double> mColor;
84   std::vector<DicomRT_Contour::Pointer> mListOfContours;
85   vtkSmartPointer<vtkPolyData> mMesh;
86   bool mMeshIsUpToDate;
87   vvImage::Pointer mImage;
88   double mBackgroundValue;
89   double mForegroundValue;
90   bool m_DicomUptodateFlag;
91
92 #if GDCM_MAJOR_VERSION == 2
93   gdcm::Item * mItemInfo;
94   gdcm::Item * mItemContour;
95   gdcm::SmartPointer<gdcm::SequenceOfItems> mContoursSequenceOfItems;
96 #endif
97
98 private:
99   DicomRT_ROI();
100   ~DicomRT_ROI();
101 };
102 //--------------------------------------------------------------------
103
104 } // end namespace clitk
105 #endif // CLITKDICOMRT_ROI_H
106