From: Romulo Pinho Date: Fri, 24 Feb 2012 10:23:30 +0000 (+0100) Subject: small bug when opening .mat files in VV X-Git-Tag: v1.3.0~87 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=6fbc5b0555a148aed6478cfd1ea7593f32f5dd3c;p=clitk.git small bug when opening .mat files in VV --- diff --git a/common/vvImageReader.cxx b/common/vvImageReader.cxx index 09853a1..0205355 100644 --- a/common/vvImageReader.cxx +++ b/common/vvImageReader.cxx @@ -148,9 +148,15 @@ void vvImageReader::ReadNkiImageTransform() //Read transformation in ASCII format void vvImageReader::ReadMatImageTransform() { - std::string filename(itksys::SystemTools::GetFilenameWithoutExtension(mInputFilenames[0])); - filename += ".mat"; - + std::string filename(mInputFilenames[0]); + std::string ext(itksys::SystemTools::GetFilenameLastExtension(filename)); + if (ext.length() > 0) { + size_t pos = filename.rfind(ext); + filename.replace(pos, ext.length(), ".mat"); + } + else + filename += ".mat"; + std::ifstream f(filename.c_str()); if(f.is_open()) { f.close();