Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix buildsystem #4

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions Logic/vtkSlicerModelClipLogic.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
#include "vtkSlicerModelClipLogic.h"

// MRML includes
#include <vtkMRMLScene.h>

// VTK includes
#include <vtkIntArray.h>
#include <vtkNew.h>
#include <vtkObjectFactory.h>

// STD includes
#include <cassert>
Expand Down
2 changes: 1 addition & 1 deletion QPlane.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ vtkSmartPointer<vtkPlane> QPlane::getPlane()

vtkSmartPointer<vtkActor> QPlane::getActor()
{
this->mapper->SetInput(this->planeSource->GetOutput());
this->mapper->SetInputConnection(this->planeSource->GetOutputPort());
this->actor->SetMapper(this->mapper);
this->actor->GetProperty()->SetColor(0, 0, 1);
return this->actor;
Expand Down
2 changes: 1 addition & 1 deletion Widgets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set(${KIT}_UI_SRCS
)

set(${KIT}_RESOURCES
../Resources/UI/qSlicer${MODULE_NAME}FooBarWidget.ui
../Resources/qSlicer${MODULE_NAME}Module.qrc
)

set(${KIT}_TARGET_LIBRARIES
Expand Down
3 changes: 3 additions & 0 deletions qSlicerModelClipModule.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
#include "qSlicerModelClipModuleWidget.h"

//-----------------------------------------------------------------------------
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
#include <QtPlugin>
Q_EXPORT_PLUGIN2(qSlicerModelClipModule, qSlicerModelClipModule);
#endif

//-----------------------------------------------------------------------------
/// \ingroup Slicer_QtModules_ExtensionTemplate
Expand Down
3 changes: 3 additions & 0 deletions qSlicerModelClipModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ qSlicerModelClipModule
: public qSlicerLoadableModule
{
Q_OBJECT
#ifdef Slicer_HAVE_QT5
Q_PLUGIN_METADATA(IID "org.slicer.modules.loadable.qSlicerLoadableModule/1.0");
#endif
Q_INTERFACES(qSlicerLoadableModule);

public:
Expand Down
8 changes: 3 additions & 5 deletions qSlicerModelClipModuleWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ void qSlicerModelClipModuleWidget::removePlane()
pt2 = this->planeList.last()->getPlaneSource()->GetPoint2();
delete this->planeList.last();
this->planeList.removeLast();
int index = this->planeList.indexOf(this->planeList.last());
this->planeExtend->SetOrigin(o);
this->planeExtend->SetPoint1(pt1);
this->planeExtend->SetPoint2(pt2);
Expand Down Expand Up @@ -323,7 +322,6 @@ void qSlicerModelClipModuleWidget::setDepth()
double *oP2 = new double[3];
double *pt1 = new double[3];
double *axis = new double[3];
double *axisNorm = new double[3];
vtkMath::Subtract(this->planeWidget->GetPoint2(),
this->planeWidget->GetOrigin(), oP2);
vtkMath::Subtract(this->planeWidget->GetPoint1(),
Expand Down Expand Up @@ -378,7 +376,7 @@ void qSlicerModelClipModuleWidget::clip()
vtkSmartPointer<vtkMRMLModelNode>::New();
sourceModel->Copy(sourceNode);
this->sourcePD->DeepCopy(sourceModel->GetPolyData());
this->clipper->SetInput(this->sourcePD);
this->clipper->SetInputData(this->sourcePD);

// make the clipping surface using bool operation and set it as the clip
// function of the clipper - core part
Expand Down Expand Up @@ -428,7 +426,7 @@ void qSlicerModelClipModuleWidget::clip()
vtkSmartPointer<vtkMRMLModelStorageNode>::New();
resultDisplay->SetScene(mrmlScene);
resultStorage->SetScene(mrmlScene);
resultDisplay->SetInputPolyData(resultModel->GetPolyData());
resultDisplay->SetInputPolyDataConnection(resultModel->GetPolyDataConnection());
resultDisplay->SetColor(1.0, 0.0, 0.0);
resultStorage->SetFileName(resultName.toLatin1().data());
mrmlScene->AddNode(resultDisplay);
Expand All @@ -452,7 +450,7 @@ void qSlicerModelClipModuleWidget::clip()
vtkSmartPointer<vtkMRMLModelStorageNode>::New();
clippedDisplay->SetScene(mrmlScene);
clippedStorage->SetScene(mrmlScene);
clippedDisplay->SetInputPolyData(clippedModel->GetPolyData());
clippedDisplay->SetInputPolyDataConnection(clippedModel->GetPolyDataConnection());
clippedDisplay->SetColor(0.0, 1.0, 0.0);
clippedStorage->SetFileName(clippedName.toLatin1().data());
mrmlScene->AddNode(clippedDisplay);
Expand Down
39 changes: 17 additions & 22 deletions vtkPlaneExtend.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ vtkPlaneExtend::vtkPlaneExtend() : vtkPolyDataSourceWidget()
this->PlaneOutline->SetPolys(outline);
outline->Delete();
this->PlaneMapper = vtkPolyDataMapper::New();
this->PlaneMapper->SetInput(this->PlaneSource->GetOutput());
this->PlaneMapper->SetInputConnection(this->PlaneSource->GetOutputPort());
this->PlaneActor = vtkActor::New();
this->PlaneActor->SetMapper(this->PlaneMapper);

Expand All @@ -86,7 +86,7 @@ vtkPlaneExtend::vtkPlaneExtend() : vtkPolyDataSourceWidget()
this->HandleGeometry[i]->SetThetaResolution(16);
this->HandleGeometry[i]->SetPhiResolution(8);
this->HandleMapper[i] = vtkPolyDataMapper::New();
this->HandleMapper[i]->SetInput(this->HandleGeometry[i]->GetOutput());
this->HandleMapper[i]->SetInputConnection(this->HandleGeometry[i]->GetOutputPort());
this->Handle[i] = vtkActor::New();
this->Handle[i]->SetMapper(this->HandleMapper[i]);
}
Expand All @@ -95,31 +95,31 @@ vtkPlaneExtend::vtkPlaneExtend() : vtkPolyDataSourceWidget()
this->LineSource = vtkLineSource::New();
this->LineSource->SetResolution(1);
this->LineMapper = vtkPolyDataMapper::New();
this->LineMapper->SetInput(this->LineSource->GetOutput());
this->LineMapper->SetInputConnection(this->LineSource->GetOutputPort());
this->LineActor = vtkActor::New();
this->LineActor->SetMapper(this->LineMapper);

this->ConeSource = vtkConeSource::New();
this->ConeSource->SetResolution(12);
this->ConeSource->SetAngle(25.0);
this->ConeMapper = vtkPolyDataMapper::New();
this->ConeMapper->SetInput(this->ConeSource->GetOutput());
this->ConeMapper->SetInputConnection(this->ConeSource->GetOutputPort());
this->ConeActor = vtkActor::New();
this->ConeActor->SetMapper(this->ConeMapper);

// Create the - plane normal
this->LineSource2 = vtkLineSource::New();
this->LineSource2->SetResolution(1);
this->LineMapper2 = vtkPolyDataMapper::New();
this->LineMapper2->SetInput(this->LineSource2->GetOutput());
this->LineMapper2->SetInputConnection(this->LineSource2->GetOutputPort());
this->LineActor2 = vtkActor::New();
this->LineActor2->SetMapper(this->LineMapper2);

this->ConeSource2 = vtkConeSource::New();
this->ConeSource2->SetResolution(12);
this->ConeSource2->SetAngle(25.0);
this->ConeMapper2 = vtkPolyDataMapper::New();
this->ConeMapper2->SetInput(this->ConeSource2->GetOutput());
this->ConeMapper2->SetInputConnection(this->ConeSource2->GetOutputPort());
this->ConeActor2 = vtkActor::New();
this->ConeActor2->SetMapper(this->ConeMapper2);

Expand Down Expand Up @@ -745,7 +745,6 @@ void vtkPlaneExtend::MovePoint3(double *p1, double *p2)
{
//Get the plane definition
double *o = this->PlaneSource->GetOrigin();
double *pt1 = this->PlaneSource->GetPoint1();
double *pt2 = this->PlaneSource->GetPoint2();

//Get the vector of motion
Expand All @@ -759,24 +758,19 @@ void vtkPlaneExtend::MovePoint3(double *p1, double *p2)
vtkMath::ProjectVector(vReal, p02, v);

// Define vectors from point pt3
double p10[3], p20[3];
p10[0] = pt1[0] - o[0];
p10[1] = pt1[1] - o[1];
p10[2] = pt1[2] - o[2];
double p20[3];
p20[0] = pt2[0] - o[0];
p20[1] = pt2[1] - o[1];
p20[2] = pt2[2] - o[2];

double vN = vtkMath::Norm(v);
double n10 = vtkMath::Norm(p10);
double n20 = vtkMath::Norm(p20);

// Project v onto these vector to determine the amount of motion
// Scale it by the relative size of the motion to the vector length
double d1 = (vN/n10) * vtkMath::Dot(v,p10) / (vN*n10);
double d2 = (vN/n20) * vtkMath::Dot(v,p20) / (vN*n20);

double point1[3], point2[3];
double point2[3];
for (int i=0; i<3; i++)
{
point2[i] = o[i] + (1.0+d2)*p20[i];
Expand All @@ -788,12 +782,11 @@ void vtkPlaneExtend::MovePoint3(double *p1, double *p2)
this->PositionHandles();
}

void vtkPlaneExtend::Rotate(double *p1, double *p2, double *vpn)
void vtkPlaneExtend::Rotate(double *p1, double *p2, double *vtkNotUsed(vpn))
{
double *o = this->PlaneSource->GetOrigin();
double *pt1 = this->PlaneSource->GetPoint1();
double *pt2 = this->PlaneSource->GetPoint2();
double *center = this->PlaneSource->GetCenter();

double v[3]; //vector of motion
double axis[3]; //axis of rotation
Expand Down Expand Up @@ -862,7 +855,7 @@ void vtkPlaneExtend::PlaceWidget(double bds[6])

this->AdjustBounds(bds, bounds, center);

if (this->Input || this->Prop3D)
if (this->GetInput() || this->Prop3D)
{
if ( this->NormalToYAxis )
{
Expand Down Expand Up @@ -894,7 +887,7 @@ void vtkPlaneExtend::PlaceWidget(double bds[6])
this->InitialBounds[i] = bounds[i];
}

if (this->Input || this->Prop3D)
if (this->GetInput() || this->Prop3D)
{
this->InitialLength = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
(bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
Expand Down Expand Up @@ -967,21 +960,21 @@ void vtkPlaneExtend::SelectRepresentation()
{
this->CurrentRenderer->RemoveActor(this->PlaneActor);
this->CurrentRenderer->AddActor(this->PlaneActor);
this->PlaneMapper->SetInput( this->PlaneOutline );
this->PlaneMapper->SetInputData( this->PlaneOutline );
this->PlaneActor->GetProperty()->SetRepresentationToWireframe();
}
else if ( this->Representation == VTK_PLANE_SURFACE )
{
this->CurrentRenderer->RemoveActor(this->PlaneActor);
this->CurrentRenderer->AddActor(this->PlaneActor);
this->PlaneMapper->SetInput( this->PlaneSource->GetOutput() );
this->PlaneMapper->SetInputConnection( this->PlaneSource->GetOutputPort() );
this->PlaneActor->GetProperty()->SetRepresentationToSurface();
}
else //( this->Representation == VTK_PLANE_WIREFRAME )
{
this->CurrentRenderer->RemoveActor(this->PlaneActor);
this->CurrentRenderer->AddActor(this->PlaneActor);
this->PlaneMapper->SetInput( this->PlaneSource->GetOutput() );
this->PlaneMapper->SetInputConnection( this->PlaneSource->GetOutputPort() );
this->PlaneActor->GetProperty()->SetRepresentationToWireframe();
}
}
Expand Down Expand Up @@ -1088,7 +1081,9 @@ double* vtkPlaneExtend::GetPoint3()

void vtkPlaneExtend::GetPoint3(double xyz[3])
{
xyz = this->GetPoint3();
xyz[0] = this->GetPoint3()[0];
xyz[1] = this->GetPoint3()[1];
xyz[2] = this->GetPoint3()[2];
}

// Description:
Expand Down