]> Creatis software - clitk.git/commitdiff
Exception when tag is not found
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Mon, 15 Jan 2018 10:36:32 +0000 (11:36 +0100)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Mon, 15 Jan 2018 10:36:32 +0000 (11:36 +0100)
tools/clitkImageConvertGenericFilter.cxx

index 1e95a7bb53ca9e29408850e90cb4c5bd82ff877f..51a43a029a60fa239ebd0840465751af3198cd63 100644 (file)
@@ -148,6 +148,10 @@ void clitk::ImageConvertGenericFilter::UpdateWithInputImageType()
       // Read the attribute  Image Position (Patient)
       gdcm::Tag  DetectorInformationSequenceTag(0x0054,0x0022);
       const gdcm::DataElement & DIS = ds.GetDataElement(DetectorInformationSequenceTag);
+      if (!DIS.GetByteValue()) {
+        std::cout << "Error: could not find 0x0054,0x0022 tag. Abort." << std::endl;
+        exit(0);
+      }
       gdcm::SmartPointer<gdcm::SequenceOfItems> sqf = DIS.GetValueAsSQ();
       gdcm::Item & item = sqf->GetItem(1);
       gdcm::DataSet & ds_position = item.GetNestedDataSet();