]> Creatis software - gdcm.git/commitdiff
Begin of kosherization of Example
authorjpr <jpr>
Thu, 7 Jul 2005 17:31:53 +0000 (17:31 +0000)
committerjpr <jpr>
Thu, 7 Jul 2005 17:31:53 +0000 (17:31 +0000)
New 'gdcm2' style.

17 files changed:
Example/Anonymize.cxx
Example/AnonymizeDicomDir.cxx
Example/AnonymizeNoLoad.cxx
Example/MakeDicomDir.cxx
Example/PrintDicomDir.cxx
Example/PrintFile.cxx
Example/ReWrite.cxx
Example/TestWrite.cxx
Example/exAnonymize.cxx
Example/exAnonymizeNoLoad.cxx
Example/exBuildUpDicomDir.cxx
Example/exColorToRGB.cxx
Example/exGC.cxx
Example/exGrey2RGB.cxx
Example/exImageLighten.cxx
Example/exOverlaysACR.cxx
Example/exReadPapyrus.cxx

index 5af051c0e47ac55af3b8628dcd0dc08163e0bc2e..defdaf007539dfb5eb97f56c768fa2acf14b6ef2 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: Anonymize.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/06/07 11:12:10 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2005/07/07 17:31:53 $
+  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
@@ -74,14 +74,18 @@ int main(int argc, char *argv[])
    //   Read the input file.
    // ============================================================
 
-   gdcm::File *f1;
+   gdcm::File *f;
 
-   f1 = new gdcm::File( fileName );
-   if (!f1->IsReadable()) 
+   f = new gdcm::File(  );
+   f->SetLoadMode( 0x00000000 );
+   f->SetFileName( fileName );
+   int res = f->Load();
+
+   if ( !res ) 
    {
        std::cerr << "Sorry, " << fileName <<"  not a gdcm-readable "
                  << "DICOM / ACR File" <<std::endl;
-       delete f1;  
+       delete f;  
        return 0;
    }
    std::cout << " ... is readable " << std::endl;
@@ -91,19 +95,19 @@ int main(int argc, char *argv[])
    // ============================================================
 
    // We need a gdcm::FileHelper, since we want to load the pixels        
-   gdcm::FileHelper *fh1 = new gdcm::FileHelper(f1);
+   gdcm::FileHelper *fh = new gdcm::FileHelper(f);
 
    // (unit8_t DOESN'T mean it's mandatory for the image to be a 8 bits one) 
 
-   uint8_t *imageData = fh1->GetImageData();
+   uint8_t *imageData = fh->GetImageData();
 
    if ( imageData == 0 )
    {
        std::cerr << "Sorry, Pixels of" << fileName <<"  are not "
            << " gdcm-readable."       << std::endl
                  << "Use exAnonymizeNoLoad" << std::endl;
-       delete f1;  
-       delete fh1;    
+       delete f;  
+       delete fh;    
        return 0;
    } 
 
@@ -111,36 +115,36 @@ int main(int argc, char *argv[])
    //  Choose the fields to anonymize.
    // ============================================================
    // Institution name 
-   f1->AddAnonymizeElement(0x0008, 0x0080, "Xanadoo"); 
+   f->AddAnonymizeElement(0x0008, 0x0080, "Xanadoo"); 
    // Patient's name 
-   f1->AddAnonymizeElement(0x0010, 0x0010, "Fantomas");   
+   f->AddAnonymizeElement(0x0010, 0x0010, "Fantomas");   
    // Patient's ID
-   f1->AddAnonymizeElement( 0x0010, 0x0020,"1515" );   
+   f->AddAnonymizeElement( 0x0010, 0x0020,"1515" );   
    // Study Instance UID
-   f1->AddAnonymizeElement(0x0020, 0x000d, "9.99.999.9999" );
+   f->AddAnonymizeElement(0x0020, 0x000d, "9.99.999.9999" );
    // Telephone
-   f1->AddAnonymizeElement(0x0010, 0x2154, "3615" );
+   f->AddAnonymizeElement(0x0010, 0x2154, "3615" );
 
    // Aware user will add more fields to anonymize here
 
    // The gdcm::File is modified in memory
 
-   f1->AnonymizeFile();
+   f->AnonymizeFile();
 
    // ============================================================
    //   Write a new file
    // ============================================================
 
-   fh1->WriteDcmExplVR(outputFileName);
+   fh->WriteDcmExplVR(outputFileName);
    std::cout <<"End Anonymize" << std::cout;
 
    // ============================================================
    //   Remove the Anonymize list
    // ============================================================  
-   f1->ClearAnonymizeList();
+   f->ClearAnonymizeList();
     
-   delete f1;
-   delete fh1
+   delete f;
+   delete fh; 
    return 0;
 }
 
index f4ab3fe3dba629b8805e1892851bdec3dba31df8..cfb909c62c0eddfaeeda45a3495f0df21009179d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: AnonymizeDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/06/07 14:41:47 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2005/07/07 17:31:53 $
+  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
@@ -100,19 +100,24 @@ int main(int argc, char *argv[])
 //   Read the input DICOMDIR
 // ============================================================
 
-   gdcm::File *f1 = new gdcm::File( fileName );
-   if (!f1->IsReadable()) {
+   gdcm::File *f;
+   f = new gdcm::File( );
+   f->SetLoadMode(0);
+   f->SetFileName( fileName );
+   bool res = f->Load();  
+   if ( !res )
+   {
        std::cerr << "Sorry, " << fileName <<"  not a gdcm-readable "
                  << "file" <<std::endl;
    }
    std::cout << " ... is readable " << std::endl;
 
    // Directory record sequence
-   gdcm::DocEntry *e = f1->GetDocEntry(0x0004, 0x1220);
+   gdcm::DocEntry *e = f->GetDocEntry(0x0004, 0x1220);
    if ( !e )
    {
       std::cout << "No Directory Record Sequence (0004,1220) found" <<std::endl;;
-      delete f1;
+      delete f;
       delete e;
       return 0;         
    }
@@ -121,7 +126,7 @@ int main(int argc, char *argv[])
    if ( !s )
    {
       std::cout << "Element (0004,1220) is not a Sequence ?!?" <<std::endl;
-      delete f1;
+      delete f;
       delete e;
       return 0;
    }
@@ -180,7 +185,7 @@ int main(int argc, char *argv[])
 
    delete fp;
    delete e;   
-   delete f1;
+   delete f;
    return 0;
 }
 
index 0da55c1c97dd5230e39fc18da31b8dc3f3399067..7e47f1ac7e32297f600f87626f5060cfc2d988b1 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: AnonymizeNoLoad.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/06/14 09:09:50 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2005/07/07 17:31:53 $
+  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
@@ -66,10 +66,11 @@ int main(int argc, char *argv[])
    //   Parse the input file.
    // ============================================================
 
