]> Creatis software - gdcm.git/commitdiff
gdcm::
authorjpr <jpr>
Thu, 21 Jun 2007 15:01:00 +0000 (15:01 +0000)
committerjpr <jpr>
Thu, 21 Jun 2007 15:01:00 +0000 (15:01 +0000)
Example/FlatHashTablePrint.cxx
Example/WriteDicomAsJPEG2000.cxx
Example/WriteDicomAsMPEG.cxx
Example/exExtractCSA.cxx
Example/exInline.cxx
Example/exPrintTime.cxx
Example/exPrintWritePrint.cxx
Example/exSerieHelper.cxx
Example/toBrainVisa.cxx

index 6aa17d220f9ba1554651225d4a266318383c97ee..09b427277c85ca61809285331393f004609bc061 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: FlatHashTablePrint.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/07/08 12:02:02 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2007/06/21 15:01:00 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -30,13 +30,13 @@ int main(int, char*[])
       argv[0] << " input_dicom " << std::endl;
       return 1;
    }
-   gdcm::File *header = new gdcm::File();
+   GDCM_NAME_SPACE::File *header = new GDCM_NAME_SPACE::File();
    header->SetFileName(argv[1] );
    header->Load();
  
-   gdcm::TagDocEntryHT *Ht = header->BuildFlatHashTable();
+   GDCM_NAME_SPACE::TagDocEntryHT *Ht = header->BuildFlatHashTable();
    
-   for (gdcm::TagDocEntryHT::iterator tag = Ht->begin(); tag != Ht->end(); ++tag)
+   for (GDCM_NAME_SPACE::TagDocEntryHT::iterator tag = Ht->begin(); tag != Ht->end(); ++tag)
    {
       tag->second->Print(); 
       std::cout << std::endl;
index f0e9ec8ed7c4b2c45fdd37226fde90a513e01eeb..d864ea17202ce43ced18be930c858459919cd298 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: WriteDicomAsJPEG2000.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/07/20 17:47:34 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2007/06/21 15:01:00 $
+  Version:   $Revision: 1.4 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -39,16 +39,16 @@ int main(int argc, char *argv[])
    std::cerr << "Using quality: " << quality << std::endl;
 
 // Step 1 : Create the header of the image
-   //gdcm::File *f = new gdcm::File();
+   //GDCM_NAME_SPACE::File *f = new GDCM_NAME_SPACE::File();
    // gdcm1.3 syntax. Sorry
-   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();
 
-   //gdcm::FileHelper *tested = new gdcm::FileHelper( f );
+   //GDCM_NAME_SPACE::FileHelper *tested = new GDCM_NAME_SPACE::FileHelper( f );
    // gdcm1.3 syntax. Sorry   
-   gdcm::FileHelper *tested = gdcm::FileHelper::New( f );
+   GDCM_NAME_SPACE::FileHelper *tested = GDCM_NAME_SPACE::FileHelper::New( f );
    std::string PixelType = tested->GetFile()->GetPixelType();
    int xsize = f->GetXSize();
    int ysize = f->GetYSize();
@@ -61,9 +61,9 @@ int main(int argc, char *argv[])
 
 // Step 1 : Create the header of the image
 
-//   gdcm::File *fileToBuild = new gdcm::File();
+//   GDCM_NAME_SPACE::File *fileToBuild = new GDCM_NAME_SPACE::File();
    // gdcm1.3 syntax. Sorry !
-   gdcm::File *fileToBuild = gdcm::File::New();
+   GDCM_NAME_SPACE::File *fileToBuild = GDCM_NAME_SPACE::File::New();
    
    std::ostringstream str;
 
@@ -127,9 +127,9 @@ int main(int argc, char *argv[])
    fileToBuild->InsertEntryString(str.str(),0x0028,0x0002, "US"); // Samples per Pixel
 
 // Step 2 : Create the output image
-   //gdcm::FileHelper *fileH = new gdcm::FileHelper(fileToBuild);
+   //GDCM_NAME_SPACE::FileHelper *fileH = new GDCM_NAME_SPACE::FileHelper(fileToBuild);
    // gdcm1.3 syntax. Sorry !
-   gdcm::FileHelper *fileH = gdcm::FileHelper::New(fileToBuild);
+   GDCM_NAME_SPACE::FileHelper *fileH = GDCM_NAME_SPACE::FileHelper::New(fileToBuild);
    fileH->SetWriteTypeToJPEG2000(  );
    fileH->SetImageData(testedImageData, testedDataSize);
    if( !fileH->Write(outfilename) )
index 17a6b130fad5ca0a009559eb9cb9eddec7ce6016..8e106e208886e864556837fc62d0803902684b12 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: WriteDicomAsMPEG.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/07/26 17:47:39 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2007/06/21 15:01:00 $
+  Version:   $Revision: 1.3 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -33,7 +33,7 @@ int main(int argc, char *argv[])
 
    // Step 1 : Create the header of the image
 
-   gdcm::File *fileToBuild = gdcm::File::New();
+   GDCM_NAME_SPACE::File *fileToBuild = GDCM_NAME_SPACE::File::New();
    std::ostringstream str;
 
    // Set the image size
@@ -84,7 +84,7 @@ int main(int argc, char *argv[])
                * samplesPerPixel /* * img.componentSize / 8*/;
 
    uint8_t *imageData = new uint8_t[size];
-   gdcm::FileHelper *fileH = gdcm::FileHelper::New(fileToBuild);
+   GDCM_NAME_SPACE::FileHelper *fileH = GDCM_NAME_SPACE::FileHelper::New(fileToBuild);
    //fileH->SetImageData(imageData,size);
    std::ifstream mpeg("/tmp/ts.mpg");
    mpeg.seekg(0, std::ios::end);
index ff5e444acf4d353c18ed38bb127fdc2c1b3dc2f4..f3ca03bfd64715725997f370fedd4f59455b6b03 100755 (executable)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exExtractCSA.cxx,v $
   Language:  C++
-  Date:      $Date: 2007/06/15 13:18:51 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2007/06/21 15:01:00 $
+  Version:   $Revision: 1.3 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -180,7 +180,7 @@ int main(int argc, char *argv[])
    "       inputFileName : Name of the (single) file user wants to anonymize  ",
    "       listOfElementsExtract : group-elem,g2-e2,... (in hexa, no space)   ",
    "                                of Elements to extract                    ",
-   "                              default : 0029-1210,0029-1220               ",
+   "                              default : 0029-1010,0029-1020               ",
    "       noshadowseq: user doesn't want to load Private Sequences           ",
    "       noshadow   : user doesn't want to load Private groups (odd number) ",
    "       noseq      : user doesn't want to load Sequences                   ",
@@ -216,20 +216,26 @@ int main(int argc, char *argv[])
       if ( am->ArgMgrDefined("noseq") )
          loadMode |= GDCM_NAME_SPACE::LD_NOSEQ;
    }
