]> Creatis software - gdcm.git/commitdiff
FIX : odd length of string corresponding to an integer pb
authorjpr <jpr>
Mon, 28 Jun 2004 11:01:18 +0000 (11:01 +0000)
committerjpr <jpr>
Mon, 28 Jun 2004 11:01:18 +0000 (11:01 +0000)
src/gdcmDocument.cxx
src/gdcmHeader.cxx
src/gdcmValEntry.cxx

index 4123b5e703cad5e096163dc82d98b04ed474ae33..258dcff8644a1dc61e371b77775de89134a8d7ef 100644 (file)
@@ -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:
index 243b59cc94cf89e707ea9547a1b6e63ead51c899..7fdcda0b516b7aa55cf2a328e2569340c4715ea1 100644 (file)
@@ -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
index 3c58e70158dfddc08983a1af6b9a2439abf941e8..139496c3366463f5bc59ca3522f4f3c77f4422b0 100644 (file)
@@ -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
 }