]> Creatis software - clitk.git/blobdiff - tools/clitkImageConvertGenericFilter.cxx
With ITK 5, add itkReadRawBytesAfterSwappingMacro and itkWriteRawBytesAfterSwappingMacro
[clitk.git] / 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();