Example #1
0
void VideoImplService::setActiveVideoSource(QString uid)
{
    mActiveVideoSource = mEmptyVideoSource;

    std::vector<VideoSourcePtr> sources = this->getVideoSources();
    for (unsigned i=0; i<sources.size(); ++i)
        if (sources[i]->getUid()==uid)
            mActiveVideoSource = sources[i];

    // set active stream in all probes if stream is present:
    TrackingService::ToolMap tools = mBackend->tracking()->getTools();
    for (TrackingService::ToolMap::iterator iter=tools.begin(); iter!=tools.end(); ++iter)
    {
        ProbePtr probe = iter->second->getProbe();
        if (!probe)
            continue;
        if (!probe->getAvailableVideoSources().count(uid)){
            report("No active streams");
            continue;
        }
        probe->setActiveStream(uid);
    }

    emit activeVideoSourceChanged();
}
/** 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());
}
Example #3
0
void PatientModelImplService::disconnectProbes()
{
	for (std::map<QString, ToolPtr>::const_iterator iter = mProbeTools.begin(); iter != mProbeTools.end(); ++iter)
	{
		ProbePtr probe = iter->second->getProbe();
		if(probe)
			disconnect(probe.get(), &Probe::videoSourceAdded, this, &PatientModelImplService::videoSourceAdded);
		else
			CX_LOG_WARNING() << "PatientModelImplService::disconnectProbes: Tool is not a probe: " << iter->second->getUid();
	}
}
Example #4
0
ToolPtr PatientModelImplService::getProbeTool(QString videoSourceUid)
{
	for (std::map<QString, ToolPtr>::const_iterator iter = mProbeTools.begin(); iter != mProbeTools.end(); ++iter)
	{
		ToolPtr tool = iter->second;
		ProbePtr probe = tool->getProbe();
		if(probe && probe->getAvailableVideoSources().contains(videoSourceUid))
			return tool;
	}
	reportWarning("Found no probe for stream" + videoSourceUid);
	return ToolPtr();
}
/** Imbue probe with all stream and probe info from grabber.
 *
 * Call when active probe is changed or when streaming config is changed (new streams, new probeDefinition)
 *
 * Find the active probe, then insert all current streams into that probe.
 *
 */
void VideoConnection::connectVideoToProbe()
{
	ToolPtr tool = mBackend->tracking()->getFirstProbe();
	if (!tool)
		return;

	ProbePtr probe = tool->getProbe();
	if (!probe)
		return;

	for (unsigned i=0; i<mSources.size(); ++i)
		probe->setRTSource(mSources[i]);
}
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);
	}
}
Example #7
0
void PatientModelImplService::connectProbes()
{
	ToolMap tools = mTrackingService->getTools();
	for (ToolMap::const_iterator iter = tools.begin(); iter != tools.end(); ++iter)
	{
		ToolPtr tool = iter->second;
		ProbePtr probe = tool->getProbe();
		if(tool->getProbe())
		{
			mProbeTools[iter->first] = tool;
			connect(probe.get(), &Probe::videoSourceAdded, this, &PatientModelImplService::videoSourceAdded);
		}
	}
}
Example #8
0
std::vector<VideoSourcePtr> USAcquisition::getRecordingVideoSources(ToolPtr tool)
{
	std::vector<VideoSourcePtr> retval;

	if (tool && tool->getProbe())
	{
		ProbePtr probe = tool->getProbe();
		QStringList sources = probe->getAvailableVideoSources();
		for (unsigned i=0; i<sources.size(); ++i)
			retval.push_back(probe->getRTSource(sources[i]));
	}
	else
	{
		retval = this->getServices()->video()->getVideoSources();
	}

	return retval;
}
void VideoConnection::removeSourceFromProbe(ToolPtr tool)
{
	ProbePtr probe = tool->getProbe();
	for (unsigned i=0; i<mSources.size(); ++i)
		probe->removeRTSource(mSources[i]);
}