-   gdcm::File *f1;
-   f1 = new gdcm::File( );
-   f1->SetLoadMode(loadMode);
-   int res = f1->Load(fileName);
+   gdcm::File *f;
+   f = new gdcm::File( );
+   f->SetLoadMode(loadMode);
+   f->SetFileName( fileName );
+   bool res = f->Load();
 
    // gdcm::File::IsReadable() is no usable here, because we deal with
    // any kind of gdcm::Readable *document*
@@ -80,7 +81,7 @@ int main(int argc, char *argv[])
            << "Sorry, " << fileName <<"  not a gdcm-readable "
            << "DICOM / ACR Document"
            << std::endl;
-        delete f1;
+        delete f;
         return 1;
    }
    std::cout << fileName << " is readable " << std::endl;
@@ -95,21 +96,21 @@ int main(int argc, char *argv[])
    //  Choose the fields to anonymize.
    // ============================================================
    // Institution name 
-   f1->AddAnonymizeElement( 0x0008, 0x0080, "Xanadoo" ); 
+   f->AddAnonymizeElement( 0x0008, 0x0080, "Xanadoo" ); 
    // Patient's name 
-   f1->AddAnonymizeElement( 0x0010, 0x0010, "Fantomas" );   
+   f->AddAnonymizeElement( 0x0010, 0x0010, "Fantomas" );   
    // Patient's ID
-   f1->AddAnonymizeElement( 0x0010, 0x0020,"1515" );
+   f->AddAnonymizeElement( 0x0010, 0x0020,"1515" );
    // Patient's Birthdate
-   f1->AddAnonymizeElement( 0x0010, 0x0030,"11.11.1111" );
+   f->AddAnonymizeElement( 0x0010, 0x0030,"11.11.1111" );
    // Patient's Adress
-   f1->AddAnonymizeElement( 0x0010, 0x1040,"Sing-sing" );
+   f->AddAnonymizeElement( 0x0010, 0x1040,"Sing-sing" );
    // Patient's Mother's Birth Name
-   f1->AddAnonymizeElement( 0x0010, 0x1060,"Vampirella" );   
+   f->AddAnonymizeElement( 0x0010, 0x1060,"Vampirella" );   
    // Study Instance UID
-   f1->AddAnonymizeElement( 0x0020, 0x000d, "9.99.999.9999" );
+   f->AddAnonymizeElement( 0x0020, 0x000d, "9.99.999.9999" );
    // Telephone
-   f1->AddAnonymizeElement(0x0010, 0x2154, "3615" );
+   f->AddAnonymizeElement(0x0010, 0x2154, "3615" );
 
   // Aware use will add new fields here
 
@@ -121,7 +122,7 @@ int main(int argc, char *argv[])
 
    // The gdcm::File remains untouched in memory
 
-   f1->AnonymizeNoLoad();
+   f->AnonymizeNoLoad();
 
    // No need to write the File : modif were done on disc !
    // File was overwritten ...
@@ -131,9 +132,9 @@ int main(int argc, char *argv[])
    // ============================================================
    //   Remove the Anonymize list
    // ============================================================  
-   f1->ClearAnonymizeList();
+   f->ClearAnonymizeList();
     
-   delete f1;
+   delete f;
    return 0;
 }
 
index 0ad1aa94345d449c09d7737518c8f26623e00f66..5723db7de90643b7adcdf408533312f5e000a87b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: MakeDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/07/05 13:26:32 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2005/07/07 17:31:53 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -108,7 +108,9 @@ int main(int argc, char *argv[])
    dcmdir->SetEndMethod(EndMethod);
 
    dcmdir->SetLoadMode(loadMode);
-   dcmdir->Load(dirName);
+   dcmdir->SetFileName(dirName);
+
+   dcmdir->Load();
 
     // ----- Check the result
     
index f8abf2826c3804ef13384615a2f9b9076e39b810..adbc4c18ef1b343f772444ae9e1e13c454a8edbe 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: PrintDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/06/08 08:09:07 $
-  Version:   $Revision: 1.23 $
+  Date:      $Date: 2005/07/07 17:31:53 $
+  Version:   $Revision: 1.24 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -52,7 +52,7 @@ int main(int argc, char* argv[])
       return 0;
    }
   
-   gdcm::DicomDir *e1;
+   gdcm::DicomDir *f;
    gdcm::TSKey v;
 
    gdcm::DicomDirPatient *pa;
@@ -81,34 +81,34 @@ int main(int argc, char* argv[])
    // new style is useless, since it has no effect for *reading* a DICOMDIR
    // (only meaningfull when *creating* a DICOMDIR)
 
-   e1 = new gdcm::DicomDir( fileName );
+   f = new gdcm::DicomDir( fileName );
 
-   //e1 = new gdcm::DicomDir();
-   //e1->SetParseDir(false);
-   //e1->Load(  fileName );
+   //f = new gdcm::DicomDir();
+   //f->SetParseDir(false);
+   //f->Load(  fileName );
 
    // Test if the DicomDir is readable
-   if( !e1->IsReadable() )
+   if( !f->IsReadable() )
    {
       std::cout<<"          DicomDir '"<<fileName
                <<"' is not readable"<<std::endl
                <<"          ...Failed"<<std::endl;
 
-      delete e1;
+      delete f;
       return 1;
    }
 
-   e1->SetPrintLevel(level);
+   f->SetPrintLevel(level);
 
    // Test if the DicomDir contains any Patient
-   pa = e1->GetFirstPatient();
+   pa = f->GetFirstPatient();
    if ( pa  == 0)
    {
       std::cout<<"          DicomDir '"<<fileName
                <<" has no patient"<<std::endl
                <<"          ...Failed"<<std::endl;
 
-      delete e1;
+      delete f;
       return 1;
    }
 
@@ -121,11 +121,11 @@ int main(int argc, char* argv[])
        << " =  PATIENT List ==========================================" 
        << std::endl<< std::endl;
 
-      pa = e1->GetFirstPatient();
+      pa = f->GetFirstPatient();
       while (pa) 
       {
          std::cout << pa->GetEntryValue(0x0010, 0x0010) << std::endl; // Patient's Name   
-         pa = e1->GetNextPatient();    
+         pa = f->GetNextPatient();    
       }
       break;
 
@@ -134,7 +134,7 @@ int main(int argc, char* argv[])
         << " = PATIENT/STUDY List =======================================" 
         << std::endl<< std::endl;
 
-      pa = e1->GetFirstPatient();
+      pa = f->GetFirstPatient();
       while ( pa ) // on degouline les PATIENT de ce DICOMDIR
       {  
          std::cout << pa->GetEntryValue(0x0010, 0x0010) << std::endl; // Patient's Name 
@@ -144,7 +144,7 @@ int main(int argc, char* argv[])
             std::cout << "--- "<< st->GetEntryValue(0x0008, 0x1030) << std::endl; // Study Description
             st = pa->GetNextStudy();
          }
