X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvSlicer.cxx;h=3773aa0477cec92a846084869972b6a03d3c8d26;hb=d6a6a206c0a533a60519e9b3e82fba48d1240c3e;hp=9258fdbfd5f534fee9fdddff872d34bbd22da6d9;hpb=b7b0742cc0f489572dbb8d68353e1c7a525b59e5;p=clitk.git diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 9258fdb..3773aa0 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -128,7 +128,7 @@ vvSlicer::vvSlicer() #if VTK_MAJOR_VERSION <= 5 pdm->SetInput(crossCursor->GetOutput()); #else - pdm->SetInputData(crossCursor->GetOutput()); + pdm->SetInputConnection(crossCursor->GetOutputPort(0)); #endif pdmA = vtkSmartPointer::New(); @@ -422,7 +422,6 @@ void vvSlicer::SetOverlay(vvImage::Pointer overlay) #else mOverlayReslice->SetInputData(0, mOverlay->GetFirstVTKImageData()); #endif - mImageReslice->UpdateInformation(); mOverlayReslice->Update(); if (!mOverlayMapper) @@ -430,7 +429,7 @@ void vvSlicer::SetOverlay(vvImage::Pointer overlay) #if VTK_MAJOR_VERSION <= 5 mOverlayMapper->SetInput(mOverlayReslice->GetOutput()); #else - mOverlayMapper->SetInputData(mOverlayReslice->GetOutput()); + mOverlayMapper->SetInputConnection(mOverlayReslice->GetOutputPort(0)); #endif if (!mOverlayActor) { @@ -503,7 +502,7 @@ void vvSlicer::SetFusion(vvImage::Pointer fusion, int fusionSequenceCode) #if VTK_MAJOR_VERSION <= 5 mFusionMapper->SetInput(mFusionReslice->GetOutput()); #else - mFusionMapper->SetInputData(mFusionReslice->GetOutput()); + mFusionMapper->SetInputConnection(mFusionReslice->GetOutputPort(0)); #endif if (!mFusionActor) { @@ -584,7 +583,7 @@ void vvSlicer::SetVF(vvImage::Pointer vf) mAAFilter->SetInput(mVOIFilter->GetOutput()); #else mVOIFilter->SetInputData(vf->GetFirstVTKImageData()); - mAAFilter->SetInputData(mVOIFilter->GetOutput()); + mAAFilter->SetInputConnection(mVOIFilter->GetOutputPort()); #endif ///This tells VTK to use the scalar (pixel) data of the image to draw the little arrows mAAFilter->Assign(vtkDataSetAttributes::SCALARS, vtkDataSetAttributes::VECTORS, vtkAssignAttribute::POINT_DATA); @@ -602,8 +601,8 @@ void vvSlicer::SetVF(vvImage::Pointer vf) mGlyphFilter->SetInput(mAAFilter->GetOutput()); mGlyphFilter->SetSource(mArrow->GetOutput()); #else - mGlyphFilter->SetInputData(mAAFilter->GetOutput()); - mGlyphFilter->SetSourceData(mArrow->GetOutput()); + mGlyphFilter->SetInputConnection(mAAFilter->GetOutputPort()); + mGlyphFilter->SetSourceConnection(mArrow->GetOutputPort()); #endif mGlyphFilter->ScalingOn(); mGlyphFilter->SetScaleModeToScaleByVector(); @@ -625,7 +624,7 @@ void vvSlicer::SetVF(vvImage::Pointer vf) #if VTK_MAJOR_VERSION <= 5 mVFMapper->SetInput(mGlyphFilter->GetOutput()); #else - mVFMapper->SetInputData(mGlyphFilter->GetOutput()); + mVFMapper->SetInputConnection(mGlyphFilter->GetOutputPort()); #endif mVFMapper->ImmediateModeRenderingOn(); mVFMapper->SetLookupTable(mVFColorLUT); @@ -679,8 +678,8 @@ void vvSlicer::SetLandmarks(vvLandmarks* landmarks) #else mLandClipper->SetInputData(mLandmarks->GetOutput()); - mLandGlyph->SetSourceData(mCross->GetOutput()); - mLandGlyph->SetInputData(mLandClipper->GetOutput()); + mLandGlyph->SetSourceConnection(mCross->GetOutputPort()); + mLandGlyph->SetInputConnection(mLandClipper->GetOutputPort()); #endif //mLandGlyph->SetIndexModeToScalar(); //mLandGlyph->SetRange(0,1); @@ -695,6 +694,7 @@ void vvSlicer::SetLandmarks(vvLandmarks* landmarks) //mLandMapper->ScalarVisibilityOff(); mLandActor->SetMapper(mLandMapper); + mLandActor->GetProperty()->SetOpacity(0.995); mLandActor->GetProperty()->SetColor(255,10,212); mLandActor->SetPickable(0); mLandActor->SetVisibility(true); @@ -840,7 +840,6 @@ void vvSlicer::SetTSlice(int t, bool updateLinkedImages) #else mOverlayReslice->SetInputData( mOverlay->GetVTKImages()[mCurrentOverlayTSlice] ); #endif - // Update overlay transform mConcatenatedOverlayTransform->Identity(); mConcatenatedOverlayTransform->Concatenate(mOverlay->GetTransform()[mCurrentOverlayTSlice]); @@ -1096,11 +1095,10 @@ void vvSlicer::UpdateDisplayExtent() // Image actor this->ImageActor->SetVisibility(mImageVisibility); -#if VTK_MAJOR_VERSION <= 5 this->ImageActor->SetDisplayExtent(w_ext); -#else - cout << mReducedExtent[0] << " " << mReducedExtent[1] << " " << mReducedExtent[2] << " " << mReducedExtent[3] << " " << mReducedExtent[4] << " " << mReducedExtent[5] << endl; +#if VTK_MAJOR_VERSION >= 6 vtkSmartPointer mapperOpenGL= vtkSmartPointer::New(); + try { mapperOpenGL = dynamic_cast(GetImageActor()->GetMapper()); } catch (const std::bad_cast& e) { @@ -1110,14 +1108,17 @@ void vvSlicer::UpdateDisplayExtent() } if (mFirstSetSliceOrientation) { copyExtent(ext, mRegisterExtent); - this->ImageActor->SetDisplayExtent(w_ext); //initialisation } else { int w_croppingRegion[6]; - copyExtent(mRegisterExtent, w_croppingRegion); + if (mUseReducedExtent) { + copyExtent(mReducedExtent, w_croppingRegion); + } else { + copyExtent(mRegisterExtent, w_croppingRegion); + } this->ImageActor->SetDisplayExtent(w_ext); w_croppingRegion[ this->SliceOrientation*2 ] = this->Slice; w_croppingRegion[ this->SliceOrientation*2+1 ] = this->Slice; - mapperOpenGL->SetCroppingRegion(w_croppingRegion); + mapperOpenGL->SetCroppingRegion(w_croppingRegion); } #endif @@ -1134,7 +1135,7 @@ void vvSlicer::UpdateDisplayExtent() #if VTK_MAJOR_VERSION <= 5 bool out = ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetWholeExtent()); #else - bool out = ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT())); + bool out = ClipDisplayedExtent(overExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())); #endif mOverlayActor->SetVisibility(!out); mOverlayActor->SetDisplayExtent( overExtent ); @@ -1154,7 +1155,7 @@ void vvSlicer::UpdateDisplayExtent() #if VTK_MAJOR_VERSION <= 5 bool out = ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetWholeExtent()); #else - bool out = ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT())); + bool out = ClipDisplayedExtent(fusExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())); #endif mFusionActor->SetVisibility(!out); mFusionActor->SetDisplayExtent( fusExtent ); @@ -1194,17 +1195,18 @@ void vvSlicer::UpdateDisplayExtent() #if VTK_MAJOR_VERSION <= 5 bool out = ClipDisplayedExtent(vfExtent, mVOIFilter->GetInput()->GetWholeExtent()); #else - bool out = ClipDisplayedExtent(vfExtent, mVOIFilter->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT())); + bool out = ClipDisplayedExtent(vfExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())); #endif mVFActor->SetVisibility(!out); mVOIFilter->SetVOI(vfExtent); int orientation[3] = {1,1,1}; orientation[this->SliceOrientation] = 0; mGlyphFilter->SetOrientation(orientation[0], orientation[1], orientation[2]); - mVFMapper->Update(); - position[this->SliceOrientation] += offset; mVFActor->SetPosition(position); + mVFActor->GetProperty()->SetOpacity(0.995); + mVFMapper->Update(); + } else if(mVF) mVFActor->SetVisibility(false); @@ -1550,7 +1552,7 @@ void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max, vtkImag #if VTK_MAJOR_VERSION <= 5 accFilter->SetInput(voiFilter->GetOutput()); #else - accFilter->SetInputData(voiFilter->GetOutput()); + accFilter->SetInputConnection(voiFilter->GetOutputPort(0)); #endif accFilter->Update(); @@ -1594,6 +1596,7 @@ double vvSlicer::GetScalarComponentAsDouble(vtkImageData *image, double X, doubl //---------------------------------------------------------------------------- void vvSlicer::Render() { //out << __func__ << endl; + if (this->mFusion && mFusionActor->GetVisibility() && showFusionLegend) { legend->SetLookupTable(this->GetFusionMapper()->GetLookupTable()); legend->UseOpacityOn(); @@ -1750,7 +1753,7 @@ void vvSlicer::Render() if (mLandMapper) UpdateLandmarks(); - this->GetRenderWindow()->Render(); + this->GetRenderWindow()->Render(); } //----------------------------------------------------------------------------