-
+   
    const char *tempWorkFile = am->ArgMgrGetString("tmp");
 
    int extractNb;
    uint16_t *elemsToExtract;
-   if (am->ArgMgrDefined("extract"))
+   if (am->ArgMgrDefined("extract")) 
+   {
       am->ArgMgrGetXInt16Enum("extract", &extractNb);
+      std::cout << "extractNb=" << extractNb << std::endl;
+      if (extractNb =! 0)
+         for (int k=0;k<extractNb; k++)
+            std::cout << std::hex << elemsToExtract[2*k] << "|" << elemsToExtract[2*k+1] <<std::endl;
+   }
    else 
    {
      elemsToExtract = new  uint16_t[4];
      elemsToExtract[0] = 0x0029;
-     elemsToExtract[1] = 0x1210;
+     elemsToExtract[1] = 0x1010;
      elemsToExtract[2] = 0x0029;  
-     elemsToExtract[3] = 0x1220;
+     elemsToExtract[3] = 0x1020;
      extractNb=2;
    }     
 
@@ -282,12 +288,19 @@ for (int tag_no=0; tag_no<extractNb; tag_no++) {
    uint16_t group = elemsToExtract[2*tag_no];
    uint16_t elem = elemsToExtract[2*tag_no+1];
    
+   if (verbose)
+      std::cout << "Let's try tag : " << std::hex << group << "|" << elem << std::endl;
+      
    std::string dicom_tag_value = f->GetEntryString(group, elem);
    if (dicom_tag_value == gdcm::GDCM_UNFOUND)
    {
      gdcm::DictEntry *dictEntry = f->GetPubDict()->GetEntry( group, elem);
-     std::cerr << "Image doesn't contain any tag: " << dictEntry->GetName() 
-               << std::endl;
+     if (dictEntry != NULL)
+        std::cerr << "Image doesn't contain any tag: " << dictEntry->GetName() 
+                  << std::endl;
+     else
+        std::cerr << "Dicom Dictionary doesn't contain any tag: " 
+          << std::hex << group << "|" << elem << std::endl; 
      f->Delete();
      return 1;
    }
index c0d08ccfd27a786312a81e2779c5f38be9583580..9a88fd3dacd9b1778c4f34e82c6bad4d201bce69 100755 (executable)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exInline.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/06/30 09:54:30 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2007/06/21 15:01:00 $
+  Version:   $Revision: 1.3 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -197,7 +197,7 @@ std::cout<< std::hex <<b1 << " " << b2  << std::endl;
    r1 = times(&tms1);     
    for(i = 0 ; i< nbLoop ; i++)
    {
-      gdcm::Util::hifpswap (&a, &b);  
+      GDCM_NAME_SPACE::Util::hifpswap (&a, &b);  
    }
    r2 = times(&tms2);
    std::cout 
@@ -212,7 +212,7 @@ std::cout<< std::hex <<b1 << " " << b2  << std::endl;
    r1 = times(&tms1);     
    for(i = 0 ; i< nbLoop ; i++)
    {
-      gdcm::Util::hNoifpswap (&a, &b);  
+      GDCM_NAME_SPACE::Util::hNoifpswap (&a, &b);  
    }
    r2 = times(&tms2);
    std::cout 
index 6e05536f95aa0e4a90e246f405ee83525a5074e2..91ee3fad5e9c5e7f430ced9e051b963a16fe9d05 100755 (executable)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exPrintTime.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/21 08:43:32 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2007/06/21 15:01:00 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -39,7 +39,7 @@ int main(int, char *[])
 {
    clock_t r1, r2, r3, r4;
    struct tms tms1, tms2, tms3, tms4;
-   gdcm::File *e1;
+   GDCM_NAME_SPACE::File *e1;
 
    //std::ostream os = std::cout;
    //std::ostringstream s;
@@ -51,7 +51,7 @@ int main(int, char *[])
       filename += "/";  //doh!
       filename += gdcmDataImages[i];
 
-      e1= new gdcm::File( );
+      e1= new GDCM_NAME_SPACE::File( );
       r1 = times(&tms1);
       e1->SetFileName( filename );
       e1->Load( );
@@ -59,8 +59,8 @@ int main(int, char *[])
       if (!e1->IsReadable())
       std::cout << "-----------Not Readable " << std::endl;
       delete e1;
-      e1= new gdcm::File( );
-      e1->SetLoadMode( gdcm::LD_NOSEQ | gdcm::LD_NOSHADOW );
+      e1= new GDCM_NAME_SPACE::File( );
+      e1->SetLoadMode( GDCM_NAME_SPACE::LD_NOSEQ | GDCM_NAME_SPACE::LD_NOSHADOW );
       r3 = times(&tms3);
       e1->SetFileName( filename );
       e1->Load( );
@@ -95,7 +95,7 @@ int main(int, char *[])
          filename += "/";  //doh!
          filename += gdcmDataImages[i];
 
-         e1= new gdcm::File( );
+         e1= new GDCM_NAME_SPACE::File( );
          e1->SetFileName( filename );
          e1->Load( ); 
          if (!e1->IsReadable())
@@ -120,8 +120,8 @@ int main(int, char *[])
         filename += "/";  //doh!
         filename += gdcmDataImages[i];
 
-        e1= new gdcm::File( );
-        e1->SetLoadMode( gdcm::LD_NOSEQ | gdcm::LD_NOSHADOW );
+        e1= new GDCM_NAME_SPACE::File( );
+        e1->SetLoadMode( GDCM_NAME_SPACE::LD_NOSEQ | GDCM_NAME_SPACE::LD_NOSHADOW );
         e1->SetFileName( filename );
         e1->Load( );
         if (!e1->IsReadable())
index 476063b185b433a6dfb126f521f37ab62ea520aa..f3eee5c33993ef725220eace95460bf14d94a15a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exPrintWritePrint.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 08:35:44 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2007/06/21 15:01:00 $
+  Version:   $Revision: 1.6 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 
 int main(int argc, char *argv[])
 {  
-   gdcm::File *f;
-   gdcm::FileHelper *fh;
+   GDCM_NAME_SPACE::File *f;
+   GDCM_NAME_SPACE::FileHelper *fh;
    std::string fileNameToWrite;
    void *imageData;
    int dataSize;
 
    std::cout << " This program allows to see at a glance" << std::endl;
-   std::cout << " if the gdcm::File remains unimpaired"   << std::endl;
+   std::cout << " if the GDCM_NAME_SPACE::File remains unimpaired"   << std::endl;
    std::cout << " after a Write"                          << std::endl;
    std::cout << " In a future step, we could move it to"  << std::endl;
    std::cout << " gdcm Testing, for a systematic checking"<< std::endl;
@@ -55,8 +55,8 @@ int main(int argc, char *argv[])
    std::string fileName = argv[1]; 
    std::string mode = argv[2];
 
-   f = new gdcm::File( );
-   f->SetLoadMode( gdcm::LD_NOSEQ );
+   f = new GDCM_NAME_SPACE::File( );
+   f->SetLoadMode( GDCM_NAME_SPACE::LD_NOSEQ );
    f->SetFileName( fileName );
    f->Load( );
 
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
        return 0;
    }
    
-   fh = new gdcm::FileHelper(f);
+   fh = new GDCM_NAME_SPACE::FileHelper(f);
   // ---     
 
    f->Print();
index 01e222dfcb8e6928b0844c7c8c0d242c9d2f3de5..a2fb12efa8c2969a02401bb5689b9a5ee802dfb6 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exSerieHelper.cxx,v $
   Language:  C++
-  Date:      $Date: 2007/06/04 08:51:23 $
-  Version:   $Revision: 1.11 $
+  Date:      $Date: 2007/06/21 15:01:00 $
+  Version:   $Revision: 1.12 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -90,16 +90,16 @@ int main(int argc, char *argv[])
          //---------------------------------------------------------
  
           zspacing = s->GetZSpacing();
-         // Just to show : GetZSpacing from a gdcm::SerieHelper is right  
+         // Just to show : GetZSpacing from a GDCM_NAME_SPACE::SerieHelper is right  
          std::cout << "GetZSpacing() of sorted SingleSerieUIDFileSet "
-                   << "from gdcm::SerieHelper: " << zspacing << std::endl;
+                   << "from GDCM_NAME_SPACE::SerieHelper: " << zspacing << std::endl;
          std::cout << " ('-1' means all the files have the same position)" << std::endl;
          for (std::vector<GDCM_NAME_SPACE::File* >::iterator it =  l->begin();
                                             it != l->end();
                                           ++it)
          {
-          // Just to show : GetZSpacing from a gdcm::File may be different        
-             std::cout << (*it)->GetFileName() << " -->  GetZSpacing() from gdcm::File : " 
+          // Just to show : GetZSpacing from a GDCM_NAME_SPACE::File may be different        
+             std::cout << (*it)->GetFileName() << " -->  GetZSpacing() from GDCM_NAME_SPACE::File : " 
                        << (*it)->GetZSpacing() << std::endl;      
          }  
 
index 2008367f97ee608368e9aacaf81dd902fbb6950e..a1e636921a16f547799057e24d86da80c439c77b 100755 (executable)
@@ -25,7 +25,7 @@ int main (int argc , char *argv[])
 {
    // ============== Initialize Arguments Manager =============================
       
-   gdcm::ArgMgr *am = new gdcm::ArgMgr(argc, argv);
+   GDCM_NAME_SPACE::ArgMgr *am = new GDCM_NAME_SPACE::ArgMgr(argc, argv);
   
    if (argc == 1 || am->ArgMgrDefined("usage")) 
    {
@@ -63,8 +63,8 @@ int main (int argc , char *argv[])
       std::cout << "Failed to open [" << fileout << "] for writting" << std::endl;
       return 0;
    }      
-   gdcm::File *f = gdcm::File::New();
-   f->SetLoadMode( gdcm::LD_ALL);
+   GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
+   f->SetLoadMode( GDCM_NAME_SPACE::LD_ALL);
    f->SetFileName( filein );
    bool res = f->Load();