From 424c311bc966bc93f73022d7371a6249b00a51b6 Mon Sep 17 00:00:00 2001 From: schaerer Date: Tue, 26 Jan 2010 15:04:33 +0000 Subject: [PATCH] WIP on overlay --- vv/vvImageReader.cxx | 9 +++++-- vv/vvImageReader.h | 5 ++-- vv/vvMainWindow.cxx | 13 ++++++---- vv/vvSlicer.cxx | 54 +++++------------------------------------- vv/vvSlicerManager.cxx | 24 +++++++++++++++++-- vv/vvSlicerManager.h | 6 +++-- 6 files changed, 50 insertions(+), 61 deletions(-) diff --git a/vv/vvImageReader.cxx b/vv/vvImageReader.cxx index 7e4a4e2..faa22b8 100644 --- a/vv/vvImageReader.cxx +++ b/vv/vvImageReader.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvImageReader.cxx,v $ Language: C++ - Date: $Date: 2010/01/06 13:31:57 $ - Version: $Revision: 1.1 $ + Date: $Date: 2010/01/26 15:04:33 $ + Version: $Revision: 1.2 $ Author : Pierre Seroul (pierre.seroul@gmail.com) Copyright (C) 2008 @@ -44,6 +44,11 @@ vvImageReader::vvImageReader() vvImageReader::~vvImageReader() { } +void vvImageReader::Update() +{ + Update(mType); +} + void vvImageReader::Update(LoadedImageType type) { itk::ImageIOBase::Pointer reader = itk::ImageIOFactory::CreateImageIO(mInputFilenames[0].c_str(), itk::ImageIOFactory::ReadMode); diff --git a/vv/vvImageReader.h b/vv/vvImageReader.h index c9005aa..9597566 100644 --- a/vv/vvImageReader.h +++ b/vv/vvImageReader.h @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvImageReader.h,v $ Language: C++ - Date: $Date: 2010/01/06 13:31:57 $ - Version: $Revision: 1.1 $ + Date: $Date: 2010/01/26 15:04:33 $ + Version: $Revision: 1.2 $ Author : Pierre Seroul (pierre.seroul@gmail.com) Copyright (C) 2008 @@ -54,6 +54,7 @@ public: //==================================================================== // Main function + void Update(); void Update(LoadedImageType type); void Update(int dim, std::string InputPixelType, LoadedImageType type); //void Extract(int dim, std::string InputPixelType, int slice); diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 94dc1b5..2855f32 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvMainWindow.cxx,v $ Language: C++ -Date: $Date: 2010/01/06 13:31:57 $ -Version: $Revision: 1.1 $ +Date: $Date: 2010/01/26 15:04:33 $ +Version: $Revision: 1.2 $ Author : Pierre Seroul (pierre.seroul@gmail.com) Copyright (C) 200COLUMN_IMAGE_NAME @@ -1053,8 +1053,6 @@ void vvMainWindow::ImageInfoChanged() { } windowSpinBox->setValue(mSlicerManagers[index]->GetColorWindow()); levelSpinBox->setValue(mSlicerManagers[index]->GetColorLevel()); - DD(mSlicerManagers[index]->GetColorMap()); - DD(mSlicerManagers[index]->GetPreset()); presetComboBox->setCurrentIndex(mSlicerManagers[index]->GetPreset()); colorMapComboBox->setCurrentIndex(mSlicerManagers[index]->GetColorMap()); @@ -1462,8 +1460,13 @@ void vvMainWindow::CloseImage(QTreeWidgetItem* item, int column) { void vvMainWindow::ReloadImage(QTreeWidgetItem* item, int column) { int index = GetSlicerIndexFromItem(item); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); - if (item->data(1,Qt::UserRole).toString() == "vector") + QString role=item->data(1,Qt::UserRole).toString(); + if ( role == "vector") mSlicerManagers[index]->ReloadVF(); + else if (role == "overlay") + mSlicerManagers[index]->ReloadOverlay(); + else if (role == "fusion") + mSlicerManagers[index]->ReloadFusion(); else mSlicerManagers[index]->Reload(); QApplication::restoreOverrideCursor(); diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 64df64c..db9af65 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvSlicer.cxx,v $ Language: C++ -Date: $Date: 2010/01/06 13:31:58 $ -Version: $Revision: 1.1 $ +Date: $Date: 2010/01/26 15:04:33 $ +Version: $Revision: 1.2 $ Author : Pierre Seroul (pierre.seroul@gmail.com) Copyright (C) 2008 @@ -75,7 +75,7 @@ along with this program. If not, see . #include #include -vtkCxxRevisionMacro(vvSlicer, "$Revision: 1.1 $"); +vtkCxxRevisionMacro(vvSlicer, "$Revision: 1.2 $"); vtkStandardNewMacro(vvSlicer); vvSlicer::vvSlicer() @@ -480,60 +480,18 @@ void vvSlicer::SetTSlice(int t) this->SetInput(mImage->GetVTKImages()[t]); if (mVF && mVFActor->GetVisibility()) { - if (mVF->GetVTKImages().size() == 1) - { - mVOIFilter->SetInput(mVF->GetVTKImages()[0]); - } - else if (mVF->GetVTKImages().size() <= (unsigned int)mCurrentTSlice) - { - Renderer->RemoveActor(mVFActor); - } - else - { - if (!Renderer->HasViewProp(mVFActor)) - { - Renderer->AddActor(mVFActor); - } + if (mVF->GetVTKImages().size() > (unsigned int)mCurrentTSlice) mVOIFilter->SetInput(mVF->GetVTKImages()[mCurrentTSlice]); - } } if (mOverlay && mOverlayActor->GetVisibility()) { - if (mOverlay->GetVTKImages().size() == 1) - { - mOverlayMapper->SetInput(mOverlay->GetVTKImages()[0]); - } - else if (mOverlay->GetVTKImages().size() <= (unsigned int)mCurrentTSlice) - { - Renderer->RemoveActor(mOverlayActor); - } - else - { - if (!Renderer->HasViewProp(mOverlayActor)) - { - Renderer->AddActor(mOverlayActor); - } + if (mOverlay->GetVTKImages().size() > (unsigned int)mCurrentTSlice) mOverlayMapper->SetInput(mOverlay->GetVTKImages()[mCurrentTSlice]); - } } if (mFusion && mFusionActor->GetVisibility()) { - if (mFusion->GetVTKImages().size() == 1) - { - mFusionMapper->SetInput(mFusion->GetVTKImages()[0]); - } - else if (mFusion->GetVTKImages().size() <= (unsigned int)mCurrentTSlice) - { - Renderer->RemoveActor(mFusionActor); - } - else - { - if (!Renderer->HasViewProp(mFusionActor)) - { - Renderer->AddActor(mFusionActor); - } + if (mFusion->GetVTKImages().size() > (unsigned int)mCurrentTSlice) mFusionMapper->SetInput(mFusion->GetVTKImages()[mCurrentTSlice]); - } } if (mSurfaceCutActors.size() > 0) for (std::vector::iterator i=mSurfaceCutActors.begin(); diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 9b3d61e..e07f350 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvSlicerManager.cxx,v $ Language: C++ -Date: $Date: 2010/01/06 13:31:57 $ -Version: $Revision: 1.1 $ +Date: $Date: 2010/01/26 15:04:33 $ +Version: $Revision: 1.2 $ Author : Pierre Seroul (pierre.seroul@gmail.com) Copyright (C) 2008 @@ -610,6 +610,26 @@ void vvSlicerManager::Reload() } } +void vvSlicerManager::ReloadFusion() +{ + mFusionReader->Update(); + for ( unsigned int i = 0; i < mSlicers.size(); i++) + { + mSlicers[i]->SetFusion(mFusionReader->GetOutput()); + mSlicers[i]->Render(); + } +} + +void vvSlicerManager::ReloadOverlay() +{ + mOverlayReader->Update(); + for ( unsigned int i = 0; i < mSlicers.size(); i++) + { + mSlicers[i]->SetOverlay(mOverlayReader->GetOutput()); + mSlicers[i]->Render(); + } +} + void vvSlicerManager::ReloadVF() { mVectorReader->Update(VECTORFIELD); //deletes the old images through the VF::Init() function diff --git a/vv/vvSlicerManager.h b/vv/vvSlicerManager.h index 2007f78..97efb55 100644 --- a/vv/vvSlicerManager.h +++ b/vv/vvSlicerManager.h @@ -3,8 +3,8 @@ Program: vv Module: $RCSfile: vvSlicerManager.h,v $ Language: C++ - Date: $Date: 2010/01/06 13:31:58 $ - Version: $Revision: 1.1 $ + Date: $Date: 2010/01/26 15:04:33 $ + Version: $Revision: 1.2 $ Author : Pierre Seroul (pierre.seroul@gmail.com) Copyright (C) 2008 @@ -196,6 +196,8 @@ public: void RemoveActor(const std::string& actor_type, int overlay_index); void RemoveActors(); void Reload(); + void ReloadOverlay(); + void ReloadFusion(); void ReloadVF(); void Activated(); -- 2.47.1