+ vtkContourWidget *contourWidget =
+ reinterpret_cast<vtkContourWidget*>(caller);
+
+ // Retrieve the windows event x, y, z
+ std::cout << "window click " << contourWidget->GetInteractor()->GetEventPosition()[0] << " "
+ << contourWidget->GetInteractor()->GetEventPosition()[1] << " "
+ << contourWidget->GetInteractor()->GetEventPosition()[2]
+ << std::endl;
+
+ // get the node postiion (the world position)
+ vtkContourRepresentation * rep=contourWidget->GetContourRepresentation();
+ double* worldclick = new double[2]();
+ rep->GetActiveNodeWorldPosition(worldclick);
+
+ std::cout << "worldclick click " << worldclick[0] << " " << worldclick[1] << " " << worldclick[2] << std::endl;
+
+ // change position
+ double* projection = new double[2]();
+ //restringedPosition[0] = nodepos[0];
+ //restringedPosition[1] = nodepos[1];
+ //restringedPosition[2] = 0; // ToDo: change is hard coded but must work for every plane/image
+
+ projection = GetClosesstPointToPlane(normal, worldclick);
+
+ std::cout << "projection click " << projection[0] << " " << projection[1] << " " << projection[2] << std::endl;
+
+ rep->SetActiveNodeToWorldPosition(projection);
+ //delete(nodepos);
+ }
+
+};
+
+int main(int argc, char *argv[])
+{
+ normal = new double[2]();
+ normal[0] = 1;
+ normal[1] = 1;
+ normal[2] = 1;
+ center = new double[2]();
+
+ // Create the RenderWindow, Renderer and both Actors
+ //
+ vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
+ vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
+ renderWindow->AddRenderer(renderer);
+
+ vtkSmartPointer<vtkRenderWindowInteractor> interactor =
+ vtkSmartPointer<vtkRenderWindowInteractor>::New();
+ interactor->SetRenderWindow(renderWindow);
+
+ renderer->SetBackground(0.1, 0.2, 0.4);
+ renderWindow->SetSize(600, 600);
+
+ // visual reference
+ // Create a plane
+ vtkSmartPointer<vtkPlaneSource> planeSource =
+ vtkSmartPointer<vtkPlaneSource>::New();
+ planeSource->SetCenter(center); // 0.0, 0.0, 0.0);
+ planeSource->SetNormal(normal); //1.0, 0.0, 1.0);
+ planeSource->Update();
+
+ vtkPolyData* plane = planeSource->GetOutput();
+
+ // Create a mapper and actor
+ vtkSmartPointer<vtkPolyDataMapper> mapper =
+ vtkSmartPointer<vtkPolyDataMapper>::New();
+ mapper->SetInputData(plane);
+
+ vtkSmartPointer<vtkActor> planeActor =
+ vtkSmartPointer<vtkActor>::New();
+ planeActor->SetMapper(mapper);
+
+ vtkSmartPointer<KeyPressInteractorStyle> style =
+ vtkSmartPointer<KeyPressInteractorStyle>::New();
+ interactor->SetInteractorStyle(style);
+
+ // create the contour stuff
+ vtkSmartPointer<vtkOrientedGlyphContourRepresentation> contourRep =
+ vtkSmartPointer<vtkOrientedGlyphContourRepresentation>::New();
+ contourRep->GetLinesProperty()->SetColor(0, 0, 1); //set color to red
+
+ vtkSmartPointer<vtkContourWidget> contourWidget =
+ vtkSmartPointer<vtkContourWidget>::New();
+ contourWidget->SetInteractor(interactor);
+ contourWidget->SetRepresentation(contourRep);
+
+ contourWidget->On();
+
+ for (int i = 0; i < argc; i++)
+ {
+ if (strcmp("-Shift", argv[i]) == 0)
+ {