コード例 #1
0
ファイル: cxProbeImpl.cpp プロジェクト: normit-nav/CustusX
ProbeDefinition ProbeImpl::createProbeSector()
{
	ProbeXmlConfigParser::Configuration config = this->getConfiguration();
	ProbeDefinition probeSector = createProbeDataFromConfiguration(config);
	probeSector.setUid(mActiveUid);
	return probeSector;
}
コード例 #2
0
ファイル: cxProbeImpl.cpp プロジェクト: normit-nav/CustusX
void ProbeImpl::setProbeSector(ProbeDefinition probeSector)
{
	if (probeSector.getUid().isEmpty())
		probeSector.setUid(mActiveUid);

	mProbeData[probeSector.getUid()] = probeSector;
	emit sectorChanged();
}
コード例 #3
0
/** extract information from the IGTLinkUSStatusMessage
 *  and store locally. Also reset the old local info with
 *  information from the probe in toolmanager.
 */
void VideoConnection::updateStatus(ProbeDefinitionPtr msg)
{
	ToolPtr tool = mBackend->tracking()->getFirstProbe();
	if (!tool || !tool->getProbe())
	{
		//Don't throw away the ProbeDefinition. Save it until it can be used
		if (mUnusedProbeDefinitionVector.empty())
			connect(mBackend->tracking().get(), &TrackingService::stateChanged, this, &VideoConnection::useUnusedProbeDefinitionSlot);
		mUnusedProbeDefinitionVector.push_back(msg);
		return;
	}
	ProbePtr probe = tool->getProbe();

	// start with getting a valid data object from the probe, in order to keep
	// existing values (such as temporal calibration).
	// Note that the 'active' data is get while the 'uid' data is set.
	ProbeDefinition data = probe->getProbeDefinition();

	data.setUid(msg->getUid());
	data.setType(msg->getType());
	data.setSector(msg->getDepthStart(), msg->getDepthEnd(), msg->getWidth());
	data.setOrigin_p(msg->getOrigin_p());
	data.setSize(msg->getSize());
	data.setSpacing(msg->getSpacing());
	data.setClipRect_p(msg->getClipRect_p());
	data.setUseDigitalVideo(true);

	probe->setProbeDefinition(data);
	probe->setActiveStream(msg->getUid());
}
コード例 #4
0
ファイル: cxProbeImpl.cpp プロジェクト: normit-nav/CustusX
ProbeImpl::ProbeImpl(QString instrumentUid, QString scannerUid) :
		mInstrumentUid(instrumentUid),
		mScannerUid(scannerUid),
		mSoundSpeedCompensationFactor(1.0),
		mOverrideTemporalCalibration(false),
		mTemporalCalibration(0.0)
{
	ProbeDefinition probeData;
	mProbeData[probeData.getUid()] = probeData;
	mActiveUid = probeData.getUid();
}
コード例 #5
0
void VideoConnection::resetProbe()
{
	ToolPtr tool = mBackend->tracking()->getFirstProbe();
	if (!tool || !tool->getProbe())
		return;
	ProbePtr probe = tool->getProbe();
	if (probe)
	{
		ProbeDefinition data = probe->getProbeDefinition();
		data.setUseDigitalVideo(false);
		probe->setProbeDefinition(data);
	}
}
コード例 #6
0
/**
 * Write probe configuration to file. This works even for configs not saved to the ProbeCalibConfigs.xml file.
 */
