From 18d900c80c604c8ac00a69216be3472b4a00ea77 Mon Sep 17 00:00:00 2001 From: jpr Date: Mon, 21 Nov 2005 12:15:06 +0000 Subject: [PATCH] Deal with VR 'OF' (Other Float String) --- src/gdcmDataEntry.cxx | 14 +++++++------- src/gdcmDocEntry.cxx | 12 ++++++------ src/gdcmVR.cxx | 27 +++++++++++++-------------- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/gdcmDataEntry.cxx b/src/gdcmDataEntry.cxx index a57cb406..f80dd7d2 100644 --- a/src/gdcmDataEntry.cxx +++ b/src/gdcmDataEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDataEntry.cxx,v $ Language: C++ - Date: $Date: 2005/11/21 09:46:24 $ - Version: $Revision: 1.22 $ + Date: $Date: 2005/11/21 12:15:06 $ + Version: $Revision: 1.23 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -286,14 +286,15 @@ uint32_t DataEntry::GetValueCount( ) const return GetLength()/sizeof(uint16_t); else if( vr == "UL" || vr == "SL" ) return GetLength()/sizeof(uint32_t); - else if( vr == "FL" ) - return GetLength()/sizeof(float); + else if( vr == "FL" || vr == "OF" ) + return GetLength()/4 ; // FL has a *4* length! sizeof(float); else if( vr == "FD" ) - return GetLength()/sizeof(double); + return GetLength()/8; // FD has a *8* length! sizeof(double); else if( Global::GetVR()->IsVROfStringRepresentable(vr) ) { // Some element in DICOM are allowed to be empty - if( !GetLength() ) return 0; + if( !GetLength() ) + return 0; // Don't use std::string to accelerate processing uint32_t count = 1; for(uint32_t i=0;i uncomment or remove comment ! + + // See PS 3.5-2004 page 33, 36 + if ( (vr == "SQ") || (vr == "OB") || (vr == "OW") || (vr == "OF") + || (vr == "UN") || (vr == "UT") ) { binary_write(*fp, zero); if (vr == "SQ") diff --git a/src/gdcmVR.cxx b/src/gdcmVR.cxx index 839e1617..6db25da4 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/26 08:04:16 $ - Version: $Revision: 1.47 $ + Date: $Date: 2005/11/21 12:15:06 $ + Version: $Revision: 1.48 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -108,16 +108,14 @@ bool VR::IsVROfBinaryRepresentable(VRKey const &tested) */ bool VR::IsVROfStringRepresentable(VRKey const &tested) { - //FIXME : either you consider than US, UL, SS, SL *are* string representable - // and you have to add FD and FL - // or you consider they are not, and you have to remove them - // (I cannot guess your point, reading gdcmDataEntry code :-( ) JPR - +/* return tested == "AE" || tested == "AS" || tested == "CS" || tested == "DA" || tested == "DS" || + tested == "FL" || + tested == "FD" || tested == "IS" || tested == "LO" || tested == "LT" || @@ -131,17 +129,15 @@ bool VR::IsVROfStringRepresentable(VRKey const &tested) tested == "UL" || tested == "US" || tested == "UT"; +*/ + // Should be quicker - // Should be quicker --> But it doesn't work : revert to old code -/* - return tested != "FL" && - tested != "FD" && - tested != "OB" && + return tested != "OB" && tested != "OW" && - tested != "AT" && // Attribute Tag ?!? + tested != "OF" && + tested != "AT" && // Attribute Tag ?!? contain no printable character tested != "UN" && // UN is an actual VR ! tested != "SQ" ; -*/ } /// \brief returns the length of a elementary elem whose VR is passed unsigned short VR::GetAtomicElementLength(VRKey const &tested) @@ -161,6 +157,9 @@ unsigned short VR::GetAtomicElementLength(VRKey const &tested) // Word string if( tested == "OW" ) return 2; + // Float string + if( tested == "OF" ) + return 4; return 1; } -- 2.45.1