Commit 3612684c authored by Emmanuel Promayon's avatar Emmanuel Promayon

NEW picked plane is back for arbitrary slice

parent 4f64c9fe
......@@ -29,6 +29,8 @@
// -- Core stuff
#include "Slice.h"
#include <Log.h>
// -- vtk stuff
#include <vtkProperty.h>
#include <vtkViewport.h>
......@@ -285,9 +287,11 @@ void Slice::initActors() {
// reslicer for the arbitrary slice
image2DReslicer = vtkSmartPointer<vtkImageReslice>::New();
image2DReslicer->SetOutputDimensionality(2);
image2DReslicer->SetInputConnection(imgToMapFilter->GetOutputPort());
image2DReslicer->AutoCropOutputOff();
// 2D output
image2DReslicer->SetOutputDimensionality(2);
// generate image wherever there is a input voxel (and therefore modify the image dimensions if possible)
image2DReslicer->AutoCropOutputOn();
// for the 2D and 3D image actors it is either directly plugged to the output of imgToMapFilter
// (if this is a perpendicular orientation) or to the reslicer (if this is an arbitrary orientation)
......@@ -481,9 +485,35 @@ void Slice::updatePickPlane() {
// update the point positions
double sliceBackPlane, sliceFrontPlane;
double bounds[6];
switch (sliceOrientation) {
case ARBITRARY: {
// for arbitrary, the size does not change, but the position
// can move up and down depending on the current orientation/translation
// => invert the translation to set the plane actor at the proper place
double sliceThickness = originalSpacing[2] / 2.0;
double currentX = 0.0;
double currentY = 0.0;
if (image2DReslicer != nullptr && image2DReslicer->GetResliceAxes() != nullptr) {
currentX = - image2DReslicer->GetResliceAxes()->GetElement(0, 3);
currentY = - image2DReslicer->GetResliceAxes()->GetElement(1, 3);
}
image2DActor->GetBounds(bounds);
CAMITK_INFO_ALT(QString("extent %1, %2, %3, %4, %5, %6").arg(bounds[0]).arg(bounds[1]).arg(bounds[2]).arg(bounds[3]).arg(bounds[4]).arg(bounds[5]));
pickPlaneActorPointSet->GetPoints()->SetPoint(0, bounds[0], bounds[2], -sliceThickness);
pickPlaneActorPointSet->GetPoints()->SetPoint(1, bounds[0], bounds[2], sliceThickness);
pickPlaneActorPointSet->GetPoints()->SetPoint(2, bounds[0], bounds[3], sliceThickness);
pickPlaneActorPointSet->GetPoints()->SetPoint(3, bounds[0], bounds[3], -sliceThickness);
pickPlaneActorPointSet->GetPoints()->SetPoint(4, bounds[1], bounds[2], -sliceThickness);
pickPlaneActorPointSet->GetPoints()->SetPoint(5, bounds[1], bounds[2], sliceThickness);
pickPlaneActorPointSet->GetPoints()->SetPoint(6, bounds[1], bounds[3], sliceThickness);
pickPlaneActorPointSet->GetPoints()->SetPoint(7, bounds[1], bounds[3], -sliceThickness);
}
break;
case AXIAL_NEURO:
case AXIAL:
image2DActor->GetBounds(bounds);
CAMITK_INFO_ALT(QString("extent %1, %2, %3, %4, %5, %6").arg(bounds[0]).arg(bounds[1]).arg(bounds[2]).arg(bounds[3]).arg(bounds[4]).arg(bounds[5]));
sliceBackPlane = currentSliceIndex * originalSpacing[2] - originalSpacing[2] / 2.0;
sliceFrontPlane = currentSliceIndex * originalSpacing[2] + originalSpacing[2] / 2.0;
pickPlaneActorPointSet->GetPoints()->SetPoint(0, 0.0, 0.0, sliceBackPlane);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment