]> Creatis software - gdcm.git/blobdiff - Testing/TestWriteSimple.cxx
2005-01-13 Jean-Pierre Roux <jpr@creatis.univ-lyon1.fr>
[gdcm.git] / Testing / TestWriteSimple.cxx
index de449f580a9b60aa4b7a41de1979b140ed5a3655..3b1dc14b4bd242b85629db4b76ffa7c40da24566 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestWriteSimple.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/12/10 15:46:15 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2005/01/08 23:18:31 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -26,6 +26,7 @@
 #include "gdcmFile.h"
 
 #include <iostream>
+#include <sstream>
 
 typedef struct
 {
@@ -76,41 +77,41 @@ int WriteSimple(Image &img)
    // Set the image size
    str.str("");
    str << img.sizeX;
-   header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0011); // Columns
+   header->ReplaceOrCreate(str.str(),0x0028,0x0011); // Columns
 
    str.str("");
    str << img.sizeY;
-   header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0010); // Rows
+   header->ReplaceOrCreate(str.str(),0x0028,0x0010); // Rows
 
    if(img.sizeZ>1)
    {
       str.str("");
       str << img.sizeZ;
-      header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0008); // Number of Frames
+      header->ReplaceOrCreate(str.str(),0x0028,0x0008); // Number of Frames
    }
 
    // Set the pixel type
    str.str("");
    str << img.componentSize;
-   header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0100); // Bits Allocated
+   header->ReplaceOrCreate(str.str(),0x0028,0x0100); // Bits Allocated
 
    str.str("");
    str << img.componentUse;
-   header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0101); // Bits Stored
+   header->ReplaceOrCreate(str.str(),0x0028,0x0101); // Bits Stored
 
    str.str("");
    str << img.componentSize - 1;
-   header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0102); // High Bit
+   header->ReplaceOrCreate(str.str(),0x0028,0x0102); // High Bit
 
    // Set the pixel representation
    str.str("");
    str << img.sign;
-   header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0103); // Pixel Representation
+   header->ReplaceOrCreate(str.str(),0x0028,0x0103); // Pixel Representation
 
    // Set the samples per pixel
    str.str("");
    str << img.components;
-   header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0002); // Samples per Pixel
+   header->ReplaceOrCreate(str.str(),0x0028,0x0002); // Samples per Pixel
 
    if( !header->IsReadable() )
    {
@@ -212,7 +213,7 @@ int WriteSimple(Image &img)
 
 // Step 6 : Compare to the written image
    std::cout << "6...";
-   int    dataSizeWritten = reread->GetImageDataSize();
+   size_t dataSizeWritten = reread->GetImageDataSize();
    uint8_t* imageDataWritten = reread->GetImageData();
 
    // Test the image size
@@ -284,7 +285,7 @@ int TestWriteSimple(int argc, char* argv[])
       return 1;
    }
 
-   int ret;
+   int ret=0;
    int i=0;
    while( Images[i].sizeX>0 && Images[i].sizeY>0 )
    {