예제 #1
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());
}
ProbeDefinitionPtr IGTLinkConversionSonixCXLegacy::decode(ProbeDefinitionPtr msg)
{
	QString newUid = msg->getUid();
	QString format = this->extractColorFormat(msg->getUid(), &newUid);
	msg->setUid(newUid);

	return msg;
}
예제 #3
0
//'copied' from OpenIGTLinkRTSource::updateSonixStatus()
ProbeDefinitionPtr IGTLinkConversion::decode(IGTLinkUSStatusMessage::Pointer probeMessage, igtl::ImageMessage::Pointer imageMessage, ProbeDefinitionPtr base)
{
	ProbeDefinitionPtr retval;
	if (base)
		 retval = base;
	else
		retval = ProbeDefinitionPtr(new ProbeDefinition());

	if (probeMessage)
	{
		// Update the parts of the probe data that is read from the probe message.
		retval->setType(ProbeDefinition::TYPE(probeMessage->GetProbeType()));
		retval->setSector(
				probeMessage->GetDepthStart(),
				probeMessage->GetDepthEnd(),
				probeMessage->GetWidth(),
				0);
		retval->setOrigin_p(Vector3D(probeMessage->GetOrigin()));
		retval->setUid(probeMessage->GetDeviceName());
	}

	if (imageMessage)
	{
		// Update the parts of the probe data that must be read from the image.

		// Retrive the image data
		float spacing[3]; // spacing (mm/pixel)
		int size[3]; // image dimension
		imageMessage->GetDimensions(size);
		imageMessage->GetSpacing(spacing);

		retval->setSpacing(Vector3D(spacing[0], spacing[1], spacing[2]));
		retval->setSize(QSize(size[0], size[1]));
		retval->setClipRect_p(DoubleBoundingBox3D(0, retval->getSize().width(), 0, retval->getSize().height(), 0, 0));
	}

	return retval;
//	return this->decode(retval);
}
예제 #4
0
IGTLinkUSStatusMessage::Pointer IGTLinkConversion::encode(ProbeDefinitionPtr input)
{
	IGTLinkUSStatusMessage::Pointer retval = IGTLinkUSStatusMessage::New();

	retval->SetOrigin(input->getOrigin_p().data());
	// 1 = sector, 2 = linear
	retval->SetProbeType(input->getType());

	retval->SetDepthStart(input->getDepthStart());// Start of sector in mm from origin
	retval->SetDepthEnd(input->getDepthEnd());	// End of sector in mm from origin
	retval->SetWidth(input->getWidth());// Width of sector in mm for LINEAR, Width of sector in radians for SECTOR.
	retval->SetDeviceName(cstring_cast(input->getUid()));

	return retval;
}