# HG changeset patch # User Sebastien Jodogne # Date 1432119392 -7200 # Node ID d5cd40f12c864c11c9c7c9aae1ba5ed1a5b10879 # Parent 6a29dfe563b3016887f47ca14f78788a3b644f5f fix VR extraction diff -r 6a29dfe563b3 -r d5cd40f12c86 Core/Dicom.cpp --- a/Core/Dicom.cpp Wed May 20 12:09:38 2015 +0200 +++ b/Core/Dicom.cpp Wed May 20 12:56:32 2015 +0200 @@ -177,11 +177,33 @@ { const gdcm::DictEntry &entry = dictionary.GetDictEntry(element.GetTag()); vr = entry.GetVR(); + + if (vr == gdcm::VR::OB_OW) + { + vr = gdcm::VR::OB; + } } isSequence = (vr == gdcm::VR::SQ); - return gdcm::VR::GetVRString(vr); + const char* str = gdcm::VR::GetVRString(vr); + if (isSequence) + { + return str; + } + + if (str == NULL || + strlen(str) != 2 || + !(str[0] >= 'A' && str[0] <= 'Z') || + !(str[1] >= 'A' && str[1] <= 'Z')) + { + printf("[%s]\n", str); + return "UN"; + } + else + { + return str; + } }