]> Creatis software - gdcm.git/commitdiff
* ENH add self defined param 'new' to PrintHeader to 'show' the SeQuence
authorjpr <jpr>
Wed, 28 Apr 2004 16:24:58 +0000 (16:24 +0000)
committerjpr <jpr>
Wed, 28 Apr 2004 16:24:58 +0000 (16:24 +0000)
           tree-like structure of a Dicom Header
     * FIX Test code cleaning

Testing/TestBug.cxx
Testing/TestChangeHeader.cxx
Testing/TestDicomDir.cxx
Testing/TestHash.cxx

index b71e660e6d2f6d19b592dcb08a29defe94460e6f..4d3f22e180b079aea95c55ac5067a4269f4c37f8 100644 (file)
@@ -3,20 +3,17 @@
 
 int bug1(int argc, char* argv[])
 {  
-       gdcmHeader* e1;
+   gdcmHeader* e1;
        
-       if (argc > 1)
-               e1 = new gdcmHeader(argv[1]);
-       else
-    {
-    std::string filename = GDCM_DATA_ROOT;
-    filename += "/test.acr";
-               e1 = new gdcmHeader( filename.c_str() );
-    }
-       e1->PrintPubDict();
+   if (argc > 1)
+      e1 = new gdcmHeader(argv[1]);
+   else
+      {
+      std::string filename = GDCM_DATA_ROOT;
+      filename += "/test.acr";
+      e1 = new gdcmHeader( filename.c_str() );
+   }
+   e1->PrintPubDict();
 
   return 0;
 }
