]> Creatis software - gdcm.git/blobdiff - Example/TestCopyDicom.cxx
ENH: Adding 'gdcm' namespace. Be nice with me this was a ~13000 lines patch. Also...
[gdcm.git] / Example / TestCopyDicom.cxx
index f0f7c23388d3618ccecbdc3f9ba77658297a5df5..cc42d86c58ed9c68fa7a3aabd36549e79c9d4187 100644 (file)
@@ -6,6 +6,8 @@
 
 #ifndef _WIN32
 #include <unistd.h> //for access, unlink
+#else
+#include <io.h> //for _access
 #endif
 
 // return true if the file exists
@@ -47,6 +49,8 @@ int main(int argc, char* argv[])
       return 1;
    }
 
+// don't modify identation in order to let this source xdiffable with ../Test
+
       std::string filename = argv[1];
       std::string output = argv[2];
 
@@ -59,17 +63,17 @@ int main(int argc, char* argv[])
             return 1;
          }
       }
-      gdcmFile *original = new gdcmFile( filename );
+      gdcm::File *original = new gdcm::File( filename );
    
       std::cout << "--- Original ----------------------" << std::endl;
       //original->GetHeader()->Print();
    
-      gdcmFile *copy = new gdcmFile( output );
+      gdcm::File *copy = new gdcm::File( output );
 
-      TagDocEntryHT & Ht = original->GetHeader()->GetEntry();
+      gdcm::TagDocEntryHT & Ht = original->GetHeader()->GetEntry();
 
       size_t dataSize = original->GetImageDataSize();
-      void *imageData = original->GetImageData();
+      uint8_t* imageData = original->GetImageData();
   
       //First of all copy the header field by field
   
@@ -78,22 +82,22 @@ int main(int argc, char* argv[])
       // (the user does NOT have to know the way we implemented the Header !)
       // Waiting for a 'clean' solution, I keep the method ...JPRx
 
-      gdcmDocEntry* d;
+      gdcm::DocEntry* d;
 
-      for (TagDocEntryHT::iterator tag = Ht.begin(); tag != Ht.end(); ++tag)
+      for (gdcm::TagDocEntryHT::iterator tag = Ht.begin(); tag != Ht.end(); ++tag)
       {
          d = tag->second;
          d->Print(); std::cout << std::endl;
-         if ( gdcmBinEntry* b = dynamic_cast<gdcmBinEntry*>(d) )
+         if ( gdcm::BinEntry* b = dynamic_cast<gdcm::BinEntry*>(d) )
          {              
             copy->GetHeader()->ReplaceOrCreateByNumber( 
-                                 b->GetVoidArea(),
+                                 b->GetBinArea(),
                                  b->GetLength(),
                                  b->GetGroup(), 
                                  b->GetElement(),
                                  b->GetVR() );
          }
-         else if ( gdcmValEntry* v = dynamic_cast<gdcmValEntry*>(d) )
+         else if ( gdcm::ValEntry* v = dynamic_cast<gdcm::ValEntry*>(d) )
          {   
             copy->GetHeader()->ReplaceOrCreateByNumber( 
                                  v->GetValue(),