X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkDicomRT_StructureSet.cxx;h=51c715e9df875d11ada0f9f518466db15d7a3c46;hb=89a8fa2bb1c1b40c20011729ee6dca940ce96496;hp=761ea23212920d7a5e7c69d8c3060748168e491d;hpb=21cad80313d6f22daabe815127b7c31b907982f7;p=clitk.git diff --git a/common/clitkDicomRT_StructureSet.cxx b/common/clitkDicomRT_StructureSet.cxx index 761ea23..51c715e 100644 --- a/common/clitkDicomRT_StructureSet.cxx +++ b/common/clitkDicomRT_StructureSet.cxx @@ -110,6 +110,8 @@ const std::string & clitk::DicomRT_StructureSet::GetTime() const //-------------------------------------------------------------------- clitk::DicomRT_ROI* clitk::DicomRT_StructureSet::GetROIFromROINumber(int n) { + DD("GetROIFromROINumber"); + DD(n); if (mROIs.find(n) == mROIs.end()) { std::cerr << "No ROI number " << n << std::endl; return NULL; @@ -257,8 +259,10 @@ void clitk::DicomRT_StructureSet::Write(const std::string & filename) } // Loop and update each ROI + int i=0; for(ROIIteratorType iter = mROIs.begin(); iter != mROIs.end(); iter++) { iter->second->UpdateDicomItem(); + i++; } // Write [ Structure Set ROI Sequence ] = 0x3006,0x0020 @@ -310,8 +314,41 @@ void clitk::DicomRT_StructureSet::Write(const std::string & filename) //-------------------------------------------------------------------- void clitk::DicomRT_StructureSet::Read(const std::string & filename) { + DD(GDCM_MAJOR_VERSION); + DD(CLITK_USE_SYSTEM_GDCM); + +#if CLITK_USE_SYSTEM_GDCM == 1 + vtkSmartPointer reader = vtkGDCMPolyDataReader::New(); + reader->SetFileName(filename.c_str()); + reader->Update(); + + // FIXME : check + + // Get global information + // FIXME (could be remove with a single access to properties objet. + 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; iGetStructureSetROINumber(i); + // Create the roi + DicomRT_ROI::Pointer roi = DicomRT_ROI::New(); + roi->Read(reader, i); + // Insert in the map + mROIs[roinumber] = roi; + } +#endif // END version with system gdcm (vtkGDCMPolyDataReader) + + // Open DICOM #if GDCM_MAJOR_VERSION == 2 + // Read gdcm file mReader = new gdcm::Reader; mReader->SetFileName(filename.c_str()); @@ -365,6 +402,16 @@ void clitk::DicomRT_StructureSet::Read(const std::string & filename) // Temporary store the list of items std::map mMapOfROIInfo; std::map mMapOfROIContours; + +std::map mROIs; + std::map mMapOfROIName; +#if GDCM_MAJOR_VERSION == 2 + gdcm::Reader * mReader; + gdcm::SmartPointer mROIInfoSequenceOfItems; + gdcm::SmartPointer mROIContoursSequenceOfItems; +#endif + gdcm::File * mFile; + //---------------------------------- // Read all ROI Names and number