]> Creatis software - creaBruker.git/commitdiff
use boost::filesystem::is_directory() instead of
authorjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Mon, 18 May 2009 16:33:20 +0000 (16:33 +0000)
committerjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Mon, 18 May 2009 16:33:20 +0000 (16:33 +0000)
GDCM_NAME_SPACE::DirList::IsDirectory()
(should be more robust ?)

appli/testBruker2Dicom/testBruker2Dicom.cxx
lib/src1/bruker2dicom.cxx

index dbff109d4e32a867212c285d776a0b37164fc1ae..b20536ee78fb32d3096e6a9c7a4cf7ff1e598ab2 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: testBruker2Dicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/05/13 15:37:43 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2009/05/18 16:33:20 $
+  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
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
    if (am->ArgMgrDefined("debug"))
       GDCM_NAME_SPACE::Debug::DebugOn();
 
-   b2d.verbose      = am->ArgMgrDefined("verbose");      
+   b2d.verbose  = am->ArgMgrDefined("verbose");      
    int listonly = am->ArgMgrDefined("listonly");
    
    int dicom    = am->ArgMgrDefined("D");
@@ -150,7 +150,7 @@ int main(int argc, char *argv[])
 // patientName  = am->ArgMgrGetString("patientname", "Patient^Name");
 
 // b2d.day : unused  ...
-   b2d.day          = am->ArgMgrGetString("day",         "You_forget_the_Day");
+   b2d.day          = am->ArgMgrGetString("day", "You_forget_the_Day");
       
    delete am;  // we don't need Argument Manager any longer
 
index 30407ea919902918056cb020f1d48715a5a53506..74df353010994a751247edd55c3c5ea5ad9acd80 100644 (file)
@@ -1,4 +1,6 @@
 #include "bruker2dicom.h"
+#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/operations.hpp>
 
 #ifndef PATH_MAX // If not defined yet : do it 
        #define PATH_MAX 2048
@@ -12,7 +14,8 @@ bool Bruker2Dicom::Execute()
 
    bool bigEndian = GDCM_NAME_SPACE::Util::IsCurrentProcessorBigEndian();
  
-   if ( ! GDCM_NAME_SPACE::DirList::IsDirectory(InputDirName) )
+   //if ( ! GDCM_NAME_SPACE::DirList::IsDirectory(InputDirName) )
+   if ( ! boost::filesystem::is_directory(InputDirName) )
    {
       std::cout << "KO : [" << InputDirName << "] is not a Directory." << std::endl;
       return 0;
@@ -125,7 +128,7 @@ bool Bruker2Dicom::Execute()
          it != fileNames.end();
        ++it)
    {
-      if ( GDCM_NAME_SPACE::DirList::IsDirectory(*it) )
+      if ( boost::filesystem::is_directory(*it) )
       { 
          if (verbose)
             std::cout << "[" << *it << "] is a directory" << std::endl;
@@ -219,7 +222,7 @@ void Bruker2Dicom::DealWithNiveau1(std::string level1Directory, std::string curr
         it != fileNames.end();
       ++it)
    {
-      if ( ! GDCM_NAME_SPACE::DirList::IsDirectory(*it) )
+      if ( ! boost::filesystem::is_directory(*it) )
       {
          if (verbose)
             std::cout << "--- [" << *it << "] is a file" << std::endl;
@@ -233,7 +236,7 @@ void Bruker2Dicom::DealWithNiveau1(std::string level1Directory, std::string curr
         it != fileNames.end();
       ++it)
    {
-      if ( GDCM_NAME_SPACE::DirList::IsDirectory(*it) )
+      if ( boost::filesystem::is_directory(*it) )
       {
          // will be always "pdata" ...
          if (verbose)
@@ -329,7 +332,7 @@ void Bruker2Dicom::DealWithNiveau2(std::string level2Directory, std::string curr
         it != fileNames.end();
       ++it)
    {
-      if ( ! GDCM_NAME_SPACE::DirList::IsDirectory(*it) )
+      if ( ! boost::filesystem::is_directory(*it) )
       { 
          std::cout << "--- --- [" << *it << "] is a file" << std::endl;
       }
@@ -340,7 +343,7 @@ void Bruker2Dicom::DealWithNiveau2(std::string level2Directory, std::string curr
          it != fileNames.end();
        ++it)
    {
-      if ( GDCM_NAME_SPACE::DirList::IsDirectory(*it) )
+      if ( boost::filesystem::is_directory(*it) )
       { 
   
          if (verbose)
@@ -813,7 +816,7 @@ void Bruker2Dicom::dealWithCarto(GDCM_NAME_SPACE::DirListType &fileNames, int NX
         it != fileNames.end();
       ++it)
    {
-      if ( ! GDCM_NAME_SPACE::DirList::IsDirectory(*it) )
+      if ( ! boost::filesystem::is_directory(*it) )
       {         
          if (verbose)
             std::cout << "--- [" << *it << "] is a file" << std::endl;
@@ -932,14 +935,14 @@ bool Bruker2Dicom::CreateDirectory(std::string OutputDirName)
    if (verbose)
       std::cout << "Check for output directory :[" << OutputDirName << "]."
                 <<std::endl;
-   if ( ! GDCM_NAME_SPACE::DirList::IsDirectory(OutputDirName) )    // dirout not found
+   if ( ! boost::filesystem::is_directory(OutputDirName) )    // dirout not found
    {
       std::string strDirNameout(OutputDirName);        // to please gcc 4
       systemCommand = "mkdir " + strDirNameout;        // create it!
       if (verbose)
          std::cout << systemCommand << std::endl;
       system (systemCommand.c_str());
-      if ( ! GDCM_NAME_SPACE::DirList::IsDirectory(OutputDirName) ) // be sure it worked
+      if ( ! boost::filesystem::is_directory(OutputDirName) ) // be sure it worked
       {
          if (verbose) 
             std::cout << "KO : not a dir : [" << OutputDirName << "] (creation failure ?)" << std::endl;