From 5122252015f499cb3c1da5f313731972374157dd Mon Sep 17 00:00:00 2001 From: jean-pierre roux Date: Mon, 18 May 2009 16:33:20 +0000 Subject: [PATCH] use boost::filesystem::is_directory() instead of GDCM_NAME_SPACE::DirList::IsDirectory() (should be more robust ?) --- appli/testBruker2Dicom/testBruker2Dicom.cxx | 8 ++++---- lib/src1/bruker2dicom.cxx | 21 ++++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/appli/testBruker2Dicom/testBruker2Dicom.cxx b/appli/testBruker2Dicom/testBruker2Dicom.cxx index dbff109..b20536e 100644 --- a/appli/testBruker2Dicom/testBruker2Dicom.cxx +++ b/appli/testBruker2Dicom/testBruker2Dicom.cxx @@ -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 diff --git a/lib/src1/bruker2dicom.cxx b/lib/src1/bruker2dicom.cxx index 30407ea..74df353 100644 --- a/lib/src1/bruker2dicom.cxx +++ b/lib/src1/bruker2dicom.cxx @@ -1,4 +1,6 @@ #include "bruker2dicom.h" +#include +#include #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 << "]." <