]> Creatis software - gdcm.git/blobdiff - Example/exConvert3DplusT.cxx
Add some verbosity to show the troubles with SerieHelper
[gdcm.git] / Example / exConvert3DplusT.cxx
index 43db2d2040aa8b05b28fb4bfd428de995414c102..8db5edbbb42eb7febdf4e1044d301db77ee3002f 100755 (executable)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exConvert3DplusT.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/09/01 13:42:02 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2007/06/21 15:06:13 $
+  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
@@ -70,7 +70,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 (am->ArgMgrDefined("usage") || argc == 1) 
    {
@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
    }
 
    if (am->ArgMgrDefined("debug"))
-      gdcm::Debug::DebugOn(); 
+      GDCM_NAME_SPACE::Debug::DebugOn(); 
    int verbose  = am->ArgMgrDefined("verbose");
    int oververbose  = am->ArgMgrDefined("oververbose");
       
@@ -106,15 +106,15 @@ int main(int argc, char *argv[])
    int nbOfImagesInVolume = am->ArgMgrGetInt("imagesinvolume",
                                          imagetteLineNumber*imagetteRowNumber);
  
-   int loadMode = gdcm::LD_ALL;
+   int loadMode = GDCM_NAME_SPACE::LD_ALL;
    if ( am->ArgMgrDefined("noshadowseq") )
-      loadMode |= gdcm::LD_NOSHADOWSEQ;
+      loadMode |= GDCM_NAME_SPACE::LD_NOSHADOWSEQ;
    else 
    {
    if ( am->ArgMgrDefined("noshadow") )
-         loadMode |= gdcm::LD_NOSHADOW;
+         loadMode |= GDCM_NAME_SPACE::LD_NOSHADOW;
       if ( am->ArgMgrDefined("noseq") )
-         loadMode |= gdcm::LD_NOSEQ;
+         loadMode |= GDCM_NAME_SPACE::LD_NOSEQ;
    }
         
    /* if unused Param we give up */
@@ -131,7 +131,7 @@ int main(int argc, char *argv[])
  
  
    //std::cout << "dirIn [" << dirIn << "]" << std::endl;
-   if ( ! gdcm::DirList::IsDirectory(dirIn) )
+   if ( ! GDCM_NAME_SPACE::DirList::IsDirectory(dirIn) )
    {
       std::cout << "KO : [" << dirIn << "] is not a Directory." << std::endl;
       return 0;
@@ -148,13 +148,13 @@ int main(int argc, char *argv[])
    if (verbose)
       std::cout << "Check for output directory :[" << dirOut << "]."
              <<std::endl;
-   if ( ! gdcm::DirList::IsDirectory(dirOut) )    // dirout not found
+   if ( ! GDCM_NAME_SPACE::DirList::IsDirectory(dirOut) )    // dirout not found
    {
       systemCommand = "mkdir " +strDirNameout;        // create it!
       if (verbose)
          std::cout << systemCommand << std::endl;
       system (systemCommand.c_str());
-      if ( ! gdcm::DirList::IsDirectory(dirOut) ) // be sure it worked
+      if ( ! GDCM_NAME_SPACE::DirList::IsDirectory(dirOut) ) // be sure it worked
       {
           std::cout << "KO : not a dir : [" << dirOut 
                     << "] (creation failure ?)" << std::endl;
@@ -174,8 +174,8 @@ int main(int argc, char *argv[])
                    << "] already exists; Used as is." << std::endl;
    }
 
-   gdcm::DirList dirList(dirIn,false); // gets (at single level) the file list
-   gdcm::DirListType fileList = dirList.GetFilenames();
+   GDCM_NAME_SPACE::DirList dirList(dirIn,false); // gets (at single level) the file list
+   GDCM_NAME_SPACE::DirListType fileList = dirList.GetFilenames();
    
    // hope sorting on the filename is enough!
    // anyway, *no* filed is available to perform anything more clever.
@@ -189,7 +189,7 @@ int main(int argc, char *argv[])
    //          adding new Series to an already existing Study
    std::string strStudyUID;
    if ( !userDefinedStudy)
-      strStudyUID =  gdcm::Util::CreateUniqueUID();
+      strStudyUID =  GDCM_NAME_SPACE::Util::CreateUniqueUID();
    else
       strStudyUID = studyUID;
 
@@ -201,7 +201,7 @@ int main(int argc, char *argv[])
    
    std::string strSerieUID; 
    if ( !userDefinedSerie)   
-      strSerieUID =  gdcm::Util::CreateUniqueUID();
+      strSerieUID =  GDCM_NAME_SPACE::Util::CreateUniqueUID();
    else      
       strSerieUID = serieUID;
 
@@ -213,20 +213,20 @@ int main(int argc, char *argv[])
    memset(imageTable, 0, totalNumberOfPixels * imagePixelSize);
              
    int16_t **tabImageData = new int16_t *[nbOfImagesInVolume];   
-   gdcm::File **f         = new gdcm::File *[nbOfImagesInVolume];
-   gdcm::FileHelper **fh  = new gdcm::FileHelper *[nbOfImagesInVolume];
+   GDCM_NAME_SPACE::File **f         = new GDCM_NAME_SPACE::File *[nbOfImagesInVolume];
+   GDCM_NAME_SPACE::FileHelper **fh  = new GDCM_NAME_SPACE::FileHelper *[nbOfImagesInVolume];
    
    std::string fullFilename, lastFilename;
    float zPositionComponent = 0.0;
       
    int imageNumber = 0;
    
-   for( gdcm::DirListType::iterator it  = fileList.begin();
+   for( GDCM_NAME_SPACE::DirListType::iterator it  = fileList.begin();
                                  it != fileList.end();
                                  ++it )
    {
       fullFilename = *it;
-      f[imageNumber] = gdcm::File::New( );
+      f[imageNumber] = GDCM_NAME_SPACE::File::New( );
       f[imageNumber]->SetLoadMode(loadMode);
       f[imageNumber]->SetFileName( it->c_str() );
 
@@ -243,7 +243,7 @@ int main(int argc, char *argv[])
 
       // Load the pixels in RAM.    
       
-      fh[imageNumber] = gdcm::FileHelper::New(f[imageNumber]); 
+      fh[imageNumber] = GDCM_NAME_SPACE::FileHelper::New(f[imageNumber]); 
       // Don't convert (Gray Pixels + LUT) into (RGB pixels) ?!?
    
       tabImageData[imageNumber] = (int16_t *)fh[imageNumber]->GetImageDataRaw();
@@ -367,11 +367,11 @@ int main(int argc, char *argv[])
 // ==================================================================================================
 
          fh[imageNumber]->SetWriteTypeToDcmExplVR();               
-         fh[imageNumber]->SetContentType(gdcm::UNMODIFIED_PIXELS_IMAGE);
+         fh[imageNumber]->SetContentType(GDCM_NAME_SPACE::UNMODIFIED_PIXELS_IMAGE);
 
       
-         lastFilename =  gdcm::Util::GetName( fullFilename );
-         std::string fullWriteFilename = strDirNameout + gdcm::GDCM_FILESEPARATOR 
+         lastFilename =  GDCM_NAME_SPACE::Util::GetName( fullFilename );
+         std::string fullWriteFilename = strDirNameout + GDCM_NAME_SPACE::GDCM_FILESEPARATOR 
                                        + lastFilename;
          if (verbose)
             std::cout << "Write : [" << fullWriteFilename << "]" << std::endl;