From: jpr Date: Mon, 28 Jun 2004 11:01:18 +0000 (+0000) Subject: FIX : odd length of string corresponding to an integer pb X-Git-Tag: Version0.5.bp~81 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;ds=sidebyside;h=88c95542d85bc7a28c553eb406962667e7d84411;p=gdcm.git FIX : odd length of string corresponding to an integer pb --- diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index 4123b5e7..258dcff8 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.cxx,v $ Language: C++ - Date: $Date: 2004/06/28 09:51:02 $ - Version: $Revision: 1.37 $ + Date: $Date: 2004/06/28 11:01:18 $ + Version: $Revision: 1.38 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -821,11 +821,10 @@ bool gdcmDocument::SetEntryByNumber(std::string content, " ValEntry (try promotion first)."); return false; } - // Non even content must be padded with a space (020H). - if((content.length())%2) + if((content.length())%2) { content = content + '\0'; - + } ValEntry->SetValue(content); // Integers have a special treatement for their length: diff --git a/src/gdcmHeader.cxx b/src/gdcmHeader.cxx index 243b59cc..7fdcda0b 100644 --- a/src/gdcmHeader.cxx +++ b/src/gdcmHeader.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmHeader.cxx,v $ Language: C++ - Date: $Date: 2004/06/28 09:51:02 $ - Version: $Revision: 1.171 $ + Date: $Date: 2004/06/28 11:01:18 $ + Version: $Revision: 1.172 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -88,11 +88,12 @@ gdcmHeader::~gdcmHeader () { /** - * \brief Writes in a file all the Header Entries (Dicom Elements) + * \brief Performs some consistency checking on various 'File related' + * (as opposed to 'DicomDir related') entries + * then writes in a file all the (Dicom Elements) included the Pixels * @param fp file pointer on an already open file * @param filetype Type of the File to be written * (ACR-NEMA, ExplicitVR, ImplicitVR) - * \return Always true. */ void gdcmHeader::Write(FILE* fp,FileType filetype) { @@ -103,9 +104,6 @@ void gdcmHeader::Write(FILE* fp,FileType filetype) { // correct Pixel group Length if necessary - //guint16 GrPixel = 0x7fe0; - //guint16 NumPixel = 0x0010; - // TODO : create a gdcmHeader::Write method and move this part. // (only gdcmHeader knows GrPixel, NumPixel) @@ -120,11 +118,7 @@ void gdcmHeader::Write(FILE* fp,FileType filetype) { // Drop Palette Color, if necessary - // FIXME : Why is it always false ??? - - // std::cout << "entry 0x0028,0x0002 " << GetEntryByNumber(0x0028,0x0002).c_str() << std::endl; - - /* if ( GetEntryByNumber(0x0028,0x0002).c_str() == "3" ) */{ + if ( GetEntryByNumber(0x0028,0x0002).c_str()[0] == '3' ) { // Drop 0028|1101, 0028|1102, 0028|1103 // Drop 0028|1201, 0028|1202, 0028|1203 @@ -152,7 +146,6 @@ void gdcmHeader::Write(FILE* fp,FileType filetype) { } gdcmDocument::Write(fp,filetype); } -// ----------- end move to gdcmHeader::Write ----------------- //----------------------------------------------------------------------------- // Print diff --git a/src/gdcmValEntry.cxx b/src/gdcmValEntry.cxx index 3c58e701..139496c3 100644 --- a/src/gdcmValEntry.cxx +++ b/src/gdcmValEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmValEntry.cxx,v $ Language: C++ - Date: $Date: 2004/06/24 18:03:14 $ - Version: $Revision: 1.14 $ + Date: $Date: 2004/06/28 11:01:18 $ + Version: $Revision: 1.15 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -170,7 +170,8 @@ void gdcmValEntry::Write(FILE *fp, FileType filetype) } tokens.clear(); return; - } + } + fwrite (GetValue().c_str(), (size_t)lgr ,(size_t)1, fp); // Elem value }