-         pa = e1->GetNextPatient();    
+         pa = f->GetNextPatient();    
       }   
       break;
 
@@ -153,7 +153,7 @@ int main(int argc, char* argv[])
         << " =  PATIENT/STUDY/SERIE List ==================================" 
         << std::endl<< std::endl;
 
-      pa = e1->GetFirstPatient(); 
+      pa = f->GetFirstPatient(); 
       while ( pa )   // on degouline les PATIENT de ce DICOMDIR
       {
        // Patient's Name, Patient ID 
@@ -177,7 +177,7 @@ int main(int argc, char* argv[])
             }
             st = pa->GetNextStudy();
          }
-         pa = e1->GetNextPatient();    
+         pa = f->GetNextPatient();    
       } 
       break;
 
@@ -186,7 +186,7 @@ int main(int argc, char* argv[])
            << " = PATIENT/STUDY/SERIE/IMAGE List ============================" 
            << std::endl<< std::endl;
  
-      pa = e1->GetFirstPatient(); 
+      pa = f->GetFirstPatient(); 
       while ( pa ) {  // les PATIENT de ce DICOMDIR
        // Patient's Name, Patient ID 
          std::cout << "Pat.Name:[" << pa->GetEntryValue(0x0010, 0x0010) <<"]"; // Patient's Name
@@ -215,7 +215,7 @@ int main(int argc, char* argv[])
            }
             st = pa->GetNextStudy();
         }     
-        pa = e1->GetNextPatient();    
+        pa = f->GetNextPatient();    
       }
       break;
 
@@ -223,7 +223,7 @@ int main(int argc, char* argv[])
       std::cout << std::endl << std::endl  
            << " = DICOMDIR full content ==========================================" 
            << std::endl<< std::endl;
-      e1->Print();
+      f->Print();
       break;
 
    }  // end switch
@@ -241,8 +241,8 @@ int main(int argc, char* argv[])
         << " = Liste des PATIENT/STUDY/SERIE/IMAGE ===================================" 
         << std::endl<< std::endl;
  
