From: tbaudier Date: Tue, 23 Feb 2016 12:53:50 +0000 (+0100) Subject: The profile points follow the current transform X-Git-Tag: v1.4.0~45 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=5768d2b6f7414288e013fde596958aba99384945;p=clitk.git The profile points follow the current transform --- diff --git a/vv/vvToolProfile.cxx b/vv/vvToolProfile.cxx index 4909aad..83334a2 100644 --- a/vv/vvToolProfile.cxx +++ b/vv/vvToolProfile.cxx @@ -160,6 +160,13 @@ void vvToolProfile::selectPoint1() int i(0); while (iGetImage()->GetNumberOfDimensions() && i<3) { pos[i] = mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetCursorPosition()[i]; + ++i; + } + double posTransformed[3]; + mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetConcatenatedTransform()->TransformPoint(pos, posTransformed); + i = 0; + while (iGetImage()->GetNumberOfDimensions() && i<3) { + pos[i] = posTransformed[i]; mPoint1[i] = round((pos[i] - mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[i])/mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[i]); pos[i] = mPoint1[i]*mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[i] + mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[i]; //Ensure to be at the center of the voxel position += QString::number(mPoint1[i],'f',0) + " "; @@ -211,8 +218,15 @@ void vvToolProfile::selectPoint2() pos[0] = pos[1] = pos[2] = pos[3] = 0;; int i(0); - while (iGetImage()->GetNumberOfDimensions() &&i<3) { + while (iGetImage()->GetNumberOfDimensions() && i<3) { pos[i] = mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetCursorPosition()[i]; + ++i; + } + double posTransformed[3]; + mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetConcatenatedTransform()->TransformPoint(pos, posTransformed); + i = 0; + while (iGetImage()->GetNumberOfDimensions() && i<3) { + pos[i] = posTransformed[i]; mPoint2[i] = round((pos[i] - mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[i])/mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[i]); pos[i] = mPoint2[i]*mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[i] + mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[i]; //Ensure to be at the center of the voxel position += QString::number(mPoint2[i],'f',0) + " ";