From: tbaudier Date: Mon, 15 Jan 2018 10:36:32 +0000 (+0100) Subject: Exception when tag is not found X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=5fc768ca866b12e269541393e3bbe99322d26a1a;p=clitk.git Exception when tag is not found --- diff --git a/tools/clitkImageConvertGenericFilter.cxx b/tools/clitkImageConvertGenericFilter.cxx index 1e95a7b..51a43a0 100644 --- a/tools/clitkImageConvertGenericFilter.cxx +++ b/tools/clitkImageConvertGenericFilter.cxx @@ -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 sqf = DIS.GetValueAsSQ(); gdcm::Item & item = sqf->GetItem(1); gdcm::DataSet & ds_position = item.GetNestedDataSet();