void UsReconstructionFileMaker::writeProbeConfiguration(QString reconstructionFolder, QString session, ProbeDefinition data, QString uid)
{
	XmlOptionFile file = XmlOptionFile(reconstructionFolder + "/" + session + ".probedata.xml");
	data.addXml(file.getElement("configuration"));
	file.getElement("tool").toElement().setAttribute("toolID", uid);
	file.save();
}
コード例 #7
0
Transform3D TrackedStream::get_tMu()
{
	//Made tMu by copying and modifying code from ProbeSector::get_tMu()
	ProbeDefinition probeDefinition = mProbeTool->getProbe()->getProbeData();
	Vector3D origin_p = probeDefinition.getOrigin_p();
	Vector3D spacing = probeDefinition.getSpacing();
	Vector3D origin_u(origin_p[0]*spacing[0], origin_p[1]*spacing[1], origin_p[2]*spacing[2]);

	Transform3D Rx = createTransformRotateX(M_PI / 2.0);
	Transform3D Ry = createTransformRotateY(-M_PI / 2.0);
	Transform3D R = (Rx * Ry);
	Transform3D T = createTransformTranslate(-origin_u);

	Transform3D tMu = R * T;
	return tMu;
}
コード例 #8
0
ファイル: cxProbeImpl.cpp プロジェクト: normit-nav/CustusX
ProbeDefinition ProbeImpl::getProbeData(QString uid) const
{
	ProbeDefinition retval;

	if (uid=="active")
		uid = mActiveUid;
	if (mProbeData.count(uid))
		retval = mProbeData.find(uid)->second;
	else if (mProbeData.count("default"))
		retval = mProbeData.find("default")->second;
	else
		retval = mProbeData.begin()->second;

	// ensure uid is matching the requested uid even if not found.
	retval.setUid(uid);
	return retval;
}
コード例 #9
0
ProbeDefinition createProbeDefinitionFromConfiguration(ProbeXmlConfigParser::Configuration config)
{
  if(config.isEmpty())
    return ProbeDefinition();

    ProbeDefinition probeDefinition;

  if (config.mWidthDeg > 0.1) // Sector probe
  {
	double depthStart = config.mOffset * config.mPixelHeight;
	double depthEnd = config.mDepth * config.mPixelHeight + depthStart;

	double width = config.mWidthDeg * M_PI / 180.0;//width in radians
	probeDefinition = ProbeDefinition(ProbeDefinition::tSECTOR);
	probeDefinition.setSector(depthStart, depthEnd, width);
  }
  else //Linear probe
  {
    int widtInPixels = config.mRightEdge - config.mLeftEdge;
    double width = config.mPixelWidth * double(widtInPixels); //width in mm
    // correct for top/bottom edges if applicable
    double depthStart = double(config.mTopEdge-config.mOriginRow) * config.mPixelHeight;
    double depthEnd = double(config.mBottomEdge-config.mOriginRow) * config.mPixelHeight;

	probeDefinition = ProbeDefinition(ProbeDefinition::tLINEAR);
	probeDefinition.setSector(depthStart, depthEnd, width);
  }

	probeDefinition.setSpacing(Vector3D(config.mPixelWidth, config.mPixelHeight, 1));
	probeDefinition.setSize(QSize(config.mImageWidth, config.mImageHeight));
	probeDefinition.setOrigin_p(Vector3D(config.mOriginCol, config.mOriginRow, 0));
	probeDefinition.setClipRect_p(DoubleBoundingBox3D(config.mLeftEdge,config.mRightEdge,config.mTopEdge,config.mBottomEdge,0,0));
	probeDefinition.setTemporalCalibration(config.mTemporalCalibration);

	return probeDefinition;
}
コード例 #10
0
ProbeXmlConfigParser::Configuration createConfigurationFromProbeDefinition(ProbeXmlConfigParser::Configuration basis, ProbeDefinition data)
{
	ProbeXmlConfigParser::Configuration config = basis;

	QSize storedSize(basis.mImageWidth, basis.mImageHeight);
	if (storedSize!=data.getSize())
	{
		// wrong size: resample
		data.resample(storedSize);
	}

	config.mLeftEdge =  data.getClipRect_p()[0];
	config.mRightEdge =  data.getClipRect_p()[1];
	config.mTopEdge =  data.getClipRect_p()[2];
	config.mBottomEdge =  data.getClipRect_p()[3];

	config.mOriginCol = data.getOrigin_p()[0];
	config.mOriginRow = data.getOrigin_p()[1];

	config.mPixelWidth = data.getSpacing()[0];
	config.mPixelHeight = data.getSpacing()[1];

	config.mImageWidth = data.getSize().width();
	config.mImageHeight = data.getSize().height();

	if (data.getType()==ProbeDefinition::tSECTOR)
	{
		config.mWidthDeg = data.getWidth() / M_PI*180.0;
		config.mOffset = data.getDepthStart() / data.getSpacing()[1];
		config.mDepth = (data.getDepthEnd() - data.getDepthStart()) / data.getSpacing()[1];
	}
	else
	{
		// derived values
		config.mWidthDeg = 0.0;
		config.mOffset = 0;
		config.mDepth = 0;
	}

	config.mTemporalCalibration = data.getTemporalCalibration();

	return config;
}