33 #include <boost/cstdint.hpp> 36 #include <vtkPolyData.h> 37 #include <vtkAppendPolyData.h> 38 #include <vtkConeSource.h> 39 #include <vtkCylinderSource.h> 43 #include <vtkClipPolyData.h> 55 Eigen::Array2i extent = frameSize - 1;
58 Vector3D imageSpacing(width/extent[0], depth/extent[1], 1.0);
62 retval.
setSize(QSize(frameSize[0], frameSize[1]));
75 retval->setProbeSector(probeDefinition);
76 retval->setVisible(
true);
77 retval->startTracking(30);
85 int DummyTool::mTransformCount = 0;
93 mTransformSaveFileName(
"DummyToolsAreToDumbToSaveThemselves"),
97 qRegisterMetaType<Transform3D>(
"Transform3D");
105 connect(mTimer.get(), SIGNAL(timeout()),
this, SLOT(sendTransform()));
134 mTransforms = positions;
149 mTransformSaveFileName = filename;
167 connect(mThread, SIGNAL(ping()),
this, SLOT(sendTransform()));
182 void DummyTool::stopThread()
188 disconnect(mThread, SIGNAL(ping()),
this, SLOT(sendTransform()));
193 if (mThread->isRunning())
195 mThread->terminate();
216 void DummyTool::sendTransform()
227 vtkPolyDataPtr DummyTool::createPolyData(
double h1,
double h2,
double r1,
double r2)
238 plane->SetNormal(0,0,-1);
239 plane->SetOrigin(0,0,-h2);
242 double h1_extension = h1*r2 / (r1-r2);
243 double h1_mod = h1+h1_extension;
244 cone1->SetResolution(50);
245 cone1->SetRadius(r1);
246 cone1->SetHeight(h1_mod);
247 cone1->SetDirection(0,0,1);
248 double center1 = -h1/2-h2+h1_extension/2;
252 clipper1->SetInputConnection(cone1->GetOutputPort());
253 clipper1->SetClipFunction(plane);
256 cone2->SetResolution(25);
257 cone2->SetRadius(r2);
258 cone2->SetHeight(h2);
259 cone2->SetDirection(0,0,1);
260 double center2 = -h2/2;
263 assembly->AddInputConnection(clipper1->GetOutputPort());
264 assembly->AddInputConnection(cone2->GetOutputPort());
267 return assembly->GetOutput();
276 for (
unsigned i=0; i<N; ++i)
280 retval->push_back(T * R);
286 std::vector<Transform3D> DummyTool::createToolPositionMovement(
const DoubleBoundingBox3D& bb)
const 289 std::vector<Transform3D> retval;
296 Vector3D d = c +
Vector3D(0, 0, range[2]/2);
309 double step = *std::max_element(range.begin(), range.end()) / steps;
315 createLinearMovement(&retval, &T, R, a, b, step);
317 for (
unsigned i=0; i<50; ++i)
321 retval.push_back(T * R);
324 createLinearMovement(&retval, &T, R, b, c, step);
326 for (
unsigned i=0; i<50; ++i)
330 retval.push_back(T * R);
333 createLinearMovement(&retval, &T, R, c, d, step);
334 createLinearMovement(&retval, &T, R, d, a, step);
336 for (
unsigned i=0; i<20; ++i)
340 retval.push_back(T * R);
350 std::vector<Transform3D> retval;
364 double step = *std::max_element(range.begin(), range.end()) / steps;
370 createLinearMovement(&retval, &T, R, a, b, step);
371 createLinearMovement(&retval, &T, R, b, c, step);
372 createLinearMovement(&retval, &T, R, c, d, step);
373 createLinearMovement(&retval, &T, R, d, a, step);
381 if(mTransformCount >=
int(mTransforms.size()))
384 return &mTransforms.at(mTransformCount++);
PlainObject normal() const
void setSpacing(Vector3D spacing)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
US beam is emitted straight forward.
vtkSmartPointer< class vtkAppendPolyData > vtkAppendPolyDataPtr
void setSector(double depthStart, double depthEnd, double width, double centerOffset=0)
vtkSmartPointer< class vtkClipPolyData > vtkClipPolyDataPtr
double roundAwayFromZero(double val)
boost::shared_ptr< class DummyTool > DummyToolPtr
void setOrigin_p(Vector3D origin_p)
void setClipRect_p(DoubleBoundingBox3D clipRect_p)
Transform3D createTransformTranslate(const Vector3D &translation)
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
vtkSmartPointer< class vtkConeSource > vtkConeSourcePtr
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition of characteristics for an Ultrasound Probe Sector.
RealScalar length() const
Transform3D createTransformRotateZ(const double angle)
Transform3D createTransformRotateX(const double angle)
vtkSmartPointer< class vtkPlane > vtkPlanePtr
Namespace for all CustusX production code.