]> Creatis software - gdcm.git/blobdiff - Testing/TestAllReadCompareDicom.cxx
Add a comment about a patch to be able to reda wrong images, wher UN length is
[gdcm.git] / Testing / TestAllReadCompareDicom.cxx
index 51149b60bff4dca9d642b981d351e02d6de25c37..6819123c71bbbfae56ca4636e7a30771032949b8 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestAllReadCompareDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/11/28 13:33:38 $
-  Version:   $Revision: 1.57 $
+  Date:      $Date: 2007/06/21 14:59:05 $
+  Version:   $Revision: 1.60 $
                                                                                 
   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,7 @@ int TestFile::ComputeSwapCode(uint32_t tag)
 {
 // FIXME : 100 % useless method !
 // "gdcm" was written on disc byte per byte.
-// when you fread if, you'll get *allways* "gdcm"
+// when you fread it, you'll get *always* "gdcm"
 // whatever the processor indianess is !
 
    int swap = 0;
@@ -197,6 +197,7 @@ int TestFile::ComputeSwapCode(uint32_t tag)
       }
       tag >>= 8;
    }
+   //std::cout << std::hex << "0x(" << tag << ")" << std::dec << tag << std::endl;
    return swap;
 }
 
@@ -260,6 +261,7 @@ bool TestFile::ReadFileHeader(std::ifstream *fp)
    SwapCode = ComputeSwapCode(tag);
    if( SwapCode == 0 )
    {
+      // We shall *never* come here!
       std::cout << "TestFile: Bad tag - Must be 'gdcm'" << std::endl;
       return(false);
    }
@@ -282,16 +284,18 @@ bool TestFile::ReadFileData(std::ifstream *fp)
    if( !Data )
       return(false);
 
-   // Read data
+   // Read data  Note : .tst images are *always* created 
+   //           on little endian processor !
    fp->read((char *)Data,GetDataSize());
 
    // Track BigEndian troubles
    std::cout << " ScalarSize : " << GetScalarSize() 
-          << " SwapCode:" << GetSwapCode()
+          << " IsCurrentProcessorBigEndian:" 
+          << GDCM_NAME_SPACE::Util::IsCurrentProcessorBigEndian()
           << std::endl;
         
-   //if (GetScalarSize() == 1 || GetSwapCode() == 1234)
-   if (GetScalarSize() == 1 || !gdcm::Util::IsCurrentProcessorBigEndian() )    
+   //if (GetScalarSize() == 1 || GetSwapCode() == 1234)  
+   if (GetScalarSize() == 1 || !GDCM_NAME_SPACE::Util::IsCurrentProcessorBigEndian() )    
    {
       return true;
    }
@@ -442,8 +446,8 @@ int InternalTest(std::string const &filename,
       std::cout << "1...";
 
        // new style 
-      gdcm::File *f = gdcm::File::New();
-      f->SetLoadMode ( gdcm::LD_ALL ); // Load everything
+      GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
+      f->SetLoadMode ( GDCM_NAME_SPACE::LD_ALL ); // Load everything
       f->SetFileName( filename );
       f->Load();
  
@@ -455,7 +459,7 @@ int InternalTest(std::string const &filename,
         f->Delete();
         return 1;
       }
-      gdcm::FileHelper *tested = gdcm::FileHelper::New( f );
+      GDCM_NAME_SPACE::FileHelper *tested = GDCM_NAME_SPACE::FileHelper::New( f );
      
       ////// Step 2:
       ////// Check for existence of reference baseline dicom file:
@@ -569,7 +573,7 @@ int InternalTest(std::string const &filename,
                    << ") differ (as expanded in memory)."
                    << std::endl
                    << "        compression : " 
-                   << gdcm::Global::GetTS()->GetValue(ts) << std::endl;
+                   << GDCM_NAME_SPACE::Global::GetTS()->GetValue(ts) << std::endl;
 
          std::cout << "        list of the first " << MAX_NUMBER_OF_DIFFERENCE
                    << " pixels differing (pos : test - ref) :" 
@@ -608,10 +612,10 @@ int InternalTest(std::string const &filename,
 int TestAllReadCompareDicom(int argc, char *argv[]) 
 {
 // Temporarily added, to track BigEndian troubles
-gdcm::Debug::WarningOn();
+GDCM_NAME_SPACE::Debug::WarningOn();
 
    if (argc == 4)
-      gdcm::Debug::DebugOn();
+      GDCM_NAME_SPACE::Debug::DebugOn();
 
    if ( argc >= 3 )
    {
@@ -664,7 +668,7 @@ gdcm::Debug::WarningOn();
       std::string baseLineDir = GDCM_DATA_ROOT;
       baseLineDir += "/BaselineDicom";
 
-      if( !gdcm::DirList::IsDirectory(baseLineDir) )
+      if( !GDCM_NAME_SPACE::DirList::IsDirectory(baseLineDir) )
       {
          std::cerr << "   The reference baseline directory " << std::endl
                    << "      "
@@ -677,7 +681,7 @@ gdcm::Debug::WarningOn();
 //if (gdcmDataImages[i] == "D_CLUNIE_CT2_RLE.dcm")
 //   gdcm::Debug::DebugOn(); // track pb on BigEndian Proc
 //else 
-   gdcm::Debug::DebugOff();
+   GDCM_NAME_SPACE::Debug::DebugOff();
    
       ////// Step 1 (see above description):
       std::string filename = GDCM_DATA_ROOT;