X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkImage2DicomRTStructFilter.txx;h=1b241a99824a233a094058f1b8196d09c4e99772;hb=f4ee750a005c1406848ffdfd85a0ebcbe824bca6;hp=051211b6d0d325fa882875b86fc02f861035f8b3;hpb=93b8df062a36ca152f3cb20d08ea9b9ce9c1e45f;p=clitk.git diff --git a/common/clitkImage2DicomRTStructFilter.txx b/common/clitkImage2DicomRTStructFilter.txx index 051211b..1b241a9 100644 --- a/common/clitkImage2DicomRTStructFilter.txx +++ b/common/clitkImage2DicomRTStructFilter.txx @@ -88,10 +88,22 @@ clitk::Image2DicomRTStructFilter::SetROIName(std::string name, std::s template void clitk::Image2DicomRTStructFilter::Update() { + // Check this is a RT-Struct + gdcm::Reader gdcm_reader; + gdcm_reader.SetFileName(m_StructureSetFilename.c_str()); + if (!gdcm_reader.Read()) { + clitkExceptionMacro("Error could not open the file '" << m_StructureSetFilename << std::endl); + } + gdcm::MediaStorage ms; + ms.SetFromFile(gdcm_reader.GetFile()); + if (ms != gdcm::MediaStorage::RTStructureSetStorage) { + clitkExceptionMacro("File '" << m_StructureSetFilename << "' is not a DICOM-RT-Struct file." << std::endl); + } + // Read rt struct vtkSmartPointer reader = vtkGDCMPolyDataReader::New(); reader->SetFileName(m_StructureSetFilename.c_str()); - reader->Update(); + reader->Update(); // Get properties vtkRTStructSetProperties * p = reader->GetRTStructSetProperties();