]> Creatis software - gdcm.git/blobdiff - Example/exImageLighten.cxx
STYLE: Remove old comments
[gdcm.git] / Example / exImageLighten.cxx
index 16ae6e8821bcf6a417712e80b7e26a237fe722ec..b82beab40733659ad4719b0339ef4eee9d6b42f4 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exImageLighten.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/02/09 14:39:49 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2005/09/08 14:33:50 $
+  Version:   $Revision: 1.7 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 #include "gdcmBinEntry.h"
 #include "gdcmSeqEntry.h"
 
+#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"
@@ -56,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( gdcm::LD_ALL);
+   f->SetFileName( fileName );
+   bool res = f->Load();        
+
+   if (!res) {
        std::cerr << "Sorry, " << fileName <<"  not a gdcm-readable "
                  << "DICOM / ACR File"
                  <<std::endl;
@@ -74,26 +78,26 @@ 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.
 // ============================================================
 
-   gdcm::FileHelper *copy = new gdcm::FileHelper( output );
+   gdcm::FileHelper *copy = new gdcm::FileHelper( );
+   copy->SetFileName( output );
+   copy->Load();
 
 // ============================================================
 //   Selective copy of the entries (including Pixel Element).
 // ============================================================
 
-   gdcm::DocEntry *d = f1->GetFirstEntry();
-   d = f1->GetFirstEntry();
+   gdcm::DocEntry *d = f->GetFirstEntry();
    while(d)
    {
       // We skip SeqEntries, since user cannot do much with them
@@ -119,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- 
@@ -131,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);