void MainWindow::on_ResliceActionMarker(double  x, double y, double z)
{
	int pt_ID = 0;
	pt_ID = m_Image->FindPoint(x, y, z);
	std::cout << "Point ID is: " << pt_ID << std::endl;

	int extent[6];
	m_Image->GetExtent(extent);

	int x_e = extent[1] - extent[0] + 1;
	int y_e = extent[3] - extent[2] + 1;
	int z_e = extent[5] - extent[4] + 1;

	m_SliceZ = floor(pt_ID / (x_e*y_e));
	m_SliceY = floor(pt_ID % (x_e*y_e) / x_e);
	m_SliceX = pt_ID%x_e;


	m_3d_View->PopObject();
	auto ball = vtkSmartPointer<vtkSphereSource>::New();
	ball->SetRadius(5.0);
	ball->SetPhiResolution(50);
	ball->SetThetaResolution(50);
	ball->Update();
	auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
	mapper->SetInputData(ball->GetOutput());
	auto ball_actor = vtkSmartPointer<vtkActor>::New();
	ball_actor->SetMapper(mapper);
	ball_actor->GetProperty()->SetColor(1.0, 0.0, 0.0);
	ball_actor->SetPosition(x, y, z);
	m_3d_View->AddObject(ball_actor);
	m_3d_View->RefreshView();
}
/*
Begin selecting marker
*/
void MainWindow::on_Sel_Markers()
{
	QMessageBox msgBox;
	msgBox.setText("Select Marker.");
	//msgBox.setInformativeText("Press \"a\" to accept the marker.\nPress \"b\" to abort. \nPress \"q\" to finish.");
	msgBox.setInformativeText("Put the Tool in the corresponding place and press \"Capture\" ");
	msgBox.setStandardButtons(QMessageBox::Ok);
	int ret = msgBox.exec();

	auto ball = vtkSmartPointer<vtkSphereSource>::New();
	ball->SetRadius(5.0);
	ball->SetPhiResolution(50);
	ball->SetThetaResolution(50);
	ball->Update();
	auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
	mapper->SetInputData(ball->GetOutput());
	auto ball_actor = vtkSmartPointer<vtkActor>::New();
	ball_actor->SetMapper(mapper);
	ball_actor->GetProperty()->SetColor(1.0, 0.0, 0.0);
	m_3d_View->AddObject(ball_actor);
	m_3d_View->RefreshView();

	disconnect(m_3d_View, SIGNAL(on_timer_signal_coor(double, double, double)), this, SLOT(on_ResliceAction(double, double, double)));
	connect(m_3d_View, SIGNAL(on_timer_signal_coor(double, double, double)), this, SLOT(on_ResliceActionMarker(double, double, double)));

	// enable mouse pick first
	m_3d_View->EnablePick(); //press a to accept
}
Example #3
0
vtkMitkRectangleProp::vtkMitkRectangleProp():
  m_Height(0),
  m_Width(0),
  m_OriginX(0),
  m_OriginY(0)
{
  vtkSmartPointer<vtkPolyDataMapper2D> mapper = vtkSmartPointer<vtkPolyDataMapper2D>::New();
  m_PolyData = vtkSmartPointer<vtkPolyData>::New();

  vtkSmartPointer<vtkCellArray> lines = vtkSmartPointer<vtkCellArray>::New();
  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();

  m_PolyData->SetPoints(points);
  m_PolyData->SetLines(lines);

  vtkCoordinate *tcoord = vtkCoordinate::New();
  tcoord->SetCoordinateSystemToDisplay();
  mapper->SetTransformCoordinate(tcoord);
  tcoord->Delete();

  CreateRectangle();

  mapper->SetInputData(m_PolyData);
  SetMapper(mapper);
  GetProperty()->SetLineWidth(2);
}