]> Creatis software - gdcm.git/blobdiff - Testing/TestCopyDicom.cxx
Last modif before gdcmPixelData class introduction :
[gdcm.git] / Testing / TestCopyDicom.cxx
index bd914c68a9a54ce02d16ab50f358831efec6deed..5b35c48bd57c22bf2cc8dc365f98fa28d81a4b01 100644 (file)
@@ -41,7 +41,7 @@ bool RemoveFile(const char* source)
 // Here we load a gdcmFile and then try to create from scratch a copy of it,
 // copying field by field the dicom image
 
-int TestCopyDicom(int , char* [])
+int TestCopyDicom(int argc, char* argv[])
 {
    int i =0;
    int retVal = 0;  //by default this is an error
@@ -75,55 +75,37 @@ int TestCopyDicom(int , char* [])
       // It was commented out by Mathieu, that was a *good* idea
       // (the user does NOT have to know the way we implemented the Header !)
       // Waiting for a 'clean' solution, I keep the method ...JPRx
-    
-      TagNameHT & nameHt = original->GetHeader()->GetPubDict()->GetEntriesByName();
 
-      gdcmValEntry* v;
-      gdcmBinEntry* b;
       gdcmDocEntry* d;
 
       for (TagDocEntryHT::iterator tag = Ht.begin(); tag != Ht.end(); ++tag)
       {
          d = tag->second;
-         // for private elements, the gdcmDictEntry is unknown
-         // and it's VR is unpredictable ...
-         // ( In *this* case ReplaceOrCreateByNumber 
-         //  should have a knowledge of the virtual dictionary 
-         //  gdcmDictSet::VirtualEntry)
-         if ( d->GetGroup()%2 == 1) // Skip private Entries 
-            continue;
          if ( gdcmBinEntry* b = dynamic_cast<gdcmBinEntry*>(d) )
-         { 
-           // std::cout << "BinEntry : " 
-           //           << "------------- " << b->GetVR() << " "<< std::hex
-           //           << b->GetGroup() << " " << b->GetElement() << " "
-           //           << " lg=" << b->GetLength()
-           //           << std::endl; 
-             
+         {              
             copy->GetHeader()->ReplaceOrCreateByNumber( 
                                  b->GetVoidArea(),
                                  b->GetLength(),
                                  b->GetGroup(), 
-                                 b->GetElement() );
+                                 b->GetElement(),
+                                 b->GetVR() );
             }
-           else  if ( gdcmValEntry* v = dynamic_cast<gdcmValEntry*>(d) )
-            {
-            copy->GetHeader()->ReplaceOrCreateByNumber( 
+            else  if ( gdcmValEntry* v = dynamic_cast<gdcmValEntry*>(d) )
+            {   
+               copy->GetHeader()->ReplaceOrCreateByNumber( 
                                  v->GetValue(),
                                  v->GetGroup(), 
-                                 v->GetElement() );
-         }
-         else
-         {
+                                 v->GetElement(),
+                                 v->GetVR() ); 
+           }
+           else
+           {
           // We skip pb of SQ recursive exploration
           //std::cout << "Skipped Sequence " 
           //          << "------------- " << d->GetVR() << " "<< std::hex
           //          << d->GetGroup() << " " << d->GetElement()
           //  << std::endl;    
-         }
+           }
       }
 
       size_t dataSize = original->GetImageDataSize();