예제 #1
0
/*
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
}
예제 #2
0
iA3DEllipseObjectVis::iA3DEllipseObjectVis(iAVtkWidget* widget, vtkTable* objectTable, QSharedPointer<QMap<uint, uint> > columnMapping,
	QColor const & color, int phiRes, int thetaRes) :
	iA3DColoredPolyObjectVis(widget, objectTable, columnMapping, color, (phiRes - 2) * thetaRes + 2)
{
	auto fullPolySource = vtkSmartPointer<vtkAppendPolyData>::New();
	// maybe use vtkParametricFunctionSource with vtkParametricEllipsoid?
	for (vtkIdType row = 0; row < objectTable->GetNumberOfRows(); ++row)
	{
		double cx = objectTable->GetValue(row, m_columnMapping->value(iACsvConfig::CenterX)).ToDouble();
		double cy = objectTable->GetValue(row, m_columnMapping->value(iACsvConfig::CenterY)).ToDouble();
		double cz = objectTable->GetValue(row, m_columnMapping->value(iACsvConfig::CenterZ)).ToDouble();
		double dx = objectTable->GetValue(row, m_columnMapping->value(iACsvConfig::DimensionX)).ToDouble()/2;
		double dy = objectTable->GetValue(row, m_columnMapping->value(iACsvConfig::DimensionY)).ToDouble()/2;
		double dz = objectTable->GetValue(row, m_columnMapping->value(iACsvConfig::DimensionZ)).ToDouble()/2;
		auto ellipsoidSrc = vtkSmartPointer<vtkEllipsoidSource>::New();
		ellipsoidSrc->SetThetaResolution(thetaRes);
		ellipsoidSrc->SetPhiResolution(phiRes);
		ellipsoidSrc->SetCenter(cx, cy, cz);
		ellipsoidSrc->SetXRadius(dx);
		ellipsoidSrc->SetYRadius(dy);
		ellipsoidSrc->SetZRadius(dz);
		ellipsoidSrc->Update();
		fullPolySource->AddInputData(ellipsoidSrc->GetOutput());
	}
	fullPolySource->Update();
	m_fullPoly = fullPolySource->GetOutput();
	m_fullPoly->GetPointData()->AddArray(m_colors);
	assert ( m_pointsPerObject*objectTable->GetNumberOfRows() == fullPolySource->GetOutput()->GetNumberOfPoints() );
	m_mapper->SetInputData(m_fullPoly);
	setupBoundingBox();
	setupOriginalIds();
}
예제 #3
0
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();
}
static vtkSmartPointer<vtkSphereSource> CreateHandle()
{
  auto handle = vtkSmartPointer<vtkSphereSource>::New();

  handle->SetPhiResolution(8);
  handle->SetThetaResolution(16);

  return handle;
}