Commit ad4b8f70 authored by saubatn's avatar saubatn
Browse files

TEST Fixing bug 19

parent 8c4dcbdf
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <vtkTextActor.h> #include <vtkTextActor.h>
#include <vtkProperty2D.h> #include <vtkProperty2D.h>
#include <vtkImageFlip.h> #include <vtkImageFlip.h>
#include <vtkImageMapper3D.h>
using namespace std; using namespace std;
...@@ -179,14 +180,22 @@ void Slice::initActors() { ...@@ -179,14 +180,22 @@ void Slice::initActors() {
} else } else
imgToMapFilter->SetLookupTable(lut); imgToMapFilter->SetLookupTable(lut);
/// NICO + MAHNU
/* 3D Actor case: directly pluged to the output of imgToMapFilter */ /* 3D Actor case: directly pluged to the output of imgToMapFilter */
image3DActor->SetInputData(imgToMapFilter->GetOutput()); // image3DActor->SetInputData(imgToMapFilter->GetOutput());
image3DActor->GetMapper()->SetInputConnection(imgToMapFilter->GetOutputPort());
image3DActor->InterpolateOn(); image3DActor->InterpolateOn();
/// NICO + MAHNU
// 2D actors // 2D actors
image2DActor->SetInputData(imgToMapFilter->GetOutput()); // image2DActor->SetInputData(imgToMapFilter->GetOutput());
image2DActor->GetMapper()->SetInputConnection(imgToMapFilter->GetOutputPort());
image2DActor->InterpolateOn(); image2DActor->InterpolateOn();
/// NICO
// image2DActor->SetOpacity(0.5);
// Pick plane // Pick plane
updatePickPlane(); updatePickPlane();
...@@ -214,6 +223,9 @@ void Slice::initActors() { ...@@ -214,6 +223,9 @@ void Slice::initActors() {
pickPlaneActor->GetProperty()->SetOpacity(1.0); pickPlaneActor->GetProperty()->SetOpacity(1.0);
pickPlaneActor->GetProperty()->SetLineWidth(2.0); pickPlaneActor->GetProperty()->SetLineWidth(2.0);
/// NICO
// imgToMapFilter->Update();
// Orientation 2D Axes // Orientation 2D Axes
init2DAxesActor(); init2DAxesActor();
update2DAxesActorPosition(); update2DAxesActorPosition();
...@@ -440,7 +452,7 @@ void Slice::updatePixelActorPosition(double x, double y, double z) { ...@@ -440,7 +452,7 @@ void Slice::updatePixelActorPosition(double x, double y, double z) {
switch (sliceOrientation) { switch (sliceOrientation) {
case AXIAL: case AXIAL:
planeZCoord = z - (originalSpacing[2] / 2); planeZCoord = z - (originalSpacing[2] / 2.0);
// 0 -> Anterior Point // 0 -> Anterior Point
pixelPoints->InsertPoint(0, x, 0.0 , planeZCoord); pixelPoints->InsertPoint(0, x, 0.0 , planeZCoord);
// 1 -> Posterior Point // 1 -> Posterior Point
...@@ -452,7 +464,7 @@ void Slice::updatePixelActorPosition(double x, double y, double z) { ...@@ -452,7 +464,7 @@ void Slice::updatePixelActorPosition(double x, double y, double z) {
break; break;
case CORONAL: case CORONAL:
planeYCoord = y - (originalSpacing[1] / 2); planeYCoord = y - (originalSpacing[1] / 2.0);
// 0 -> Superior Point // 0 -> Superior Point
pixelPoints->InsertPoint(0, x , planeYCoord, originalSize[2]); pixelPoints->InsertPoint(0, x , planeYCoord, originalSize[2]);
// 1 -> Inferior Point // 1 -> Inferior Point
...@@ -464,7 +476,7 @@ void Slice::updatePixelActorPosition(double x, double y, double z) { ...@@ -464,7 +476,7 @@ void Slice::updatePixelActorPosition(double x, double y, double z) {
break; break;
case SAGITTAL: case SAGITTAL:
planeXCoord = x + (originalSpacing[0]/2); planeXCoord = x + (originalSpacing[0] / 2.0);
// 0 -> Superior Point // 0 -> Superior Point
pixelPoints->InsertPoint(0, planeXCoord, y, originalSize[2]); pixelPoints->InsertPoint(0, planeXCoord, y, originalSize[2]);
// 1 -> Inferior Point // 1 -> Inferior Point
...@@ -503,6 +515,9 @@ void Slice::updatePixelActorPosition(double x, double y, double z) { ...@@ -503,6 +515,9 @@ void Slice::updatePixelActorPosition(double x, double y, double z) {
vtkSmartPointer<vtkDataSetMapper> aPixelMapper = vtkSmartPointer<vtkDataSetMapper>::New(); vtkSmartPointer<vtkDataSetMapper> aPixelMapper = vtkSmartPointer<vtkDataSetMapper>::New();
aPixelMapper->SetInputData(aPixelGrid); aPixelMapper->SetInputData(aPixelGrid);
/// NICO
// aPixelMapper->Update();
pixelActor->SetMapper(aPixelMapper); pixelActor->SetMapper(aPixelMapper);
pixelActor->GetProperty()->SetAmbient(1.0); pixelActor->GetProperty()->SetAmbient(1.0);
pixelActor->GetProperty()->SetDiffuse(1.0); pixelActor->GetProperty()->SetDiffuse(1.0);
...@@ -525,7 +540,7 @@ void Slice::updatePixelActorPosition(double x, double y, double z) { ...@@ -525,7 +540,7 @@ void Slice::updatePixelActorPosition(double x, double y, double z) {
} }
pixelActor->GetProperty()->SetLineWidth( 1.0 ); pixelActor->GetProperty()->SetLineWidth( 1.0 );
pixelActor->SetPosition( 0.0, 0.0, 0.0 ); // pixelActor->SetPosition( 0.0, 0.0, 0.0 );
//-- pixelActor can not be picked //-- pixelActor can not be picked
pixelActor->PickableOff(); pixelActor->PickableOff();
} }
......
...@@ -198,7 +198,6 @@ void ImageComponent::updateImageProperties() { ...@@ -198,7 +198,6 @@ void ImageComponent::updateImageProperties() {
imageSize += ")"; imageSize += ")";
setProperty("Image Size", QVariant(imageSize)); setProperty("Image Size", QVariant(imageSize));
setProperty("Voxel Data Type", QVariant(getDataType())); setProperty("Voxel Data Type", QVariant(getDataType()));
setProperty("Display Image in 3D Viewer", QVariant(true)); setProperty("Display Image in 3D Viewer", QVariant(true));
...@@ -297,8 +296,10 @@ void ImageComponent::setImageData(vtkSmartPointer<vtkImageData> anImageData, ...@@ -297,8 +296,10 @@ void ImageComponent::setImageData(vtkSmartPointer<vtkImageData> anImageData,
imageResliceFilter->SetOutputDimensionality(3); imageResliceFilter->SetOutputDimensionality(3);
imageResliceFilter->SetResliceAxes(initialImageDataTransform->GetMatrix()); imageResliceFilter->SetResliceAxes(initialImageDataTransform->GetMatrix());
imageResliceFilter->Update(); imageResliceFilter->Update();
originalImageData = imageResliceFilter->GetOutput(); originalImageData = imageResliceFilter->GetOutput();
imageResliceFilter->Update(); // /// NICO
// originalImageData =vtkSmartPointer<vtkImageData>::New();
// originalImageData->DeepCopy(anImageData);
// 7. Store initialFrameTransform as the current frame // 7. Store initialFrameTransform as the current frame
// note: we need to get another matrix instance for the transformation (else it is deleted) // note: we need to get another matrix instance for the transformation (else it is deleted)
......
...@@ -389,12 +389,14 @@ RendererWidget::RendererWidget(QWidget* parent, ControlMode mode) : QVTKWidget(p ...@@ -389,12 +389,14 @@ RendererWidget::RendererWidget(QWidget* parent, ControlMode mode) : QVTKWidget(p
pointSize = 4.0; pointSize = 4.0;
//-- render window //-- render window
vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New(); /// NICO + MAHNU
vtkSmartPointer<vtkRenderWindow> renderWindow = GetRenderWindow();
// vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
//-- renderer //-- renderer
renderer = vtkSmartPointer<vtkRenderer>::New(); renderer = vtkSmartPointer<vtkRenderer>::New();
renderWindow->AddRenderer( renderer ); renderWindow->AddRenderer( renderer );
SetRenderWindow( renderWindow ); // SetRenderWindow( renderWindow ); /// NICO + MAHNU
//-- interactor //-- interactor
interactor = vtkSmartPointer<QVTKInteractor>::New(); interactor = vtkSmartPointer<QVTKInteractor>::New();
......
Supports Markdown
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