From: tbaudier Date: Tue, 23 Feb 2016 10:12:15 +0000 (+0100) Subject: Landmarks move with the image during registration X-Git-Tag: v1.4.0~48 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=f0869308f55704ef51422919287efa675e14a77e;p=clitk.git Landmarks move with the image during registration --- diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 2729bd6..314b58c 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -669,12 +669,24 @@ void vvSlicer::SetLandmarks(vvLandmarks* landmarks) mLandClipper->SetClipFunction(mClipBox); mLandClipper->InsideOutOn(); #if VTK_MAJOR_VERSION <= 5 - mLandClipper->SetInput(mLandmarks->GetOutput()); + mLandmarkTransform = vtkSmartPointer::New(); + mLandmarkTransform->SetInput(mLandmarks->GetOutput()); + mConcatenatedTransform->Identity(); + mConcatenatedTransform->Concatenate(mImage->GetTransform()[0]); + mConcatenatedTransform->Concatenate(mSlicingTransform); + mLandmarkTransform->SetTransform(mConcatenatedTransform->GetInverse()); + mLandClipper->SetInput(mLandmarkTransform->GetOutput()); mLandGlyph->SetSource(mCross->GetOutput()); mLandGlyph->SetInput(mLandClipper->GetOutput()); #else - mLandClipper->SetInputData(mLandmarks->GetOutput()); + mLandmarkTransform = vtkSmartPointer::New(); + mLandmarkTransform->SetInputData(mLandmarks->GetOutput()); + mConcatenatedTransform->Identity(); + mConcatenatedTransform->Concatenate(mImage->GetTransform()[0]); + mConcatenatedTransform->Concatenate(mSlicingTransform); + mLandmarkTransform->SetTransform(mConcatenatedTransform->GetInverse()); + mLandClipper->SetInputConnection(mLandmarkTransform->GetOutputPort()); mLandGlyph->SetSourceConnection(mCross->GetOutputPort()); mLandGlyph->SetInputConnection(mLandClipper->GetOutputPort()); @@ -697,7 +709,6 @@ void vvSlicer::SetLandmarks(vvLandmarks* landmarks) mLandActor->SetPickable(0); mLandActor->SetVisibility(true); this->UpdateDisplayExtent(); - this->GetRenderer()->AddActor(mLandActor); } } //------------------------------------------------------------------------------ @@ -1802,7 +1813,7 @@ void vvSlicer::UpdateCursorPosition() //---------------------------------------------------------------------------- void vvSlicer::RemoveLandmarks() { - vtkPolyData *pd = static_cast(mLandClipper->GetInput()); + vtkPolyData *pd = static_cast(mLandmarks->GetOutput()); if (pd->GetPoints()) { //First remove all captions: @@ -1828,12 +1839,12 @@ void vvSlicer::DisplayLandmarks() mClipBox->SetBounds(bounds); - vtkPolyData *pd = static_cast(mLandClipper->GetInput()); + vtkPolyData *pd = static_cast(mLandmarks->GetOutput()); if (pd->GetPoints()) { + this->GetRenderer()->AddActor(mLandActor); //mLandGlyph->SetRange(0,1); //mLandGlyph->Modified(); //mLandGlyph->Update(); - mClipBox->Modified(); mLandClipper->Update(); mLandMapper->Update(); diff --git a/vv/vvSlicer.h b/vv/vvSlicer.h index 4fadb3e..5027d16 100644 --- a/vv/vvSlicer.h +++ b/vv/vvSlicer.h @@ -35,6 +35,7 @@ #include #include #include +#include class vtkActor; class vtkActor2D; @@ -246,6 +247,7 @@ protected: // ___|__|___ VTK world coordinates (mm) (never displayed) mCurrent vtkSmartPointer mSlicingTransform; + vtkSmartPointer mLandmarkTransform; vtkSmartPointer mImageReslice; vtkSmartPointer mConcatenatedTransform; vtkSmartPointer mOverlayReslice;