From 1f26ebfad96c3945b15cf4872aa0f0bdb789c800 Mon Sep 17 00:00:00 2001 From: dsarrut Date: Thu, 22 Jul 2010 05:54:26 +0000 Subject: [PATCH] image unique filename bug correction --- vv/vvSlicerManager.cxx | 31 ++++++++++++++++++++----------- vv/vvSlicerManager.h | 2 +- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 2ed8c2e..7f68a72 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -107,11 +107,20 @@ vvSlicerManager::~vvSlicerManager() //------------------------------------------------------------------------------ -void vvSlicerManager::SetFilename(std::string f) +void vvSlicerManager::SetFilename(std::string filename, int number) { - mFileName = f; + mFileName = filename; + mFileName = vtksys::SystemTools::GetFilenameName(mFileName); + mBaseFileName = vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(mFileName)); + // DD(mBaseFileName); + mBaseFileNameNumber = number; + for(unsigned int i=0; iSetFileName(f); + mSlicers[i]->SetFileName(vtksys::SystemTools::GetFilenameWithoutLastExtension(filename)); + } + + if (number != 0) { + mFileName.append("_"+clitk::toString(number)); } } //------------------------------------------------------------------------------ @@ -139,7 +148,6 @@ void vvSlicerManager::ToggleContourSuperposition() //---------------------------------------------------------------------------- bool vvSlicerManager::SetImage(std::string filename, LoadedImageType type, int n) { - mFileName = filename; mType = type; if (mReader == NULL) mReader = new vvImageReader; @@ -148,10 +156,11 @@ bool vvSlicerManager::SetImage(std::string filename, LoadedImageType type, int n mReader->SetInputFilenames(filenames); mReader->Update(type); - mFileName = vtksys::SystemTools::GetFilenameName(mFileName); - mBaseFileName = vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(mFileName)); + SetFilename(filename, n); + // mFileName = vtksys::SystemTools::GetFilenameName(mFileName); + //mBaseFileName = vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(mFileName)); // DD(mBaseFileName); - mBaseFileNameNumber = n; + //mBaseFileNameNumber = n; if (mReader->GetLastError().size() == 0) { mImage=mReader->GetOutput(); @@ -164,10 +173,10 @@ bool vvSlicerManager::SetImage(std::string filename, LoadedImageType type, int n mLastError = mReader->GetLastError(); return false; } - if (n!=0) { - // DD(mFileName); - mFileName.append("_"+clitk::toString(n)); - } + // if (n!=0) { + // // DD(mFileName); + // mFileName.append("_"+clitk::toString(n)); + // } return true; } //---------------------------------------------------------------------------- diff --git a/vv/vvSlicerManager.h b/vv/vvSlicerManager.h index afefa80..5bbc3c7 100644 --- a/vv/vvSlicerManager.h +++ b/vv/vvSlicerManager.h @@ -99,7 +99,7 @@ class vvSlicerManager : public QObject { else return -1; } - void SetFilename(std::string f); + void SetFilename(std::string f, int number=0); void SetTSlice(int slice); void SetNextTSlice(int originating_slicer); -- 2.47.1