From: jpr Date: Tue, 24 Jul 2007 16:17:04 +0000 (+0000) Subject: We don't switch any longer to ImplicitVR when undocumented DataElement is found X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=7280ce0786e804fdd054debc3f6af18da169ded9;p=gdcm.git We don't switch any longer to ImplicitVR when undocumented DataElement is found (DocEntry::WriteContent puts vr="UN" for undocumented Shadow) --- diff --git a/src/gdcmDocEntry.cxx b/src/gdcmDocEntry.cxx index 3a0ec998..2466076d 100644 --- a/src/gdcmDocEntry.cxx +++ b/src/gdcmDocEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntry.cxx,v $ Language: C++ - Date: $Date: 2007/05/23 14:18:09 $ - Version: $Revision: 1.88 $ + Date: $Date: 2007/07/24 16:17:04 $ + Version: $Revision: 1.89 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -125,14 +125,25 @@ void DocEntry::WriteContent(std::ofstream *fp, FileType filetype) uint16_t zero = 0; uint16_t shortLgr = (uint16_t)lgth; +/* if( IsVRUnknown() ) - { + { // GDCM_VRUNKNOWN was stored in the Entry VR; // deal with Entry as if TS were Implicit VR binary_write(*fp, lgth); } else +*/ + if( IsVRUnknown() ) { + // if VR was not set, we set it to "UN" + // (FileHelper::Write has no longer to switch to ImplicitVR + // when undocumented VR DataElements exist!) + SetVR("UN"); + vr=GetVR(); + } + + //{ binary_write(*fp, vr.str()); // See PS 3.5-2004 page 33, 36 if ( (vr == "SQ") || (vr == "OB") || (vr == "OW") || (vr == "OF") @@ -160,7 +171,7 @@ void DocEntry::WriteContent(std::ofstream *fp, FileType filetype) { binary_write(*fp, shortLgr); } - } + //} } else // IMPLICIT VR { diff --git a/src/gdcmFileHelper.cxx b/src/gdcmFileHelper.cxx index 32f79cb6..d652eba7 100644 --- a/src/gdcmFileHelper.cxx +++ b/src/gdcmFileHelper.cxx @@ -4,8 +4,8 @@ Module: $RCSfile: gdcmFileHelper.cxx,v $ Language: C++ - Date: $Date: 2007/07/13 08:17:21 $ - Version: $Revision: 1.117 $ + Date: $Date: 2007/07/24 16:17:04 $ + Version: $Revision: 1.118 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -728,13 +728,15 @@ bool FileHelper::Write(std::string const &fileName) // Let's just *dream* about it; *never* trust a user ! // We turn to Implicit VR if at least the VR of one element is unknown. - /// \TODO : better we put vr=UN for undocumented Shadow Groups ! - + // Better we let DocEntry::WriteContent to put vr=UN for undocumented Shadow Groups ! + +/* e = FileInternal->GetFirstEntry(); while (e != 0) { if (e->GetVR() == " ") { + SetWriteTypeToDcmImplVR(); SetWriteFileTypeToImplicitVR(); flag = true; @@ -748,8 +750,10 @@ bool FileHelper::Write(std::string const &fileName) SetWriteFileTypeToExplicitVR(); } break; +*/ + + SetWriteFileTypeToExplicitVR(); - SetWriteFileTypeToExplicitVR(); // to see JPRx break; case ACR: case ACR_LIBIDO: