X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvSlicer.cxx;h=f74bdb8873559cf29a59548df95df303faacdcc7;hb=eab384b4509ea170c55a307b9eb484e70c636bba;hp=b2f3969582480229524a31374d405c1cece85189;hpb=9bca3279547234921425e1311a118e1e3ad39568;p=clitk.git diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index b2f3969..f74bdb8 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -1070,6 +1070,7 @@ int vvSlicer::GetOrientation() //---------------------------------------------------------------------------- void vvSlicer::UpdateDisplayExtent() { + emit UpdateDisplayExtentBegin(mSlicerNumber); vtkImageData *input = this->GetInput(); if (!input || !this->ImageActor) { return; @@ -1190,17 +1191,19 @@ void vvSlicer::UpdateDisplayExtent() } else if(mVF) mVFActor->SetVisibility(false); + + + double boundsT [6]; + for(unsigned int i=0; i<6; i++) + boundsT[i] = ImageActor->GetBounds()[i]; + boundsT[ this->SliceOrientation*2 ] = ImageActor->GetBounds()[ this->SliceOrientation*2 ]-fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]); + boundsT[ this->SliceOrientation*2+1 ] = ImageActor->GetBounds()[ this->SliceOrientation*2+1 ]+fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]); + // Landmarks actor if (mLandActor) { if (mClipBox) { - double bounds [6]; - for(unsigned int i=0; i<6; i++) - bounds[i] = ImageActor->GetBounds()[i]; - bounds[ this->SliceOrientation*2 ] = ImageActor->GetBounds()[ this->SliceOrientation*2 ]-fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]); - bounds[ this->SliceOrientation*2+1 ] = ImageActor->GetBounds()[ this->SliceOrientation*2+1 ]+fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]); - mClipBox->SetBounds(bounds); - UpdateLandmarks(); + RemoveLandmarks(); } position[this->SliceOrientation] = offset; @@ -1225,7 +1228,14 @@ void vvSlicer::UpdateDisplayExtent() cam->SetClippingRange(range - sumSpacing, range + sumSpacing); } } + + if (mLandActor) { + if (mClipBox) { + DisplayLandmarks(); + } + } } + emit UpdateDisplayExtentEnd(mSlicerNumber); } //---------------------------------------------------------------------------- @@ -1757,8 +1767,10 @@ void vvSlicer::Render() #endif mFusionMapper->Update(); } - if (mLandMapper) - UpdateLandmarks(); + if (mLandMapper) { + RemoveLandmarks(); + DisplayLandmarks(); + } this->GetRenderWindow()->Render(); } @@ -1778,24 +1790,43 @@ void vvSlicer::UpdateCursorPosition() //---------------------------------------------------------------------------- -void vvSlicer::UpdateLandmarks() +void vvSlicer::RemoveLandmarks() { vtkPolyData *pd = static_cast(mLandClipper->GetInput()); if (pd->GetPoints()) { - //mLandGlyph->SetRange(0,1); - //mLandGlyph->Modified(); - //mLandGlyph->Update(); - mClipBox->Modified(); - mLandClipper->Update(); - mLandMapper->Update(); - //Let's add the captions //First remove all captions: for(unsigned int i=0;iRenderer->RemoveActor2D(mLandLabelActors[i]); //allActors2D->Remove (mLandLabelActors[i]); } mLandLabelActors.clear(); + } +} +//---------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------- +void vvSlicer::DisplayLandmarks() +{ + + double bounds [6]; + for(unsigned int i=0; i<6; i++) + bounds[i] = ImageActor->GetBounds()[i]; + bounds[ this->SliceOrientation*2 ] = ImageActor->GetBounds()[ this->SliceOrientation*2 ]-fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]); + bounds[ this->SliceOrientation*2+1 ] = ImageActor->GetBounds()[ this->SliceOrientation*2+1 ]+fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]); + mClipBox->SetBounds(bounds); + + + vtkPolyData *pd = static_cast(mLandClipper->GetInput()); + if (pd->GetPoints()) { + //mLandGlyph->SetRange(0,1); + //mLandGlyph->Modified(); + //mLandGlyph->Update(); + + mClipBox->Modified(); + mLandClipper->Update(); + mLandMapper->Update(); //Next add the captions to the displayed points for (vtkIdType id=0; idGetOutput()->GetNumberOfPoints(); id++) { double *position = mLandClipper->GetOutput()->GetPoint(id);