From 6fbc5b0555a148aed6478cfd1ea7593f32f5dd3c Mon Sep 17 00:00:00 2001 From: Romulo Pinho Date: Fri, 24 Feb 2012 11:23:30 +0100 Subject: [PATCH] small bug when opening .mat files in VV --- common/vvImageReader.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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(); -- 2.47.1