]> Creatis software - gdcm.git/blobdiff - Testing/TestCopyRescaleDicom.cxx
ENH: Grealty simplify the JPEg decompression, no need to differenciate based on the...
[gdcm.git] / Testing / TestCopyRescaleDicom.cxx
index 975d91c8742ab1c2509e4f921db442976191ab9b..275c532776cb1f2b0ba862abede8ee210cde0c61 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestCopyRescaleDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/14 11:28:29 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2005/01/21 11:40:54 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -15,8 +15,8 @@
      PURPOSE.  See the above copyright notices for more information.
                                                                                 
 =========================================================================*/
-#include "gdcmHeader.h"
 #include "gdcmFile.h"
+#include "gdcmFileHelper.h"
 #include "gdcmValEntry.h"
 #include "gdcmBinEntry.h"
 
@@ -43,22 +43,21 @@ int CopyRescaleDicom(std::string const & filename,
 
    //////////////// Step 1:
    std::cout << "      1...";
-   gdcm::Header *originalH = new gdcm::Header( filename );
-   gdcm::Header *copyH     = new gdcm::Header( );
+   gdcm::File *originalH = new gdcm::File( filename );
+   gdcm::File *copyH     = new gdcm::File( );
 
    //First of all copy the header field by field
 
    // Warning :Accessor gdcmElementSet::GetEntry() should not exist 
    // It was commented out by Mathieu, that was a *good* idea
-   // (the user does NOT have to know the way we implemented the Header !)
+   // (the user does NOT have to know the way we implemented the File !)
    // Waiting for a 'clean' solution, I keep the method ...JPRx
 
 
    //////////////// Step 2:
    std::cout << "2...";
    // Copy of the header content
-   originalH->InitTraversal();
-   gdcm::DocEntry* d = originalH->GetNextEntry();
+   gdcm::DocEntry* d = originalH->GetFirstEntry();
    while(d)
    {
       if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
@@ -86,8 +85,8 @@ int CopyRescaleDicom(std::string const & filename,
       d=originalH->GetNextEntry();
    }
 
-   gdcm::File *original = new gdcm::File( originalH );
-   gdcm::File *copy     = new gdcm::File( copyH );
+   gdcm::FileHelper *original = new gdcm::FileHelper( originalH );
+   gdcm::FileHelper *copy     = new gdcm::FileHelper( copyH );
 
    size_t dataSize = original->GetImageDataSize();
 
@@ -145,10 +144,10 @@ int CopyRescaleDicom(std::string const & filename,
 
    //////////////// Step 4:
    std::cout << "4...";
-   copy = new gdcm::File( output );
+   copy = new gdcm::FileHelper( output );
 
    //Is the file written still gdcm parsable ?
-   if ( !copy->GetHeader()->IsReadable() )
+   if ( !copy->GetFile()->IsReadable() )
    { 
       std::cout << " Failed" << std::endl
                 << "        " << output << " not readable" << std::endl;
@@ -165,18 +164,18 @@ int CopyRescaleDicom(std::string const & filename,
    size_t    dataSizeWritten = copy->GetImageDataSize();
    uint8_t* imageDataWritten = copy->GetImageData();
 
-   if (originalH->GetXSize() != copy->GetHeader()->GetXSize() ||
-       originalH->GetYSize() != copy->GetHeader()->GetYSize() ||
-       originalH->GetZSize() != copy->GetHeader()->GetZSize())
+   if (originalH->GetXSize() != copy->GetFile()->GetXSize() ||
+       originalH->GetYSize() != copy->GetFile()->GetYSize() ||
+       originalH->GetZSize() != copy->GetFile()->GetZSize())
    {
       std::cout << "Failed" << std::endl
          << "        X Size differs: "
          << "X: " << originalH->GetXSize() << " # " 
-                  << copy->GetHeader()->GetXSize() << " | "
+                  << copy->GetFile()->GetXSize() << " | "
          << "Y: " << originalH->GetYSize() << " # " 
-                  << copy->GetHeader()->GetYSize() << " | "
+                  << copy->GetFile()->GetYSize() << " | "
          << "Z: " << originalH->GetZSize() << " # " 
-                  << copy->GetHeader()->GetZSize() << std::endl;
+                  << copy->GetFile()->GetZSize() << std::endl;
       delete original;
       delete copy;
       delete originalH;
@@ -252,7 +251,7 @@ int TestCopyRescaleDicom(int argc, char* argv[])
              << std::endl;
    std::cout << "   apply the following to each filename.xxx: "
              << std::endl;
-   std::cout << "   step 1: parse the image (as gdcmHeader) and call"
+   std::cout << "   step 1: parse the image (as gdcmFile) and call"
              << " IsReadable(). After that, call GetImageData() and "
              << "GetImageDataSize() "
              << std::endl;