From: rblanc Date: Mon, 22 Apr 2013 16:47:38 +0000 (+0200) Subject: fusion sequence: artificially thicken the US images to avoid slices being *hidden... X-Git-Tag: v1.4.0~232^2~1 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=d3b2eb0b2a96f7925d95a195ba04a1ccf376c0b1;p=clitk.git fusion sequence: artificially thicken the US images to avoid slices being *hidden behind*, and fixed some errors with close/reload --- diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index ca0f542..409919f 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -1642,6 +1642,24 @@ void vvMainWindow::CloseImage(QTreeWidgetItem* item, int column) } //if the slicer manager was involved in a fusion sequence visualization... if ( mSlicerManagers[index]->IsInvolvedInFusionSequence() ) { + //in both cases, close the overlay: find it... and close it + //ideally, I should duplicate the code, and avoid calling CloseImage, since this pops up another interactive box + QTreeWidgetItem* overlayItem; + if (mSlicerManagers[index]->IsMainSequenceOfFusionSequence()) { + for (unsigned i=0 ; ichildCount() ; i++) { + overlayItem = item->child(i); + this->CloseImage( overlayItem, 0 ); + } + } + else { + QTreeWidgetItem* linkedItem = this->GetItemFromSlicerManager( mSlicerManagers[mSlicerManagers[index]->GetFusionSequenceIndexOfLinkedManager()] ); + for (unsigned i=0 ; ichildCount() ; i++) { + overlayItem = linkedItem->child(i); + this->CloseImage( overlayItem, 0 ); + } + } + + /* -- this is normally already done when closing the overlay. //reset the transforms overlayPanel->getFusionSequenceProperty(-1, false, 0, false); @@ -1653,9 +1671,7 @@ void vvMainWindow::CloseImage(QTreeWidgetItem* item, int column) mSlicerManagers[index]->GetSlicer(i)->SetFusionSequenceCode(-1); mSlicerManagers[mSlicerManagers[index]->GetFusionSequenceIndexOfLinkedManager()]->GetSlicer(i)->SetFusionSequenceCode(-1); } - - //TODO: also remove the image overlaid with the main sequence, as it is becoming invalid... - //this shall be done by calling this->CloseImage() with the correct index;... + */ } linkPanel->removeImage(index); @@ -2588,8 +2604,15 @@ void vvMainWindow::AddFusionSequence(int index, std::vector fileNam //This loads the secondary sequence (US) as an independent sequence LoadImages(fileNames, type); - //reset the transforms to identiy + //reset the transforms to identity + //FIX -- and set the thickness of the US slices to a large value (necessary for visualization purposes...) + double sp_x, sp_y, sp_z; + mSlicerManagers[indexParent]->GetImage()->GetVTKImages()[0]->GetSpacing(sp_x, sp_y, sp_z); + sp_z = std::max(sp_x, std::max(sp_y, sp_z)) + 0.5; // for (unsigned i=0 ; iGetImage()->GetTransform().size() ; i++) { + sp_x = mSlicerManagers.back()->GetImage()->GetVTKImages()[i]->GetSpacing()[0]; + sp_y = mSlicerManagers.back()->GetImage()->GetVTKImages()[i]->GetSpacing()[1]; + mSlicerManagers.back()->GetImage()->GetVTKImages()[i]->SetSpacing( sp_x, sp_y, sp_z); mSlicerManagers.back()->GetImage()->GetTransform()[i]->Identity(); mSlicerManagers.back()->GetImage()->GetTransform()[i]->Update(); } @@ -2612,7 +2635,7 @@ void vvMainWindow::AddFusionSequence(int index, std::vector fileNam error += mSlicerManagers[index]->GetLastError().c_str(); QMessageBox::information(this,tr("Problem reading image !"),error); } - //WindowLevelChanged(); + WindowLevelChanged(); ImageInfoChanged(); //this internally calls WindowLevelChanged... } else { diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 24ec62a..5afe71b 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -965,6 +965,10 @@ void vvSlicerManager::ReloadFusion() //the secondary sequence is being reloaded. void vvSlicerManager::ReloadFusionSequence() { + // this is to keep the slice thickness, which needs to be artificially increased for visualization + double sp_x, sp_y, sp_z; + this->GetImage()->GetVTKImages()[0]->GetSpacing(sp_x, sp_y, sp_z); + mFusionSequenceReader->Update(mImage->GetNumberOfDimensions(),mFusionComponent.c_str(),vvImageReader::MERGEDWITHTIME); for ( unsigned int i = 0; i < mSlicers.size(); i++) { @@ -984,6 +988,13 @@ void vvSlicerManager::ReloadFusionSequence() this->AddFusionSequenceInitialTransformMatrices( mFusionSequenceReader->GetOutput()->GetTransform()[i]->GetMatrix() ); } + // also update the slice thickness + for (unsigned i=0 ; iGetImage()->GetTransform().size() ; i++) { + sp_x = this->GetImage()->GetVTKImages()[i]->GetSpacing()[0]; + sp_y = this->GetImage()->GetVTKImages()[i]->GetSpacing()[1]; + this->GetImage()->GetVTKImages()[i]->SetSpacing( sp_x, sp_y, sp_z); + } + } //----------------------------------------------------------------------------