-
-
-
index a84d3b96b301e2a0f6aec53333f091b60f7ff4cc..7ffbd7e1fd2b7661e0b738725a69829a4d21b54f 100644 (file)
        
        
 int testChangeEntete(int argc, char* argv[]) {  
-       std::string premier, deuxieme;
-       char resultat[200];
+   std::string premier, deuxieme;
+   char resultat[200];
        
-       gdcmFile  *f1, *f2;
+   gdcmFile  *f1, *f2;
        //gdcmHeader *e1, *e2;
-       void* imageData;
-       int dataSize;
+   void* imageData;
+   int dataSize;
                
-       if (argc < 3) {
-               std::cerr << "usage :" << std::endl << 
+   if (argc < 3) {
+      std::cerr << "usage :" << std::endl << 
       argv[0] << " nomFichierPourEntete nomFichierPourDonnées" << std::endl;
-               return 0;       
-       }
+      return 0;        
+   }
 
-       premier = argv[1];
-       f1 = new gdcmFile(premier);
+   premier = argv[1];
+   f1 = new gdcmFile(premier);
        
-       deuxieme = argv[2];
-       f2 = new gdcmFile(deuxieme);
+   deuxieme = argv[2];
+   f2 = new gdcmFile(deuxieme);
        
        //f1->PrintPubElVal();
        
        // On suppose que les champs DICOM du 2ieme fichier existent *effectivement*
        
-       std::string nbFrames = f2->GetHeader()->GetEntryByNumber(0x0028, 0x0008);
-       if(nbFrames != "gdcm::Unfound") {
-           f1->GetHeader()->ReplaceOrCreateByNumber( nbFrames, 0x0028, 0x0008);
-        }
+   std::string nbFrames = f2->GetHeader()->GetEntryByNumber(0x0028, 0x0008);
+   if(nbFrames != "gdcm::Unfound") {
+      f1->GetHeader()->ReplaceOrCreateByNumber( nbFrames, 0x0028, 0x0008);
+   }
          
-       f1->GetHeader()->ReplaceOrCreateByNumber(f2->GetHeader()->GetEntryByNumber(0x0028, 0x0010),
+   f1->GetHeader()->ReplaceOrCreateByNumber(f2->GetHeader()->GetEntryByNumber(0x0028, 0x0010),
          0x0028, 0x0010);// nbLig
-       f1->GetHeader()->ReplaceOrCreateByNumber( f2->GetHeader()->GetEntryByNumber(0x0028, 0x0011),
+   f1->GetHeader()->ReplaceOrCreateByNumber( f2->GetHeader()->GetEntryByNumber(0x0028, 0x0011),
           0x0028, 0x0011);// nbCol
        
        
@@ -52,28 +52,28 @@ int testChangeEntete(int argc, char* argv[]) {
        //                        et qui fasse le boulot.
 
                                
-       dataSize = f2->GetImageDataSize();
-       printf ("dataSize %d\n",dataSize);
-       imageData= f2->GetImageData();
+   dataSize = f2->GetImageDataSize();
+   printf ("dataSize %d\n",dataSize);
+   imageData= f2->GetImageData();
                        
        // TODO : ne devrait-on pas fusionner ces 2 fonctions ?
-       f1->SetImageData(imageData,dataSize);
-       f1->GetHeader()->SetImageDataSize(dataSize);
+   f1->SetImageData(imageData,dataSize);
+   f1->GetHeader()->SetImageDataSize(dataSize);
        
-       f1->GetHeader()->PrintEntry();
+   f1->GetHeader()->PrintEntry();
        
-       std::string s0 =f2->GetHeader()->GetEntryByNumber(0x7fe0, 0x0000);
-       std::string s10=f2->GetHeader()->GetEntryByNumber(0x7fe0, 0x0010);
-       printf("lgr 7fe0, 0000 %s\n",s0.c_str());
-       printf("lgr 7fe0, 0010 %s\n",s10.c_str());      
+   std::string s0 =f2->GetHeader()->GetEntryByNumber(0x7fe0, 0x0000);
+   std::string s10=f2->GetHeader()->GetEntryByNumber(0x7fe0, 0x0010);
+   printf("lgr 7fe0, 0000 %s\n",s0.c_str());
+   printf("lgr 7fe0, 0010 %s\n",s10.c_str());  
 
-       sprintf(resultat, "%s.vol", deuxieme.c_str());
-       printf ("WriteDCM\n");
+   sprintf(resultat, "%s.vol", deuxieme.c_str());
+   printf ("WriteDCM\n");
   //f1->WriteDcmExplVR("itk-gdcm-ex.dcm");
        //f1->WriteDcmImplVR(resultat); 
-       f1->WriteAcr(resultat); 
+   f1->WriteAcr(resultat);     
 
-  return 0;
+   return 0;
 }
 
 
index 1cccb798bd5a265cf6f6685c54c9eb1b4a29f2c7..11f8aa6d5d4754c42a3445a6fda4c36c9cd7c804 100644 (file)
@@ -37,10 +37,10 @@ int testDicomDir(int argc, char* argv[])
     }
 
    e1 = new gdcmDicomDir(file.c_str());
-       if (argc > 2) {
-          int level = atoi(argv[2]);   
-          e1->SetPrintLevel(level);
-       }
+   if (argc > 2) {
+      int level = atoi(argv[2]);   
+      e1->SetPrintLevel(level);
+   }
 
    if(e1->GetDicomDirPatients().begin() == e1->GetDicomDirPatients().end() )
    {
@@ -48,7 +48,7 @@ int testDicomDir(int argc, char* argv[])
       return(1);
    }
 
-// Exemples exploitation de la structure
+// Simple examples of structure exploitation 
 // DON'T REMOVE neither the folowing code, nor the commented out lines
 
 /*
index 230550ee1fd465d52afecab8565894bceda0b2d0..313df6023d2ab6e77faf7cf643f9afa3428e1a9e 100644 (file)
@@ -7,27 +7,27 @@ int hashtest( int, char * [] ) {
 
   typedef std::map<std::string, char*> dict;
   
-  dict tb1;
-  dict::iterator im = tb1.find("00380010");
-  tb1["00100010"] = "Patient Name";
-  tb1["7fe00010"] = "Pixel Data";
-  tb1["50000010"] = "Number of points";
-  tb1["00380010"] = "Admission ID";
+   dict tb1;
+   dict::iterator im = tb1.find("00380010");
+   tb1["00100010"] = "Patient Name";
+   tb1["7fe00010"] = "Pixel Data";
+   tb1["50000010"] = "Number of points";
+   tb1["00380010"] = "Admission ID";
 
-       std::cout << "Traversal of dictionary (note the proper ordering on key)." << std::endl;
-       for ( im = tb1.begin(); im != tb1.end(); ++im )
-               std::cout << "   \"" << im->first << "\" = " << im->second << std::endl;
-       std::cout << "End of dictionary." << std::endl;
+   std::cout << "Traversal of dictionary (note the proper ordering on key)." << std::endl;
+   for ( im = tb1.begin(); im != tb1.end(); ++im )
+      std::cout << "   \"" << im->first << "\" = " << im->second << std::endl;
+   std::cout << "End of dictionary." << std::endl;
 
-       std::cout << "Find request on key 00380010" << std::endl;
-       im = tb1.find("00380010");
-       std::cout << "   \"" << im->first << "\" = " << im->second << std::endl;
+   std::cout << "Find request on key 00380010" << std::endl;
+   im = tb1.find("00380010");
+   std::cout << "   \"" << im->first << "\" = " << im->second << std::endl;
        
-       int i = 0x0010;
-       std::cout.setf(std::ios::hex);
-       std::cout << i << std::endl;
-       std::cout.setf(std::ios::dec);
-       std::cout << i << std::endl;    
+   int i = 0x0010;
+   std::cout.setf(std::ios::hex);
+   std::cout << i << std::endl;
+   std::cout.setf(std::ios::dec);
+   std::cout << i << std::endl;        
        
        // Voir :
        //http://www.developer.com/net/cplus/article.php/10919_2119781_3