]> Creatis software - clitk.git/blob - common/clitkDicomRT_StructureSet.h
Merge branch 'master' of git.creatis.insa-lyon.fr:clitk
[clitk.git] / common / clitkDicomRT_StructureSet.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_STRUCTURESET_H
21 #define CLITKDICOMRT_STRUCTURESET_H
22
23 // clitk
24 #include "clitkCommon.h" 
25 #include "clitkDicomRT_ROI.h"
26
27 // vv
28 #include "vvImage.h"
29
30 // gdcm
31 #include "clitkConfiguration.h"
32 #if CLITK_USE_SYSTEM_GDCM == 1
33 #include <vtkGDCMPolyDataReader.h>
34 #include <vtkRTStructSetProperties.h>
35 #endif
36
37 // gdcm
38 #if GDCM_MAJOR_VERSION == 2
39 // This is not use if CLITK_USE_SYSTEM_GDCM==1
40 #include "gdcmReader.h"
41 #include "gdcmWriter.h"
42 #include "gdcmAttribute.h"
43 #endif
44
45 namespace clitk {
46
47 //--------------------------------------------------------------------
48 class DicomRT_StructureSet : public itk::LightObject{
49   
50 public:
51   typedef DicomRT_StructureSet Self;
52   typedef itk::SmartPointer<Self> Pointer;
53   itkNewMacro(Self);
54
55   typedef std::map<int, clitk::DicomRT_ROI::Pointer> ROIMapContainer;
56   typedef ROIMapContainer::iterator ROIIteratorType;
57   typedef ROIMapContainer::const_iterator ROIConstIteratorType;
58
59   void Print(std::ostream & os = std::cout) const;
60   void Read(const std::string & filename);
61   bool IsDicomRTStruct(const std::string & filename);
62   void Write(const std::string & filename);
63
64   clitk::DicomRT_ROI * GetROIFromROINumber(int n);
65   clitk::DicomRT_ROI* GetROIFromROIName(const std::string& name);
66   //clitk::DicomRT_ROI* GetROIFromROINameRegEx(const std::string& regEx);
67   clitk::DicomRT_ROI* GetROIFromROINameSubstr(const std::string& s);
68   ROIMapContainer * GetROIsFromROINameSubstr(const std::string& s);
69   ROIMapContainer & GetROIs() { return mROIs; }
70   const std::string & GetStudyID() const;
71   const std::string & GetStudyTime() const;
72   const std::string & GetStudyDate() const;
73   const std::string & GetLabel() const;
74   const std::string & GetName() const;
75   const std::string & GetDate() const;
76   const std::string & GetTime() const;
77
78   int AddBinaryImageAsNewROI(vvImage * i, std::string name);
79   
80 #if GDCM_MAJOR_VERSION == 2
81   // Static
82   static int ReadROINumber(const gdcm::Item & item);
83 #endif
84
85 protected:
86   std::string mStudyID;
87   std::string mStudyTime;
88   std::string mStudyDate;
89   std::string mLabel;
90   std::string mName;
91   std::string mDate;
92   std::string mTime;
93
94   std::map<int, clitk::DicomRT_ROI::Pointer> mROIs;
95   std::map<int, std::string> mMapOfROIName;
96 #if GDCM_MAJOR_VERSION == 2
97   gdcm::Reader * mReader;
98   gdcm::SmartPointer<gdcm::SequenceOfItems> mROIInfoSequenceOfItems;
99   gdcm::SmartPointer<gdcm::SequenceOfItems> mROIContoursSequenceOfItems;  
100 #endif
101   gdcm::File * mFile;
102
103 private:
104   DicomRT_StructureSet();
105   ~DicomRT_StructureSet();
106 };
107 //--------------------------------------------------------------------
108
109 } // end namespace clitk
110 #endif // CLITKDICOMRT_STRUCTURESET_H
111