-   itPatient = e1->GetDicomDirPatients().begin();
-   while ( itPatient != e1->GetDicomDirPatients().end() ) {  // on degouline les PATIENT de ce DICOMDIR
+   itPatient = f->GetDicomDirPatients().begin();
+   while ( itPatient != f->GetDicomDirPatients().end() ) {  // on degouline les PATIENT de ce DICOMDIR
       std::cout << (*itPatient)->GetEntryValue(0x0010, 0x0010) << std::endl; // Patient's Name
       itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
       while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) { // on degouline les STUDY de ce patient
@@ -264,12 +264,12 @@ int main(int argc, char* argv[])
  */  
 
 
-   if(e1->IsReadable())
+   if(f->IsReadable())
       std::cout <<std::endl<<fileName<<" is Readable"<<std::endl;
    else
       std::cout <<std::endl<<fileName<<" is NOT Readable"<<std::endl;
    std::cout<<std::flush;
-   delete e1;
+   delete f;
 
    return(0);
 }
index 3ed667180f9909c4a857ea6eacc798250bdb847e..771f07c7058bde5c5909f535899515a3f08b7c57 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: PrintFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/07/05 13:26:32 $
-  Version:   $Revision: 1.44 $
+  Date:      $Date: 2005/07/07 17:31:53 $
+  Version:   $Revision: 1.45 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -164,7 +164,7 @@ int main(int argc, char *argv[])
  
    /* if unused Param we give up */
    if ( am->ArgMgrPrintUnusedLabels() )
-   { 
+   {
       am->ArgMgrUsage(usage);
       delete am;
       return 0;
@@ -180,8 +180,9 @@ int main(int argc, char *argv[])
 
    gdcm::File *f = new gdcm::File();
    f->SetLoadMode(loadMode);
+   f->SetFileName( fileName );
+   bool res = f->Load();        // just to see
 
-   bool res = f->Load( fileName );
    if ( !res )
    {
       delete f;
index 43241c1f2a76dd8e16b14131f7c4eabd9fd2a1f7..97f7d3f105922f031f09ee2594a0c1273b4082da 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: ReWrite.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/06/17 12:37:20 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2005/07/07 17:31:53 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -91,38 +91,38 @@ int main(int argc, char *argv[])
 
    // ----------- End Arguments Manager ---------
 
-   gdcm::File *e1 = new gdcm::File();
-   e1->SetLoadMode(loadMode);
-
-   bool res = e1->Load( fileName );
+   gdcm::File *f = new gdcm::File();
+   f->SetLoadMode( loadMode );
+   f->SetFileName( fileName );
+   bool res = f->Load();  
    if ( !res )
    {
-      delete e1;
+      delete f;
       return 0;
    }
   
-   if (!e1->IsReadable())
+   if (!f->IsReadable())
    {
        std::cerr << "Sorry, not a Readable DICOM / ACR File"  <<std::endl;
-       delete e1;
+       delete f;
        return 0;
    }
    
-   gdcm::FileHelper *f1 = new gdcm::FileHelper(e1);
+   gdcm::FileHelper *fh = new gdcm::FileHelper(f);
    void *imageData; 
    int dataSize;
   
    if (rgb)
    {
-      dataSize  = f1->GetImageDataSize();
-      imageData = f1->GetImageData(); // somewhat important... can't remember
-      f1->SetWriteModeToRGB();
+      dataSize  = fh->GetImageDataSize();
+      imageData = fh->GetImageData(); // somewhat important... can't remember
+      fh->SetWriteModeToRGB();
    }
    else
    {
-      dataSize  = f1->GetImageDataRawSize();
-      imageData = f1->GetImageDataRaw();// somewhat important... can't remember
-      f1->SetWriteModeToRaw();
+      dataSize  = fh->GetImageDataRawSize();
+      imageData = fh->GetImageDataRaw();// somewhat important... can't remember
+      fh->SetWriteModeToRaw();
    }
 
    if ( imageData == 0 ) // to avoid warning
@@ -132,25 +132,25 @@ int main(int argc, char *argv[])
    std::cout <<std::endl <<" dataSize " << dataSize << std::endl;
    int nX,nY,nZ,sPP,planarConfig;
    std::string pixelType, transferSyntaxName;
-   nX=e1->GetXSize();
-   nY=e1->GetYSize();
-   nZ=e1->GetZSize();
+   nX=f->GetXSize();
+   nY=f->GetYSize();
+   nZ=f->GetZSize();
    std::cout << " DIMX=" << nX << " DIMY=" << nY << " DIMZ=" << nZ << std::endl;
 
-   pixelType    = e1->GetPixelType();
-   sPP          = e1->GetSamplesPerPixel();
-   planarConfig = e1->GetPlanarConfiguration();
+   pixelType    = f->GetPixelType();
+   sPP          = f->GetSamplesPerPixel();
+   planarConfig = f->GetPlanarConfiguration();
    
    std::cout << " pixelType="           << pixelType 
              << " SampleserPixel="      << sPP
              << " PlanarConfiguration=" << planarConfig 
              << " PhotometricInterpretation=" 
-                                << e1->GetEntryValue(0x0028,0x0004) 
+                                << f->GetEntryValue(0x0028,0x0004) 
              << std::endl;
 
-   int numberOfScalarComponents=e1->GetNumberOfScalarComponents();
+   int numberOfScalarComponents=f->GetNumberOfScalarComponents();
    std::cout << "NumberOfScalarComponents " << numberOfScalarComponents <<std::endl;
-   transferSyntaxName = e1->GetTransferSyntaxName();
+   transferSyntaxName = f->GetTransferSyntaxName();
    std::cout << " TransferSyntaxName= [" << transferSyntaxName << "]" << std::endl;
 
    switch (mode[0])
@@ -161,7 +161,7 @@ int main(int argc, char *argv[])
             // from a full gdcm readable File
 
       std::cout << "WriteACR" << std::endl;
-      f1->WriteAcr(outputFileName);
+      fh->WriteAcr(outputFileName);
       break;
 
    case 'D' : // Not documented in the 'usage', because the method is known to be bugged. 
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
            // from a full gdcm readable File
 
       std::cout << "WriteDCM Implicit VR" << std::endl;
-      f1->WriteDcmImplVR(outputFileName);
+      fh->WriteDcmImplVR(outputFileName);
       break;
 
    case 'X' :
@@ -179,7 +179,7 @@ int main(int argc, char *argv[])
               // from a full gdcm readable File
 
       std::cout << "WriteDCM Explicit VR" << std::endl;
-      f1->WriteDcmExplVR(outputFileName);
+      fh->WriteDcmExplVR(outputFileName);
       break;
 
    case 'R' :
@@ -187,12 +187,12 @@ int main(int argc, char *argv[])
              //  Writting a Raw File, 
 
       std::cout << "WriteRaw" << std::endl;
-      f1->WriteRawData(outputFileName);
+      fh->WriteRawData(outputFileName);
       break;
 
    }
-   delete e1;
-   delete f1;
+   delete f;
+   delete fh;
    return 0;
 }
 
index 213042091ec09b83e88540c30e6c3834723fe3ac..dd7211aa05794cd4a2bf91bbdd7144d02e2f6388 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestWrite.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/06/15 09:54:13 $
-  Version:   $Revision: 1.20 $
+  Date:      $Date: 2005/07/07 17:31:53 $
+  Version:   $Revision: 1.21 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -24,8 +24,8 @@ int main(int argc, char *argv[])
 {  
    std::string fileNameToWrite;
 
-   gdcm::File *e1;
-   gdcm::FileHelper *f1;
+   gdcm::File *f;
+   gdcm::FileHelper *fh;
 
    void *imageData;
    int dataSize;
@@ -45,14 +45,14 @@ int main(int argc, char *argv[])
 /*
    if (0) {  // Just to keep the code for further use
       std::cout <<std::endl << "-------- Test gdcmFile ------" <<std::endl;
-      e1 = new gdcmFileHelper(argv[1]);
-      if (!f1->GetFile()->IsReadable()) {
+      f = new gdcmFileHelper(argv[1]);
+      if (!fh->GetFile()->IsReadable()) {
          std::cout << "Sorry, not a DICOM / ACR File"  <<std::endl;
          exit(0);
       }
       std::cout << std::endl << "----------------------> after new gdcmFile"
                 << std::endl;
-      e1->PrintEntry();
+      f->PrintEntry();
       std::cout <<std::endl <<"---------------------------------------" 
                 <<std::endl;
    }
@@ -65,23 +65,23 @@ int main(int argc, char *argv[])
    std::string fileName = argv[1]; 
    std::string mode = argv[2];
 
-   //e1 = new gdcm::File( fileName.c_str() );
+   //f = new gdcm::File( fileName.c_str() );
 
    // new style :
-   e1 = new gdcm::File( );
-   e1->SetLoadMode(0);
-   e1->Load( fileName.c_str() );
-
-   if (!e1->IsReadable())
+   f = new gdcm::File( );
+   f->SetLoadMode(0);
+   f->SetFileName( fileName );
+   bool res = f->Load();  
+   if ( !res )
    {
        std::cerr << "Sorry, not a Readable DICOM / ACR File"  <<std::endl;
        return 0;
    }
-  // e1->Print(); 
+  // f->Print(); 
    
-   f1 = new gdcm::FileHelper(e1);
-   dataSize = f1->GetImageDataSize();
-   imageData= f1->GetImageData();
+   fh = new gdcm::FileHelper(f);
+   dataSize = fh->GetImageDataSize();
+   imageData= fh->GetImageData();
 
 
 // ---     
@@ -89,25 +89,25 @@ int main(int argc, char *argv[])
    std::cout <<std::endl <<" dataSize " << dataSize << std::endl;
    int nX,nY,nZ,sPP,planarConfig;
    std::string pixelType, transferSyntaxName;
-   nX=e1->GetXSize();
-   nY=e1->GetYSize();
-   nZ=e1->GetZSize();
+   nX=f->GetXSize();
+   nY=f->GetYSize();
+   nZ=f->GetZSize();
    std::cout << " DIMX=" << nX << " DIMY=" << nY << " DIMZ=" << nZ << std::endl;
 
-   pixelType    = e1->GetPixelType();
-   sPP          = e1->GetSamplesPerPixel();
-   planarConfig = e1->GetPlanarConfiguration();
+   pixelType    = f->GetPixelType();
+   sPP          = f->GetSamplesPerPixel();
+   planarConfig = f->GetPlanarConfiguration();
    
    std::cout << " pixelType="           << pixelType 
              << " SampleserPixel="      << sPP
              << " PlanarConfiguration=" << planarConfig 
              << " PhotometricInterpretation=" 
-                                << e1->GetEntryValue(0x0028,0x0004) 
+                                << f->GetEntryValue(0x0028,0x0004) 
              << std::endl;
 
-   int numberOfScalarComponents=e1->GetNumberOfScalarComponents();
+   int numberOfScalarComponents=f->GetNumberOfScalarComponents();
    std::cout << "NumberOfScalarComponents " << numberOfScalarComponents <<std::endl;
-   transferSyntaxName = e1->GetTransferSyntaxName();
+   transferSyntaxName = f->GetTransferSyntaxName();
    std::cout << " TransferSyntaxName= [" << transferSyntaxName << "]" << std::endl;
 
 /*   
@@ -118,7 +118,7 @@ int main(int argc, char *argv[])
       && transferSyntaxName != "Uncompressed ACR-NEMA"     ) {
       std::cout << std::endl << "==========================================="
                 << std::endl; 
-      f1->GetPixelReadConverter()->Print();
+      fh->GetPixelReadConverter()->Print();
       std::cout << std::endl << "==========================================="
                 << std::endl; 
    }
@@ -131,7 +131,7 @@ int main(int argc, char *argv[])
 
       fileNameToWrite = fileName + ".ACR";
       std::cout << "WriteACR" << std::endl;
-      f1->WriteAcr(fileNameToWrite);
+      fh->WriteAcr(fileNameToWrite);
       break;
 
    case 'd' :  // Not document in the 'usage', because the method is knowed to be bugged. 
@@ -141,7 +141,7 @@ int main(int argc, char *argv[])
 
       fileNameToWrite = fileName + ".DCM";
       std::cout << "WriteDCM Implicit VR" << std::endl;
-      f1->WriteDcmImplVR(fileNameToWrite);
+      fh->WriteDcmImplVR(fileNameToWrite);
       break;
 
    case 'x' :
@@ -150,7 +150,7 @@ int main(int argc, char *argv[])
 
       fileNameToWrite = fileName + ".XDCM";
       std::cout << "WriteDCM Explicit VR" << std::endl;
-      f1->WriteDcmExplVR(fileNameToWrite);
+      fh->WriteDcmExplVR(fileNameToWrite);
       break;
 
    case 'r' :
@@ -159,12 +159,12 @@ int main(int argc, char *argv[])
 
       fileNameToWrite = fileName + ".RAW";
       std::cout << "WriteRaw" << std::endl;
-      f1->WriteRawData(fileNameToWrite);
+      fh->WriteRawData(fileNameToWrite);
       break;
 
    case 'v' :
 
-     if ( f1->GetFile()->GetBitsAllocated() == 8)
+     if ( fh->GetFile()->GetBitsAllocated() == 8)
      {
         std::cout << "videoinv for 8 bits" << std::endl;
         for (int i=0; i<dataSize; i++) 
@@ -182,12 +182,12 @@ int main(int argc, char *argv[])
      }
      fileNameToWrite = fileName + ".VDCM";
      std::cout << "WriteDCM Explicit VR + VideoInv" << std::endl;
-     f1->WriteDcmExplVR(fileNameToWrite);
+     fh->WriteDcmExplVR(fileNameToWrite);
      break;
 
    }
-   delete e1;
-   delete f1;
+   delete f;
+   delete fh;
    return 0;
 }
 
index df651483ba04a755706f7fd9abb627d0ac68b3d8..d0672dda64f70869a0d41ac630b0bab582aa6676 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exAnonymize.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/03/02 17:19:45 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2005/07/07 17:31:53 $
+  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
@@ -23,9 +23,7 @@
 #include <iostream>
 
 int main(int argc, char *argv[])
-{  
-   gdcm::File *f1;
+{   
    gdcm::Debug::DebugOn();
    std::cout << "------------------------------------------------" << std::endl;
    std::cout << "Anonymize a full gdcm-readable  Dicom image"      << std::endl;
@@ -48,8 +46,12 @@ int main(int argc, char *argv[])
 
    std::cout << argv[1] << std::endl;
 
-   f1 = new gdcm::File( fileName );
-   if (!f1->IsReadable()) {
+   gdcm::File *f = new gdcm::File();
+   f->SetLoadMode( 0x00000000);
+   f->SetFileName( fileName );
+   bool res = f->Load();        
+
+   if (!res) {
        std::cerr << "Sorry, " << fileName <<"  not a gdcm-readable "
            << "DICOM / ACR File"
                  <<std::endl;
@@ -63,11 +65,11 @@ int main(int argc, char *argv[])
 // ============================================================
 
    // We need a gdcm::FileHelper, since we want to load the pixels        
-   gdcm::FileHelper *fh1 = new gdcm::FileHelper(f1);
+   gdcm::FileHelper *fh = new gdcm::FileHelper(f);
 
    // (unit8_t DOESN'T mean it's mandatory for the image to be a 8 bits one) 
 
-   uint8_t *imageData = fh1->GetImageData();
+   uint8_t *imageData = fh->GetImageData();
 
    if ( imageData == 0 )
    {
@@ -82,35 +84,35 @@ int main(int argc, char *argv[])
 //  Choose the fields to anonymize.
 // ============================================================
    // Institution name 
-   f1->AddAnonymizeElement(0x0008, 0x0080, "Xanadoo"); 
+   f->AddAnonymizeElement(0x0008, 0x0080, "Xanadoo"); 
    // Patient's name 
-   f1->AddAnonymizeElement(0x0010, 0x0010, "Fantomas");   
+   f->AddAnonymizeElement(0x0010, 0x0010, "Fantomas");   
    // Patient's ID
-   f1->AddAnonymizeElement( 0x0010, 0x0020,"1515" );   
+   f->AddAnonymizeElement( 0x0010, 0x0020,"1515" );   
    // Study Instance UID
-   f1->AddAnonymizeElement(0x0020, 0x000d, "9.99.999.9999" );
+   f->AddAnonymizeElement(0x0020, 0x000d, "9.99.999.9999" );
    // Telephone
-   f1->AddAnonymizeElement(0x0010, 0x2154, "3615" );
+   f->AddAnonymizeElement(0x0010, 0x2154, "3615" );
   // Aware use will add new fields here
 
 // The gdcm::File is modified in memory
 
-   f1->AnonymizeFile();
+   f->AnonymizeFile();
 
 // ============================================================
 //   Write a new file
 // ============================================================
 
-   fh1->WriteDcmExplVR(outputFileName);
+   fh->WriteDcmExplVR(outputFileName);
    std::cout <<"End Anonymize" << std::cout;
 
 // ============================================================
 //   Remove the Anonymize list
 // ============================================================  
-   f1->ClearAnonymizeList();
+   f->ClearAnonymizeList();
     
-   delete f1;
-   delete fh1
+   delete f;
+   delete fh; 
    return 0;
 }
 
index 52968e0e967685580a5be34b301397298f86e19c..dece2b6a6194ccd010cdd225e50b194acb7883ef 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exAnonymizeNoLoad.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/05/04 07:29:17 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2005/07/07 17:31:54 $
+  Version:   $Revision: 1.9 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -24,7 +24,7 @@
 
 int main(int argc, char *argv[])
 {  
-   gdcm::File *f1;
+   gdcm::File *f;
     
    gdcm::Debug::DebugOn();
 
@@ -47,11 +47,11 @@ int main(int argc, char *argv[])
 // ============================================================
 //   Read the input image.
 // ============================================================
-   bool res;
 
-   f1 = new gdcm::File( );
-   f1->SetLoadMode(NO_SEQ - NO_SHADOW);
-   res = f1->Load(fileName);
+   f = new gdcm::File( );
+   f->SetLoadMode(NO_SEQ - NO_SHADOW);
+   f->SetFileName( fileName );
+   bool res = f->Load(); 
 
    // gdcm::File::IsReadable() is no usable here, because we deal with
    // any kind of gdcm::Readable *document*
@@ -75,21 +75,21 @@ int main(int argc, char *argv[])
 //  Choose the fields to anonymize.
 // ============================================================
    // Institution name 
-   f1->AddAnonymizeElement( 0x0008, 0x0080, "Xanadoo" ); 
+   f->AddAnonymizeElement( 0x0008, 0x0080, "Xanadoo" ); 
    // Patient's name 
-   f1->AddAnonymizeElement( 0x0010, 0x0010, "Fantomas" );   
+   f->AddAnonymizeElement( 0x0010, 0x0010, "Fantomas" );   
    // Patient's ID
-   f1->AddAnonymizeElement( 0x0010, 0x0020,"1515" );
+   f->AddAnonymizeElement( 0x0010, 0x0020,"1515" );
    // Patient's Birthdate
-   f1->AddAnonymizeElement( 0x0010, 0x0030,"11.11.1111" );
+   f->AddAnonymizeElement( 0x0010, 0x0030,"11.11.1111" );
    // Patient's Adress
-   f1->AddAnonymizeElement( 0x0010, 0x1040,"Sing-sing" );
+   f->AddAnonymizeElement( 0x0010, 0x1040,"Sing-sing" );
    // Patient's Mother's Birth Name
-   f1->AddAnonymizeElement( 0x0010, 0x1060,"Vampirella" );   
+   f->AddAnonymizeElement( 0x0010, 0x1060,"Vampirella" );   
    // Study Instance UID
-   f1->AddAnonymizeElement( 0x0020, 0x000d, "9.99.999.9999" );
+   f->AddAnonymizeElement( 0x0020, 0x000d, "9.99.999.9999" );
    // Telephone
-   f1->AddAnonymizeElement(0x0010, 0x2154, "3615" );
+   f->AddAnonymizeElement(0x0010, 0x2154, "3615" );
   // Aware use will add new fields here
 
 
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
 
 // The gdcm::File remains untouched in memory
 
-   f1->AnonymizeNoLoad();
+   f->AnonymizeNoLoad();
 
 // No need to write the File : modif were done on disc !
 // File was overwritten ...
@@ -114,9 +114,9 @@ int main(int argc, char *argv[])
 // ============================================================
 //   Remove the Anonymize list
 // ============================================================  
-   f1->ClearAnonymizeList();
+   f->ClearAnonymizeList();
     
-   delete f1;
+   delete f;
    return 0;
 }
 
index f36ad9c329791f2affbfb5e6ab680f428fb99fcf..883d53bb010ceb61852c8f207b1f3c67ebb2c5a6 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exBuildUpDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/02/03 15:44:50 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2005/07/07 17:31:54 $
+  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
@@ -46,7 +46,8 @@ int main(int argc, char *argv[])
    gdcm::DicomDir *dcmdir;
    dcmdir = new gdcm::DicomDir();
 
-   std::cout << "\n------- BuildUpDicomDir: Test Print Meta only -----" << std::endl;
+   std::cout << "\n------- BuildUpDicomDir: Test Print Meta only -----" 
+             << std::endl;
    ((gdcm::Document *)dcmdir)->Print();
 
    gdcm::DicomDirPatient *p1=dcmdir->NewPatient();
index a1a9ea64e38c4f86e205baf8537e999669eaa86d..05509fcc5084c05be90b7a9cc9fb23e9e5bae481 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exColorToRGB.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/07/06 15:49:31 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2005/07/07 17:31:54 $
+  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
@@ -50,13 +50,14 @@ int main(int argc, char *argv[])
 // ============================================================
    // a gdcm::File contains all the Dicom Field but the Pixels Element
 
-   gdcm::File *f1= new gdcm::File( fileName );
-
-
    std::cout << argv[1] << std::endl;
 
-   f1 = new gdcm::File( fileName );
-   if (!f1->IsReadable()) {
+   gdcm::File *f = new gdcm::File();
+   f->SetLoadMode( 0x00000000);
+   f->SetFileName( fileName );
+   bool res = f->Load();        
+
+   if (!res) {
        std::cerr << "Sorry, " << fileName <<"  not a gdcm-readable "
                  << "DICOM / ACR File"
                  <<std::endl;
@@ -65,7 +66,7 @@ int main(int argc, char *argv[])
    std::cout << " ... is readable " << std::endl;
 
 /*
-   if (!f1->IsMonochrome()) {
+   if (!f->IsMonochrome()) {
        std::cerr << "Sorry, " << fileName <<"  not a 'color' File "
                  << " "
                  <<std::endl;
@@ -78,11 +79,11 @@ int main(int argc, char *argv[])
 // ============================================================
 
    // We need a gdcm::FileHelper, since we want to load the pixels        
-   gdcm::FileHelper *fh1 = new gdcm::FileHelper(f1);
+   gdcm::FileHelper *fh = new gdcm::FileHelper(f);
 
    // (unit8_t DOESN'T mean it's mandatory for the image to be a 8 bits one) 
 
-   uint8_t *imageData = fh1->GetImageData();
+   uint8_t *imageData = fh->GetImageData();
 
    if ( imageData == 0 )
    {
@@ -92,15 +93,13 @@ int main(int argc, char *argv[])
    }
  
 
-
-
    // ------ User wants write a new image without shadow groups -------------
    // ------                              without Sequences     -------------
 
  
    gdcm::FileHelper *copy = new gdcm::FileHelper( output );
  
-   gdcm::DocEntry *d = f1->GetFirstEntry();
+   gdcm::DocEntry *d = f->GetFirstEntry();
    while(d)
    {
       // We skip SeqEntries, since user cannot do much with them
@@ -126,19 +125,19 @@ int main(int argc, char *argv[])
           // We skip gdcm::SeqEntries
          }
       }
-      d = f1->GetNextEntry();
+      d = f->GetNextEntry();
    }
  
    // User knows the image is a 'color' one -RGB, YBR, Palette Color-
    // and wants to write it as RGB
-   copy->SetImageData(imageData, fh1->GetImageDataSize());
+   copy->SetImageData(imageData, fh->GetImageDataSize());
    copy->SetWriteModeToRGB();
 
    copy->WriteDcmExplVR( output );
 
 
-   delete f1;
-   delete fh1;
+   delete f;
+   delete fh;
    delete copy;
 
    exit (0);
index 0458b2efd815ef73edf3c7078270229c15461b4f..8d28ecec55e90cfa069f3fb65fb8ecda30edaa93 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exGC.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/07/06 15:49:31 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2005/07/07 17:31:54 $
+  Version:   $Revision: 1.5 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -73,13 +73,14 @@ int main(int argc, char *argv[])
 // ============================================================
    // a gdcm::File contains all the Dicom Field but the Pixels Element
 
-   gdcm::File *f1= new gdcm::File( fileName );
-
-
    std::cout << argv[1] << std::endl;
 
-   f1 = new gdcm::File( fileName );
-   if (!f1->IsReadable()) {
+   gdcm::File *f = new gdcm::File();
+   f->SetLoadMode( 0x00000000);
+   f->SetFileName( fileName );
+   bool res = f->Load();        
+
+   if (!res) {
        std::cerr << "Sorry, " << fileName <<"  not a gdcm-readable "
                  << "DICOM / ACR File"
                  <<std::endl;
@@ -88,7 +89,7 @@ int main(int argc, char *argv[])
    std::cout << " ... is readable " << std::endl;
 
 /*
-   if (!f1->IsMonochrome()) {
+   if (!f->IsMonochrome()) {
        std::cerr << "Sorry, " << fileName <<"  not a 'color' File "
            << " "
                  <<std::endl;
@@ -101,11 +102,11 @@ int main(int argc, char *argv[])
 // ============================================================
 
    // We need a gdcm::FileHelper, since we want to load the pixels        
-   gdcm::FileHelper *fh1 = new gdcm::FileHelper(f1);
+   gdcm::FileHelper *fh = new gdcm::FileHelper(f);
 
    // (unit8_t DOESN'T mean it's mandatory for the image to be a 8 bits one) 
 
-   uint8_t *imageData = fh1->GetImageData();
+   uint8_t *imageData = fh->GetImageData();
 
    if ( imageData == 0 )
    {
@@ -120,7 +121,7 @@ int main(int argc, char *argv[])
  
    gdcm::FileHelper *copy = new gdcm::FileHelper( output );
  
-   gdcm::DocEntry *d = f1->GetFirstEntry();
+   gdcm::DocEntry *d = f->GetFirstEntry();
    while(d)
    {
       // We skip SeqEntries, since user cannot do much with them
@@ -146,10 +147,10 @@ int main(int argc, char *argv[])
           // We skip gdcm::SeqEntries
          }
       }
-      d = f1->GetNextEntry();
+      d = f->GetNextEntry();
    }
 
-   int imageSize = fh1->GetImageDataSize();
+   int imageSize = fh->GetImageDataSize();
 // Black up all 'grey' pixels
    int i;
    int n = 0;
@@ -194,8 +195,8 @@ int main(int argc, char *argv[])
 
    copy->WriteDcmExplVR( output );
 
-   delete f1;
-   delete fh1;
+   delete f;
+   delete fh;
    delete copy;
 
    exit (0);
index b096ad50efca3544a4d48104579be9ff9a2895be..2c151985c570de1f3870a487b861148bb0b006ca 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exGrey2RGB.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/06/15 10:06:36 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2005/07/07 17:31:54 $
+  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
@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
          return 1;
       }
    }
-
    gdcm::FileHelper *fh = new gdcm::FileHelper( filename );
       
    size_t dataSize    = fh->GetImageDataSize();
index 5797d82d242e50f53bb27102ace339179ee423d4..c0553d12abec6a161080240f2e65950e0c9e63bb 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exImageLighten.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/07/06 15:49:31 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2005/07/07 17:31:54 $
+  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
@@ -26,9 +26,7 @@
 #include <stdlib.h> // for exit
 
 int main(int argc, char *argv[])
-{  
-   gdcm::File *f1;
+{ 
    std::cout << "-----------------------------------------------" << std::endl;
    std::cout << "Removes from a full gdcm-readable  Dicom image"  << std::endl;
    std::cout << " all the 'Shadow groups' and the 'Sequence' entries"
@@ -58,8 +56,12 @@ int main(int argc, char *argv[])
 
    std::cout << argv[1] << std::endl;
 
-   f1 = new gdcm::File( fileName );
-   if (!f1->IsReadable()) {
+   gdcm::File *f = new gdcm::File();
+   f->SetLoadMode( 0x00000000);
+   f->SetFileName( fileName );
+   bool res = f->Load();        
+
+   if (!res) {
        std::cerr << "Sorry, " << fileName <<"  not a gdcm-readable "
                  << "DICOM / ACR File"
                  <<std::endl;
@@ -76,12 +78,12 @@ int main(int argc, char *argv[])
    // to load the Palettes Color (if any)
 
    // First, create a gdcm::FileHelper
-   gdcm::FileHelper *fh1 = new gdcm::FileHelper(f1);
+   gdcm::FileHelper *fh = new gdcm::FileHelper(f);
 
    // Load the pixels, DO NOT transform LUT (if any) into RGB Pixels 
-   uint8_t *imageDataRaw = fh1->GetImageDataRaw();
+   uint8_t *imageDataRaw = fh->GetImageDataRaw();
    // Get the image data size
-   size_t dataRawSize    = fh1->GetImageDataRawSize();
+   size_t dataRawSize    = fh->GetImageDataRawSize();
 
 // ============================================================
 //   Create a new gdcm::Filehelper, to hold new image.
@@ -93,9 +95,9 @@ int main(int argc, char *argv[])
 //   Selective copy of the entries (including Pixel Element).
 // ============================================================
 
-   gdcm::DocEntry *d = f1->GetFirstEntry();
+   gdcm::DocEntry *d = f->GetFirstEntry();
  
-   d = f1->GetFirstEntry();
+   d = f->GetFirstEntry();
    while(d)
    {
       // We skip SeqEntries, since user cannot do much with them
@@ -121,7 +123,7 @@ int main(int argc, char *argv[])
           // We skip gdcm::SeqEntries
          }
       }
-      d = f1->GetNextEntry();
+      d = f->GetNextEntry();
    }
    
    // User wants to keep the Palette Color -if any- 
@@ -133,8 +135,8 @@ int main(int argc, char *argv[])
    std::cout << std::endl
              << "------------------------------------------------------------"
              << std::endl;
-   delete f1;
-   delete fh1;
+   delete f;
+   delete fh;
    delete copy;
 
    exit (0);
index ddcc4c69a0178ef1db8474a7b30c958f39c9f171..00fa7520850e2002f58e46139ab9f7510e84242c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exOverlaysACR.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/05/19 15:47:20 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2005/07/07 17:31:54 $
+  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
@@ -58,7 +58,7 @@ V 6006|0102[US] [Overlay Bit Position] [15] x(f)
  
 int main(int argc, char *argv[])
 {  
-   gdcm::File *f1;
+   gdcm::File *f;
  
    //gdcm::Debug::DebugOn();
 
@@ -85,22 +85,23 @@ int main(int argc, char *argv[])
 
    //std::cout << argv[1] << std::endl;
 
-   f1 = new gdcm::File( );
+   f = new gdcm::File( );
 
-   f1->SetLoadMode(NO_SEQ | NO_SHADOW);
-   f1->Load( fileName );
+   f->SetLoadMode(NO_SEQ | NO_SHADOW);
+   f->SetFileName( fileName );
+   bool res = f->Load();  
 
    if( gdcm::Debug::GetDebugFlag() )
    {
       std::cout << "---------------------------------------------" << std::endl;
-      f1->Print();
+      f->Print();
       std::cout << "---------------------------------------------" << std::endl;
    }
-   if (!f1->IsReadable()) {
+   if (!res) {
        std::cout << "Sorry, " << fileName <<"  not a gdcm-readable "
            << "DICOM / ACR File"
            <<std::endl;
-      delete f1;
+      delete f;
       return 0;
    }
    std::cout << " ... is readable " << std::endl;
@@ -109,18 +110,18 @@ int main(int argc, char *argv[])
 //   Check whether image contains Overlays ACR-NEMA style.
 // ============================================================
 
-   int bitsAllocated = f1->GetBitsAllocated();
+   int bitsAllocated = f->GetBitsAllocated();
    if ( bitsAllocated <= 8 )
    {
       std::cout << " 8 bits pixel image cannot contain Overlays " << std::endl;
-      delete f1;
+      delete f;
       return 0;
    }
-   std::string s1 = f1->GetEntryValue(0x6000, 0x0102);
+   std::string s1 = f->GetEntryValue(0x6000, 0x0102);
    if (s1 == gdcm::GDCM_UNFOUND)
    {
       std::cout << " Image doesn't contain any Overlay " << std::endl;
-      delete f1;
+      delete f;
       return 0;
    }
    std::cout << " File is read! " << std::endl;
@@ -133,12 +134,12 @@ int main(int argc, char *argv[])
    // We don't use a gdcm::FileHelper, since it rubs out 
    // the 'non image' bits of the pixels...
 
-   int nx = f1->GetXSize();
-   int ny = f1->GetYSize();
+   int nx = f->GetXSize();
+   int ny = f->GetYSize();
  
    std::cout << "Dimensions " << ny << "  " <<ny << std::endl;
 
-   gdcm::DocEntry *p = f1->GetDocEntry(f1->GetGrPixel(), f1->GetNumPixel());
+   gdcm::DocEntry *p = f->GetDocEntry(f->GetGrPixel(), f->GetNumPixel());
    if (p == 0)
       std::cout << "Pixels element  not found" << std::endl;
    else
@@ -153,7 +154,7 @@ int main(int argc, char *argv[])
    if (fp == 0)
    {
       std::cout << "Unable to open File" << std::endl;
-      delete f1;
+      delete f;
       return 0;
    }
    else
@@ -169,7 +170,7 @@ int main(int argc, char *argv[])
                  << "readable. expected length :" << nx*ny 
                  << "  " << "read length : " << lgt
                  << std::endl;
-       delete f1;
+       delete f;
        delete pixels;  
        return 0;
    }
@@ -197,19 +198,19 @@ int main(int argc, char *argv[])
    gdcm::FileHelper *fh = 0;
 
       
-while ( (strOvlBitPosition = f1->GetEntryValue(currentOvlGroup, 0x0102)) 
+while ( (strOvlBitPosition = f->GetEntryValue(currentOvlGroup, 0x0102)) 
           != gdcm::GDCM_UNFOUND )
 {
 
-      strOverlayLocation = f1->GetEntryValue(currentOvlGroup, 0x0200);
+      strOverlayLocation = f->GetEntryValue(currentOvlGroup, 0x0200);
       if ( strOverlayLocation != gdcm::GDCM_UNFOUND )
       {
          overlayLocation = atoi(strOverlayLocation.c_str());
-         if ( overlayLocation != f1->GetGrPixel() )
+         if ( overlayLocation != f->GetGrPixel() )
          {
             std::cout << "Big Trouble : Overlays are NOT in the Pixels Group "
                       << std::hex << "(" << overlayLocation << " vs " 
-                      << f1->GetGrPixel() << std::endl;
+                      << f->GetGrPixel() << std::endl;
             // Actually, here, we should (try to) read the overlay location
             // and go on the job.
             continue;
@@ -288,8 +289,8 @@ while ( (strOvlBitPosition = f1->GetEntryValue(currentOvlGroup, 0x0102))
       i++;
    }
     
-   delete f1;
-   if (f1)
+   delete f;
+   if (f)
       delete fh;
    if (fileToBuild)
       delete fileToBuild;
index 12f0a188237bff639f900422c31174c1b022e6b3..99badbf87958d3f38cefa1e4550dc82588f40810 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exReadPapyrus.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/06/27 15:46:27 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2005/07/07 17:31:54 $
+  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
@@ -134,35 +134,36 @@ int main(int argc, char *argv[])
    }
 
    int loadMode = 0x0; // load everything
-   gdcm::File *e1 = new gdcm::File();
-   e1->SetLoadMode(loadMode);
+   gdcm::File *f = new gdcm::File();
+   f->SetLoadMode( loadMode );
+   f->SetFileName( fileName );
+   bool res = f->Load();  
 
-   bool res = e1->Load( fileName );
    if ( !res )
    {
-      delete e1;
+      delete f;
       return 0;
    }
 
    // Look for private Papyrus Sequence
-   gdcm::SeqEntry *seqPapyrus= e1->GetSeqEntry(0x0041, 0x1050);
+   gdcm::SeqEntry *seqPapyrus= f->GetSeqEntry(0x0041, 0x1050);
    if (!seqPapyrus)
    {
       std::cout << "NOT a Papyrus File : " << fileName <<std::endl;
-      delete e1;
+      delete f;
       return 1;
    }
 
 //   gdcm::FileHelper *original = new gdcm::FileHelper( fileName );
 //   gdcm::File *h = original->GetFile();
 
-   //gdcm::FileHelper *f1 = new gdcm::FileHelper(e1);
+   //gdcm::FileHelper *f1 = new gdcm::FileHelper(f);
    gdcm::SQItem *sqi = seqPapyrus->GetFirstSQItem();
    if (sqi == 0)
    {
       std::cout << "NO SQItem found within private Papyrus Sequence"
           << std::endl;
-      delete e1;
+      delete f;
       return 1;
    }
       
@@ -177,8 +178,8 @@ int main(int argc, char *argv[])
 //  Modality, Transfer Syntax, Study Date, Study Time
 // Patient Name, Media Storage SOP Instance UID, etc
 
-   MediaStSOPinstUID   =  e1->GetEntryValue(0x0002,0x0002);
-   TransferSyntax      =  e1->GetEntryValue(0x0002,0x0010);
+   MediaStSOPinstUID   =  f->GetEntryValue(0x0002,0x0002);
+   TransferSyntax      =  f->GetEntryValue(0x0002,0x0010);
    StudyDate           = sqi->GetEntryValue(0x0008,0x0020);
    StudyTime           = sqi->GetEntryValue(0x0008,0x0030);
    Modality            = sqi->GetEntryValue(0x0008,0x0060);