]> Creatis software - gdcm.git/blobdiff - Testing/TestWriteSimple.cxx
* Test/VTKTest*.cxx : remove the show variable in each test method because
[gdcm.git] / Testing / TestWriteSimple.cxx
index 2280d76ca4e235077b7cf693b275a7af86bea64a..edd8ba0df2fd33590234cb414171f14a169be2fb 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestWriteSimple.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/20 16:16:59 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2005/01/24 16:44:54 $
+  Version:   $Revision: 1.14 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -22,7 +22,7 @@
  * The image content is a horizontal grayscale from 
  * 
  */
-#include "gdcmHeader.h"
+#include "gdcmFile.h"
 #include "gdcmFileHelper.h"
 
 #include <iostream>
@@ -71,47 +71,47 @@ int WriteSimple(Image &img)
 
 // Step 1 : Create the header of the image
    std::cout << "        1...";
-   gdcm::Header *header = new gdcm::Header();
+   gdcm::File *header = new gdcm::File();
    std::ostringstream str;
 
    // Set the image size
    str.str("");
    str << img.sizeX;
-   header->ReplaceOrCreate(str.str(),0x0028,0x0011); // Columns
+   header->Insert(str.str(),0x0028,0x0011); // Columns
 
    str.str("");
    str << img.sizeY;
-   header->ReplaceOrCreate(str.str(),0x0028,0x0010); // Rows
+   header->Insert(str.str(),0x0028,0x0010); // Rows
 
    if(img.sizeZ>1)
    {
       str.str("");
       str << img.sizeZ;
-      header->ReplaceOrCreate(str.str(),0x0028,0x0008); // Number of Frames
+      header->Insert(str.str(),0x0028,0x0008); // Number of Frames
    }
 
    // Set the pixel type
    str.str("");
    str << img.componentSize;
-   header->ReplaceOrCreate(str.str(),0x0028,0x0100); // Bits Allocated
+   header->Insert(str.str(),0x0028,0x0100); // Bits Allocated
 
    str.str("");
    str << img.componentUse;
-   header->ReplaceOrCreate(str.str(),0x0028,0x0101); // Bits Stored
+   header->Insert(str.str(),0x0028,0x0101); // Bits Stored
 
    str.str("");
    str << img.componentSize - 1;
-   header->ReplaceOrCreate(str.str(),0x0028,0x0102); // High Bit
+   header->Insert(str.str(),0x0028,0x0102); // High Bit
 
    // Set the pixel representation
    str.str("");
    str << img.sign;
-   header->ReplaceOrCreate(str.str(),0x0028,0x0103); // Pixel Representation
+   header->Insert(str.str(),0x0028,0x0103); // Pixel Representation
 
    // Set the samples per pixel
    str.str("");
    str << img.components;
-   header->ReplaceOrCreate(str.str(),0x0028,0x0002); // Samples per Pixel
+   header->Insert(str.str(),0x0028,0x0002); // Samples per Pixel
 
    if( !header->IsReadable() )
    {
@@ -200,7 +200,7 @@ int WriteSimple(Image &img)
 // Step 5 : Read the written image
    std::cout << "5...";
    gdcm::FileHelper* reread = new gdcm::FileHelper( fileName );
-   if( !reread->GetHeader()->IsReadable() )
+   if( !reread->GetFile()->IsReadable() )
    {
      std::cerr << "Failed" << std::endl
                << "Test::TestReadWriteReadCompare: Could not reread image "
@@ -217,18 +217,18 @@ int WriteSimple(Image &img)
    uint8_t* imageDataWritten = reread->GetImageData();
 
    // Test the image size
-   if (header->GetXSize() != reread->GetHeader()->GetXSize() ||
-       header->GetYSize() != reread->GetHeader()->GetYSize() ||
-       header->GetZSize() != reread->GetHeader()->GetZSize())
+   if (header->GetXSize() != reread->GetFile()->GetXSize() ||
+       header->GetYSize() != reread->GetFile()->GetYSize() ||
+       header->GetZSize() != reread->GetFile()->GetZSize())
    {
       std::cout << "Failed" << std::endl
          << "        X Size differs: "
          << "X: " << header->GetXSize() << " # " 
-                  << reread->GetHeader()->GetXSize() << " | "
+                  << reread->GetFile()->GetXSize() << " | "
          << "Y: " << header->GetYSize() << " # " 
-                  << reread->GetHeader()->GetYSize() << " | "
+                  << reread->GetFile()->GetYSize() << " | "
          << "Z: " << header->GetZSize() << " # " 
-                  << reread->GetHeader()->GetZSize() << std::endl;
+                  << reread->GetFile()->GetZSize() << std::endl;
       delete header;
       delete file;
       delete reread;