X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=vv%2FvvToolROIManager.cxx;h=d1dc7cc8d987f4c3c7cbe0ede85819e44011b322;hb=260f7d2505096b3234faf09209ff227f5eeddafd;hp=bfddaf923d3e486e8a940488ff8c31f2dea4322a;hpb=169771ce0def5bd09e8daf54ea32650e0d823088;p=clitk.git diff --git a/vv/vvToolROIManager.cxx b/vv/vvToolROIManager.cxx index bfddaf9..d1dc7cc 100644 --- a/vv/vvToolROIManager.cxx +++ b/vv/vvToolROIManager.cxx @@ -73,6 +73,9 @@ vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f) setAttribute(Qt::WA_DeleteOnClose); mTree->clear(); mTree->header()->resizeSection(0, 30); + + // Temporary disable "Load dicom" button + frame_4->hide(); // Set default LUT mDefaultLUTColor = vtkSmartPointer::New(); @@ -118,7 +121,6 @@ vvToolROIManager::vvToolROIManager(vvMainWindowBase * parent, Qt::WindowFlags f) //------------------------------------------------------------------------------ vvToolROIManager::~vvToolROIManager() { - std::cout << "vvToolROIManager::~vvToolROIManager()" << std::endl; } //------------------------------------------------------------------------------ @@ -163,7 +165,6 @@ void vvToolROIManager::InputIsSelected(vvSlicerManager *m) //------------------------------------------------------------------------------ void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m) { - DD("AnImageIsBeingClosed"); if (m == mSlicerManager) { close(); return; @@ -175,7 +176,8 @@ void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m) //------------------------------------------------------------------------------ void vvToolROIManager::close() { - DD("close"); + // Update to delete actors + UpdateAllContours(); QWidget::close(); } //------------------------------------------------------------------------------ @@ -183,7 +185,6 @@ void vvToolROIManager::close() //------------------------------------------------------------------------------ void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) { - DD("SelectedImageHasChanged"); if (m != mSlicerManager) hide(); else { show(); @@ -410,9 +411,12 @@ void vvToolROIManager::SelectedItemChangedInTree() { mGroupBoxROI->setEnabled(false); return; } + if (w == NULL) return; clitk::DicomRT_ROI * roi = mMapTreeWidgetToROI[w]; + if (roi == NULL) return; // sometimes it is called while there is no roi anymore // Get selected roi actor - QSharedPointer actor = mROIActorsList[roi->GetROINumber()]; + int n = roi->GetROINumber(); + QSharedPointer actor = mROIActorsList[n]; mCurrentROI = roi; mCurrentROIActor = actor; @@ -590,6 +594,14 @@ void vvToolROIManager::ChangeDepth(int n) { //------------------------------------------------------------------------------ void vvToolROIManager::ReloadCurrentROI() { + + // Remove all contours/overlay first + bool visible = mCurrentROIActor->IsVisible(); + bool cvisible = mCurrentROIActor->IsContourVisible(); + mCurrentROIActor->SetVisible(false); + mCurrentROIActor->SetContourVisible(false); + mSlicerManager->Render(); + // Reload image vvImageReader::Pointer reader = vvImageReader::New(); reader->SetInputFilename(mCurrentROI->GetFilename()); @@ -599,11 +611,14 @@ void vvToolROIManager::ReloadCurrentROI() { reader->GetLastError().c_str()); return; } - mCurrentROI->GetImage()->GetFirstVTKImageData()->ReleaseData(); + + mCurrentROI->GetImage()->Reset();//GetFirstVTKImageData()->ReleaseData(); mCurrentROI->SetImage(reader->GetOutput()); - // Update visu" + // Update visu mCurrentROIActor->UpdateImage(); + mCurrentROIActor->SetVisible(visible); + mCurrentROIActor->SetContourVisible(cvisible); mSlicerManager->Render(); } //------------------------------------------------------------------------------