From f541928adfc662b7ae54169e75d2bcf05566b724 Mon Sep 17 00:00:00 2001 From: regrain Date: Fri, 21 Oct 2005 08:28:01 +0000 Subject: [PATCH] * Fix bug when reading the DicomVR.dic file -- BeNours --- Dicts/dicomVR.dic | 1 - Testing/TestVR.cxx | 9 ++++++--- src/gdcmVR.cxx | 15 ++++++++------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Dicts/dicomVR.dic b/Dicts/dicomVR.dic index 6a1f2277..7e30c6e7 100644 --- a/Dicts/dicomVR.dic +++ b/Dicts/dicomVR.dic @@ -24,4 +24,3 @@ UL Unsigned Long; // Exactly 4 bytes UN Unknown; // Any length of bytes US Unsigned Short; // Exactly 2 bytes UT Unlimited Text; // At most 2^32 -1 chars - diff --git a/Testing/TestVR.cxx b/Testing/TestVR.cxx index c72f5421..303ec22d 100644 --- a/Testing/TestVR.cxx +++ b/Testing/TestVR.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestVR.cxx,v $ Language: C++ - Date: $Date: 2005/10/20 15:05:15 $ - Version: $Revision: 1.9 $ + Date: $Date: 2005/10/21 08:28:02 $ + Version: $Revision: 1.10 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -16,12 +16,15 @@ =========================================================================*/ #include "gdcmVR.h" +#include "gdcmDebug.h" int TestVR(int , char *[]) { int error = 0; gdcm::VR *vr = new gdcm::VR(); + gdcm::Debug::DebugOn(); + // There should be 16 entries ... vr->Print( std::cout ); @@ -48,7 +51,7 @@ int TestVR(int , char *[]) } if( vr->IsValidVR( "\000/" ) ) { - std::cerr << "'\000/' is a valid VR" << std::endl; + std::cerr << "' /' is a valid VR" << std::endl; error++; } if( vr->IsValidVR( gdcm::GDCM_VRUNKNOWN ) ) diff --git a/src/gdcmVR.cxx b/src/gdcmVR.cxx index e0919086..29670812 100644 --- a/src/gdcmVR.cxx +++ b/src/gdcmVR.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmVR.cxx,v $ Language: C++ - Date: $Date: 2005/10/20 14:45:11 $ - Version: $Revision: 1.44 $ + Date: $Date: 2005/10/21 08:28:03 $ + Version: $Revision: 1.45 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -23,6 +23,7 @@ #include #include +#include namespace gdcm { @@ -42,7 +43,7 @@ VR::VR() std::ifstream from(filename.c_str()); if ( !from ) { - gdcmWarningMacro("Can't open dictionary" << filename.c_str()); + gdcmWarningMacro("Can't open dictionary " << filename.c_str()); FillDefaultVRDict(vr); } else @@ -55,6 +56,9 @@ VR::VR() { from >> std::ws; from.getline(buff, 1024, ' '); + if( strcmp(buff,"") == 0) + continue; + key = buff; from >> std::ws; from.getline(buff, 1024, ';'); @@ -63,10 +67,7 @@ VR::VR() from >> std::ws; from.getline(buff, 1024, '\n'); - if ( key != "" ) - { - vr[key] = name; - } + vr[key] = name; } from.close(); } -- 2.45.1