12 #include <boost/cstdint.hpp> 15 #include <vtkPolyData.h> 16 #include <vtkAppendPolyData.h> 17 #include <vtkConeSource.h> 18 #include <vtkCylinderSource.h> 22 #include <vtkClipPolyData.h> 34 Eigen::Array2i extent = frameSize - 1;
37 Vector3D imageSpacing(width/extent[0], depth/extent[1], 1.0);
41 retval.
setSize(QSize(frameSize[0], frameSize[1]));
54 retval->setProbeSector(probeDefinition);
55 retval->setVisible(
true);
56 retval->startTracking(30);
64 int DummyTool::mTransformCount = 0;
72 mTransformSaveFileName(
"DummyToolsAreToDumbToSaveThemselves"),
76 qRegisterMetaType<Transform3D>(
"Transform3D");
84 connect(mTimer.get(), SIGNAL(timeout()),
this, SLOT(sendTransform()));
113 mTransforms = positions;
124 mTransformSaveFileName = filename;
142 connect(mThread, SIGNAL(ping()),
this, SLOT(sendTransform()));
157 void DummyTool::stopThread()
163 disconnect(mThread, SIGNAL(ping()),
this, SLOT(sendTransform()));
168 if (mThread->isRunning())
170 mThread->terminate();
191 void DummyTool::sendTransform()
202 vtkPolyDataPtr DummyTool::createPolyData(
double h1,
double h2,
double r1,
double r2)
213 plane->SetNormal(0,0,-1);
214 plane->SetOrigin(0,0,-h2);
217 double h1_extension = h1*r2 / (r1-r2);
218 double h1_mod = h1+h1_extension;
219 cone1->SetResolution(50);
220 cone1->SetRadius(r1);
221 cone1->SetHeight(h1_mod);
222 cone1->SetDirection(0,0,1);
223 double center1 = -h1/2-h2+h1_extension/2;
227 clipper1->SetInputConnection(cone1->GetOutputPort());
228 clipper1->SetClipFunction(plane);
231 cone2->SetResolution(25);
232 cone2->SetRadius(r2);
233 cone2->SetHeight(h2);
234 cone2->SetDirection(0,0,1);
235 double center2 = -h2/2;
238 assembly->AddInputConnection(clipper1->GetOutputPort());
239 assembly->AddInputConnection(cone2->GetOutputPort());
242 return assembly->GetOutput();
251 for (
unsigned i=0; i<N; ++i)
255 retval->push_back(T * R);
261 std::vector<Transform3D> DummyTool::createToolPositionMovement(
const DoubleBoundingBox3D& bb)
const 264 std::vector<Transform3D> retval;
271 Vector3D d = c +
Vector3D(0, 0, range[2]/2);
284 double step = *std::max_element(range.begin(), range.end()) / steps;
290 createLinearMovement(&retval, &T, R, a, b, step);
292 for (
unsigned i=0; i<50; ++i)
296 retval.push_back(T * R);
299 createLinearMovement(&retval, &T, R, b, c, step);
301 for (
unsigned i=0; i<50; ++i)
305 retval.push_back(T * R);
308 createLinearMovement(&retval, &T, R, c, d, step);
309 createLinearMovement(&retval, &T, R, d, a, step);
311 for (
unsigned i=0; i<20; ++i)
315 retval.push_back(T * R);
325 std::vector<Transform3D> retval;
339 double step = *std::max_element(range.begin(), range.end()) / steps;
345 createLinearMovement(&retval, &T, R, a, b, step);
346 createLinearMovement(&retval, &T, R, b, c, step);
347 createLinearMovement(&retval, &T, R, c, d, step);
348 createLinearMovement(&retval, &T, R, d, a, step);
356 if(mTransformCount >=
int(mTransforms.size()))
359 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.