]> Creatis software - clitk.git/blob - common/clitkDicomRT_StructureSet.h
Add IsDicomRTStruct (bool)
[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>::iterator ROIIteratorType;
48   typedef std::map<int, clitk::DicomRT_ROI::Pointer>::const_iterator ROIConstIteratorType;
49
50   void Print(std::ostream & os = std::cout) const;
51   void Read(const std::string & filename);
52   bool IsDicomRTStruct(const std::string & filename);
53   void Write(const std::string & filename);
54
55   clitk::DicomRT_ROI * GetROIFromROINumber(int n);
56   std::map<int, clitk::DicomRT_ROI::Pointer> & GetROIs() { return mROIs; }
57   const std::string & GetStudyID() const;
58   const std::string & GetStudyTime() const;
59   const std::string & GetStudyDate() const;
60   const std::string & GetLabel() const;
61   const std::string & GetName() const;
62   const std::string & GetDate() const;
63   const std::string & GetTime() const;
64
65   int AddBinaryImageAsNewROI(vvImage * i, std::string name);
66   
67 #if GDCM_MAJOR_VERSION == 2
68   // Static
69   static int ReadROINumber(const gdcm::Item & item);
70 #endif
71
72 protected:
73   std::string mStudyID;
74   std::string mStudyTime;
75   std::string mStudyDate;
76   std::string mLabel;
77   std::string mName;
78   std::string mDate;
79   std::string mTime;
80
81   std::map<int, clitk::DicomRT_ROI::Pointer> mROIs;
82   std::map<int, std::string> mMapOfROIName;
83 #if GDCM_MAJOR_VERSION == 2
84   gdcm::Reader * mReader;
85   gdcm::SmartPointer<gdcm::SequenceOfItems> mROIInfoSequenceOfItems;
86   gdcm::SmartPointer<gdcm::SequenceOfItems> mROIContoursSequenceOfItems;  
87 #endif
88   gdcm::File * mFile;
89
90 private:
91   DicomRT_StructureSet();
92   ~DicomRT_StructureSet();
93 };
94 //--------------------------------------------------------------------
95
96 } // end namespace clitk
97 #endif // CLITKDICOMRT_STRUCTURESET_H
98