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