X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkCommon.cxx;h=c71bd5078fbf5598e7982eb81287204c1c26c694;hb=d55f025b18f68066a52b8f33c2dc6481e82c2580;hp=57be29e5297f833d53769818b0aa097cb3d93a6c;hpb=3b6b49593e7293aa8f10e7f8951742c73b31ab38;p=clitk.git diff --git a/common/clitkCommon.cxx b/common/clitkCommon.cxx index 57be29e..c71bd50 100644 --- a/common/clitkCommon.cxx +++ b/common/clitkCommon.cxx @@ -19,6 +19,14 @@ #ifndef CLITKCOMMON_CXX #define CLITKCOMMON_CXX +#include + +#ifdef _WIN32 + #define _USE_MATH_DEFINES + #include + const double M_PI = std::acos(-1.0); +#endif + // clitk include #include "clitkCommon.h" @@ -69,6 +77,24 @@ std::string clitk::GetExtension(const std::string& filename) } //// //------------------------------------------------------------------ + +//------------------------------------------------------------------ +// Return filename splitting in 1 or 2 parts : directory name (if exists) & filename +std::vector clitk::SplitFilename(const std::string& filename) +{ + std::vector dirname; + std::string path = itksys::SystemTools::GetFilenamePath(filename); + std::vector pathComponents; + itksys::SystemTools::SplitPath(filename.c_str(), pathComponents); + std::string fileName = pathComponents.back(); + if (path != "") + dirname.push_back(path); + dirname.push_back(fileName); + return( dirname ); +} //// +//------------------------------------------------------------------ + + //------------------------------------------------------------------ // Display progression void clitk::VerboseInProgress(const int nb, const int current, const int percentage)