//------------------------------------------------------------------------------
vvToolROIManager::~vvToolROIManager()
{
- std::cout << "vvToolROIManager::~vvToolROIManager()" << std::endl;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m)
{
- DD("AnImageIsBeingClosed");
if (m == mSlicerManager) {
close();
return;
//------------------------------------------------------------------------------
void vvToolROIManager::close()
{
- DD("close");
+ // Update to delete actors
+ UpdateAllContours();
QWidget::close();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) {
- // DD("SelectedImageHasChanged");
if (m != mSlicerManager) hide();
else {
show();
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<vvROIActor> actor = mROIActorsList[roi->GetROINumber()];
+ int n = roi->GetROINumber();
+ QSharedPointer<vvROIActor> actor = mROIActorsList[n];
mCurrentROI = roi;
mCurrentROIActor = actor;
//------------------------------------------------------------------------------
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());
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();
}
//------------------------------------------------------------------------------