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