+ // Write [ Structure Set ROI Sequence ] = 0x3006,0x0020
+ gdcm::DataSet & ds = mFile->GetDataSet();
+ gdcm::Tag tssroisq(0x3006,0x0020);
+ const gdcm::DataElement &ssroisq = ds.GetDataElement( tssroisq );
+ gdcm::DataElement de(ssroisq);
+ de.SetValue(*mROIInfoSequenceOfItems);
+ ds.Replace(de);
+
+ // Write [ ROI Contour Sequence ] = 0x3006,0x0039
+ DD("ici");
+ gdcm::Tag troicsq(0x3006,0x0039);
+ const gdcm::DataElement &roicsq = ds.GetDataElement( troicsq );
+ gdcm::DataElement de2(roicsq);
+ de2.SetValue(*mROIContoursSequenceOfItems);
+ ds.Replace(de2);
+
+ //DEBUG
+ gdcm::DataSet & a = mROIContoursSequenceOfItems->GetItem(1).GetNestedDataSet();
+ gdcm::Tag tcsq(0x3006,0x0040);
+ const gdcm::DataElement& csq = a.GetDataElement( tcsq );
+ gdcm::SmartPointer<gdcm::SequenceOfItems> sqi2 = csq.GetValueAsSQ();
+ gdcm::Item & j = sqi2->GetItem(1);
+ gdcm::DataSet & b = j.GetNestedDataSet();
+ gdcm::Attribute<0x3006,0x0050> at;
+ gdcm::Tag tcontourdata(0x3006,0x0050);
+ gdcm::DataElement contourdata = b.GetDataElement( tcontourdata );
+ at.SetFromDataElement( contourdata );
+ const double* points = at.GetValues();
+ DD(points[0]);
+
+
+ // Write dicom
+ gdcm::Writer writer;
+ //writer.CheckFileMetaInformationOff();
+ writer.SetFileName(filename.c_str());
+ writer.SetFile(*mFile);
+ DD("before write");
+ writer.Write();
+ DD("End write");
+#else
+ FATAL("Sorry not compatible with GDCM1, use GDCM2");
+#endif
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+void clitk::DicomRT_StructureSet::Read(const std::string & filename)
+{
+#if CLITK_USE_SYSTEM_GDCM == 1
+ vtkSmartPointer<vtkGDCMPolyDataReader> reader = vtkGDCMPolyDataReader::New();
+ reader->SetFileName(filename.c_str());
+ reader->Update();
+
+ // Get global information
+ vtkRTStructSetProperties * p = reader->GetRTStructSetProperties();
+ mStudyID = p->GetStudyInstanceUID();
+ mStudyDate = p->GetStructureSetDate();
+ mLabel = p->GetStructureSetLabel();
+ mName = p->GetStructureSetName();
+ mTime = p->GetStructureSetTime();
+
+ int n = p->GetNumberOfStructureSetROIs();
+ for(unsigned int i=0; i<n; i++) {
+ // Get the roi number
+ int roinumber = p->GetStructureSetROINumber(i);
+ // Create the roi
+ DicomRT_ROI::Pointer roi = DicomRT_ROI::New();
+ roi->Read(reader, i);
+ // Insert in the map
+ mROIs[roinumber] = roi;
+ }
+ return;
+#endif // END version with system gdcm (vtkGDCMPolyDataReader)
+
+
+ // Open DICOM
+#if GDCM_MAJOR_VERSION == 2
+ FATAL("Error : compile vv with itk4 + external gdcm");
+
+ // Read gdcm file
+ mReader = new gdcm::Reader;
+ mReader->SetFileName(filename.c_str());
+ mReader->Read();
+ mFile = &(mReader->GetFile());
+ const gdcm::DataSet & ds = mFile->GetDataSet();
+