From 4d67947110db0b85315ec010ba3db85781097a4a Mon Sep 17 00:00:00 2001 From: Simon Rit Date: Wed, 5 Sep 2012 18:13:08 +0200 Subject: [PATCH] Open overlay sequence as sequence --- vv/vv.cxx | 20 ++++++++++---------- vv/vvMainWindow.cxx | 6 +++--- vv/vvMainWindow.h | 2 +- vv/vvReadState.cxx | 2 +- vv/vvSlicerManager.cxx | 6 +++--- vv/vvSlicerManager.h | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/vv/vv.cxx b/vv/vv.cxx index 1d43584..ef8d025 100644 --- a/vv/vv.cxx +++ b/vv/vv.cxx @@ -127,8 +127,8 @@ int main( int argc, char** argv ) if(open_mode==O_BASE) window.LoadImages(sequence_filenames, vvImageReader::MERGEDWITHTIME); else if (open_mode==O_OVERLAY) - window.AddOverlayImage(n_image_loaded-1,sequence_filenames); - else{ + window.AddOverlayImage(n_image_loaded-1,sequence_filenames,vvImageReader::IMAGE); + else { std::cerr << "Sequences are not managed for opening " << open_mode_names[open_mode] << std::endl; exit(1); } @@ -176,9 +176,9 @@ int main( int argc, char** argv ) } else if (current == "--level") { parse_mode=P_LEVEL; } else if (current == "--linkall") { - link_images = true; - } - else if (current == "--log") { + link_images = true; + } + else if (current == "--log") { std::string log_dir = QDir::tempPath().toStdString() + std::string("/vv-log"); if(itksys::SystemTools::FileExists(log_dir.c_str()) && @@ -229,7 +229,7 @@ int main( int argc, char** argv ) else if (open_mode==O_VF) window.AddField(current.c_str(), n_image_loaded-1); else if (open_mode==O_OVERLAY) - window.AddOverlayImage(n_image_loaded-1,image); + window.AddOverlayImage(n_image_loaded-1,image,vvImageReader::IMAGE); else if (open_mode==O_CONTOUR) window.AddDCStructContour(n_image_loaded-1,current.c_str()); else if (open_mode==O_FUSION) @@ -241,8 +241,8 @@ int main( int argc, char** argv ) if(open_mode==O_BASE) window.LoadImages(sequence_filenames, vvImageReader::MERGEDWITHTIME); else if (open_mode==O_OVERLAY) - window.AddOverlayImage(n_image_loaded-1,sequence_filenames); - else{ + window.AddOverlayImage(n_image_loaded-1,sequence_filenames, vvImageReader::MERGEDWITHTIME); + else { std::cerr << "Sequences are not managed for opening " << open_mode_names[open_mode] << std::endl; exit(1); } @@ -256,8 +256,8 @@ int main( int argc, char** argv ) window.ApplyWindowLevelToAllImages(); } - if (link_images) - window.LinkAllImages(); + if (link_images) + window.LinkAllImages(); int ret = app.exec(); diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index d42d11c..e82590e 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -1866,12 +1866,12 @@ void vvMainWindow::SelectOverlayImage() for (int i = 0; i < files.size(); i++) { vecFileNames.push_back(files[i].toStdString()); } - AddOverlayImage(index,vecFileNames); + AddOverlayImage(index,vecFileNames,vvImageReader::IMAGE); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ -void vvMainWindow::AddOverlayImage(int index, std::vector fileNames) +void vvMainWindow::AddOverlayImage(int index, std::vector fileNames, vvImageReader::LoadedImageType type) { QString file(fileNames[0].c_str()); if (QFile::exists(file)) @@ -1888,7 +1888,7 @@ void vvMainWindow::AddOverlayImage(int index, std::vector fileNames qApp->processEvents(); std::string filename = itksys::SystemTools::GetFilenameWithoutExtension(file.toStdString()).c_str(); - if (mSlicerManagers[index]->SetOverlay(fileNames,dimension, component)) { + if (mSlicerManagers[index]->SetOverlay(fileNames,dimension, component,type)) { //create an item in the tree with good settings QTreeWidgetItem *item = new QTreeWidgetItem(); item->setData(0,Qt::UserRole,file.toStdString().c_str()); diff --git a/vv/vvMainWindow.h b/vv/vvMainWindow.h index fa29b0c..015a468 100644 --- a/vv/vvMainWindow.h +++ b/vv/vvMainWindow.h @@ -54,7 +54,7 @@ class vvMainWindow: public vvMainWindowBase, void LoadImages(std::vector filenames, vvImageReader::LoadedImageType type); vvSlicerManager * AddImage(vvImage::Pointer image,std::string filename); void AddField(QString file,int index); - void AddOverlayImage(int index, std::vector fileNames); + void AddOverlayImage(int index, std::vector fileNames, vvImageReader::LoadedImageType type); void AddFusionImage(int index, QString filename); void AddROI(int index, QString filename); ///Adds a mesh to a SlicerManager, with optional warping by vector field diff --git a/vv/vvReadState.cxx b/vv/vvReadState.cxx index 434f799..6d61ca5 100644 --- a/vv/vvReadState.cxx +++ b/vv/vvReadState.cxx @@ -195,7 +195,7 @@ std::string vvReadState::ReadOverlay(int index) // TODO: manage sequence of images std::vector vec; vec.push_back(file.c_str()); - m_Window->AddOverlayImage(index, vec); + m_Window->AddOverlayImage(index, vec, vvImageReader::IMAGE); } } if (value == "OverlayColorWindow") { diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 9a51c4b..bc03ebd 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -242,18 +242,18 @@ bool vvSlicerManager::SetImages(std::vector filenames, vvImageReade //---------------------------------------------------------------------------- -bool vvSlicerManager::SetOverlay(std::vector filenames,int dim, std::string component) +bool vvSlicerManager::SetOverlay(std::vector filenames,int dim, std::string component, vvImageReader::LoadedImageType type) { mOverlayName = filenames[0]; mOverlayComponent = component; if (dim > mImage->GetNumberOfDimensions()) { - mLastError = " Overlay dimension cannot be greater then reference image!"; + mLastError = " Overlay dimension cannot be greater than reference image!"; return false; } if (mOverlayReader.IsNull()) mOverlayReader = vvImageReader::New(); mOverlayReader->SetInputFilenames(filenames); - mOverlayReader->Update(mImage->GetNumberOfDimensions(),component.c_str(),mType); + mOverlayReader->Update(type); if (mOverlayReader->GetLastError().size() == 0) { for ( unsigned int i = 0; i < mSlicers.size(); i++) { mSlicers[i]->SetOverlay(mOverlayReader->GetOutput()); diff --git a/vv/vvSlicerManager.h b/vv/vvSlicerManager.h index c5ce55c..088df61 100644 --- a/vv/vvSlicerManager.h +++ b/vv/vvSlicerManager.h @@ -64,7 +64,7 @@ class vvSlicerManager : public QObject { void SetImage(vvImage::Pointer image); bool SetImages(std::vector filenames, vvImageReader::LoadedImageType type, int n=0); - bool SetOverlay(std::vector filenames, int dim, std::string component); + bool SetOverlay(std::vector filenames, int dim, std::string component, vvImageReader::LoadedImageType type); bool SetFusion(std::string filename, int dim, std::string component); ///Set a VF by loading it from the disk bool SetVF(std::string filename); -- 2.47.1