From: dsarrut Date: Thu, 22 Jul 2010 05:54:26 +0000 (+0000) Subject: image unique filename bug correction X-Git-Tag: v1.2.0~509 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=1f26ebfad96c3945b15cf4872aa0f0bdb789c800;p=clitk.git image unique filename bug correction --- 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);