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());
}