From: tbaudier Date: Tue, 2 Feb 2016 14:20:23 +0000 (+0100) Subject: Change the computation of the Extent for Overlay, Fusion and VF X-Git-Tag: v1.4.0~71^2~1 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=40faa70ff55ab09a7d95023d44672a1c8366ee87;p=clitk.git Change the computation of the Extent for Overlay, Fusion and VF Add an updateDisplayExtent after loadind Overlay, Fusion and VF --- diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 5b5128f..2914da1 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -2036,6 +2036,10 @@ void vvMainWindow::AddOverlayImage(int index, std::vector fileNames item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName()); item->setToolTip(COLUMN_IMAGE_NAME, mSlicerManagers[index]->GetListOfAbsoluteFilePathInOneString("overlay").c_str()); qApp->processEvents(); +#if VTK_MAJOR_VERSION > 5 + for ( unsigned int i = 0; i < mSlicerManagers[index]->GetNumberOfSlicers(); i++) + mSlicerManagers[index]->GetSlicer(i)->ForceUpdateDisplayExtent(); +#endif for (int j = 1; j <= 4; j++) { item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole)); @@ -2183,7 +2187,10 @@ void vvMainWindow::AddFusionImage(int index, std::vector fileNames, item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName()); item->setToolTip(COLUMN_IMAGE_NAME, mSlicerManagers[index]->GetListOfAbsoluteFilePathInOneString("fusion").c_str()); qApp->processEvents(); - +#if VTK_MAJOR_VERSION > 5 + for ( unsigned int i = 0; i < mSlicerManagers[index]->GetNumberOfSlicers(); i++) + mSlicerManagers[index]->GetSlicer(i)->ForceUpdateDisplayExtent(); +#endif for (int j = 1; j <= 4; j++) { item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole)); } @@ -2330,6 +2337,10 @@ void vvMainWindow::AddField(vvImage::Pointer vf,QString file,int index) vvSlicerManager* imageManager = mSlicerManagers[index]; if (imageManager->SetVF(vf,file.toStdString())) { AddFieldEntry(file,index,false); +#if VTK_MAJOR_VERSION > 5 + for ( unsigned int i = 0; i < mSlicerManagers[index]->GetNumberOfSlicers(); i++) + mSlicerManagers[index]->GetSlicer(i)->ForceUpdateDisplayExtent(); +#endif } else { QString error = "Cannot import the vector field for this image.\n"; error += imageManager->GetLastError().c_str(); @@ -2552,6 +2563,10 @@ void vvMainWindow::AddFusionSequence(int index, std::vector fileNam item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName()); item->setToolTip(COLUMN_IMAGE_NAME, mSlicerManagers[index]->GetListOfAbsoluteFilePathInOneString("fusionSequence").c_str()); qApp->processEvents(); +#if VTK_MAJOR_VERSION > 5 + for ( unsigned int i = 0; i < mSlicerManagers[index]->GetNumberOfSlicers(); i++) + mSlicerManagers[index]->GetSlicer(i)->ForceUpdateDisplayExtent(); +#endif for (int j = 1; j <= 4; j++) { item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole)); } diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 1bf7f13..dc7bea7 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -1116,7 +1116,7 @@ void vvSlicer::UpdateDisplayExtent() bool out = ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetWholeExtent()); #else this->ConvertImageToImageDisplayExtent(mImageReslice->GetOutputInformation(0), w_ext, mOverlayReslice->GetOutput(), overExtent); - bool out = ClipDisplayedExtent(overExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())); + bool out = ClipDisplayedExtent(overExtent, mOverlayMapper->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT())); #endif mOverlayActor->SetVisibility(!out); mOverlayActor->SetDisplayExtent( overExtent ); @@ -1137,7 +1137,7 @@ void vvSlicer::UpdateDisplayExtent() bool out = ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetWholeExtent()); #else this->ConvertImageToImageDisplayExtent(mImageReslice->GetOutputInformation(0), w_ext, mFusionReslice->GetOutput(), fusExtent); - bool out = ClipDisplayedExtent(fusExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())); + bool out = ClipDisplayedExtent(fusExtent, mFusionMapper->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT())); #endif mFusionActor->SetVisibility(!out); mFusionActor->SetDisplayExtent( fusExtent ); @@ -1175,7 +1175,7 @@ void vvSlicer::UpdateDisplayExtent() #else //this->UpdateInformation(); this->ConvertImageToImageDisplayExtent(mImageReslice->GetOutputInformation(0), w_ext, mVF->GetVTKImages()[0], vfExtent); - bool out = ClipDisplayedExtent(vfExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())); + bool out = ClipDisplayedExtent(vfExtent, mVOIFilter->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT())); #endif mVFActor->SetVisibility(!out); mVOIFilter->SetVOI(vfExtent);