]> Creatis software - clitk.git/commitdiff
small bug when opening .mat files in VV
authorRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Fri, 24 Feb 2012 10:23:30 +0000 (11:23 +0100)
committerRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Fri, 24 Feb 2012 10:23:30 +0000 (11:23 +0100)
common/vvImageReader.cxx

index 09853a1bbde4caf8bf870dd33bf82bd1ff5d5cfc..0205355f6fafc40acd2dc82984ce11f1412dddc4 100644 (file)
@@ -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();