35 #include <vtkConeSource.h>
49 connect(&mTpsTimer, SIGNAL(timeout()),
this, SLOT(calculateTpsSlot()));
51 mTypes = this->determineTypesBasedOnUid(
Tool::mUid);
55 connect(mProbe.get(), SIGNAL(sectorChanged()),
this, SIGNAL(
toolProbeSector()));
58 this->createPolyData();
59 this->toolVisibleSlot(
true);
111 return this->
getProbe()->getProbeDefinition().getDepthStart();
122 std::set<Tool::Type> OpenIGTLinkTool::determineTypesBasedOnUid(
const QString uid)
const
124 std::set<Type> retval;
126 if(uid.contains(
"probe", Qt::CaseInsensitive))
133 bool OpenIGTLinkTool::isProbe()
const
135 return (mTypes.find(
TOOL_US_PROBE) != mTypes.end()) ?
true :
false;
138 void OpenIGTLinkTool::createPolyData()
146 bool calibrated = !
similar(m_sMt_calibration, identity);
147 CX_LOG_DEBUG() <<
"Checking if openiglink tool is calibratated: " << calibrated;
154 return m_sMt_calibration;
159 if(!
similar(m_sMt_calibration, sMt))
161 m_sMt_calibration = sMt;
166 void OpenIGTLinkTool::toolTransformAndTimestampSlot(
Transform3D prMs,
double timestamp)
168 mTimestamp = timestamp;
178 (*mPositionHistory)[mTimestamp] = prMt;
183 void OpenIGTLinkTool::calculateTpsSlot()
187 if (numberOfTransformsToCheck <= 1)
194 double lastTransform = rit->first;
195 for (
int i = 0; i < numberOfTransformsToCheck-1; ++i)
199 double firstTransform = rit->first;
200 double secondsPassed = (lastTransform - firstTransform) / 1000;
202 if (!
similar(secondsPassed, 0))
203 tpsNr = (
int) (numberOfTransformsToCheck / secondsPassed);
207 void OpenIGTLinkTool::toolVisibleSlot(
bool on)
210 mTpsTimer.start(1000);
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
bool similar(const DoubleBoundingBox3D &a, const DoubleBoundingBox3D &b, double tol)
boost::shared_ptr< Probe > ProbePtr
vtkSmartPointer< class vtkPolyData > vtkPolyDataPtr
static ProbeImplPtr New(QString instrumentUid, QString scannerUid, ProbeXmlConfigParserPtr xml=ProbeXmlConfigParserPtr())