示例#1
0
void ProbeImpl::removeRTSource(VideoSourcePtr source)
{
	if (!source)
		return;
	if (!mSource.count(source->getUid()))
		return;

	mSource.erase(source->getUid());
	mProbeData.erase(source->getUid());
	this->applyConfig();//May need to re-create config, as the old ProbeDefinition may be deleted
}
示例#2
0
void USAcquisition::sendAcquisitionDataToReconstructer()
{
	mCore->set_rMpr(this->getServices()->patient()->get_rMpr());

	VideoSourcePtr activeVideoSource = this->getServices()->video()->getActiveVideoSource();
	if (activeVideoSource)
	{
		USReconstructInputData data = mCore->getDataForStream(activeVideoSource->getUid());
		this->getReconstructer()->selectData(data);
		emit acquisitionDataReady();
	}
}
示例#3
0
VideoSourcePtr VideoImplService::getGuessForActiveVideoSource(VideoSourcePtr old)
{

    if(old && old->getUid().contains("playback"))
        return old;

    QStringList nameFilters;
    nameFilters << "TissueAngio.fts" << "TissueFlow.fts" << "ScanConverted.fts";
    // ask for playback stream:
    foreach(USAcquisitionVideoPlaybackPtr uSAcquisitionVideoPlayback,mUSAcquisitionVideoPlaybacks)
    {
        if (uSAcquisitionVideoPlayback->isActive() && nameFilters.contains(uSAcquisitionVideoPlayback->getType()) )
            return uSAcquisitionVideoPlayback->getVideoSource();
     }

    // ask for playback stream:
    foreach(USAcquisitionVideoPlaybackPtr uSAcquisitionVideoPlayback,mUSAcquisitionVideoPlaybacks)
    {
        if (uSAcquisitionVideoPlayback->isActive())
            return uSAcquisitionVideoPlayback->getVideoSource();
    }

    // ask for active stream in first probe:
    ToolPtr tool = mBackend->tracking()->getFirstProbe();
    if (tool && tool->getProbe() && tool->getProbe()->getRTSource())
    {
        // keep existing if present
        if (old)
        {
            if (tool->getProbe()->getAvailableVideoSources().count(old->getUid()))
                    return old;
        }

        return tool->getProbe()->getRTSource();
    }

    std::vector<VideoSourcePtr> allSources = this->getVideoSources();
    // keep existing if present
    if (old)
    {
        if (std::count(allSources.begin(), allSources.end(), old))
                return old;
    }
    // ask for anything
    if (!allSources.empty())
        return allSources.front();

    // give up: return empty
    return mEmptyVideoSource;
}
示例#4
0
void DataManagerImpl::loadStream(VideoSourcePtr stream)
{
	if (!stream)
		return;
	mStreams[stream->getUid()] = stream;
	emit streamLoaded();
}
示例#5
0
void PatientModelImplService::videoSourceAdded(VideoSourcePtr source)
{
	ToolPtr tool = this->getProbeTool(source->getUid());
	if(!tool)
		return;

	QString uid = source->getUid() + tool->getUid();
	QString name = source->getName() + " - " + tool->getName();
	TrackedStreamPtr trackedStream = this->dataService()->getTrackedStream(uid);
	if (!trackedStream)
		trackedStream = this->createSpecificData<TrackedStream>(uid, name);
	trackedStream->setProbeTool(tool);
	trackedStream->setVideoSource(source);
	trackedStream->setSpaceProvider(mDataService->getSpaceProvider());

	//Only load trackedStream, don't save it
	this->dataService()->loadData(trackedStream);
	emit videoAddedToTrackedStream();
	this->reEmitActiveTrackedStream(trackedStream);
}
示例#6
0
void ProbeImpl::setRTSource(VideoSourcePtr source)
{
	CX_ASSERT(source); // not handled after refactoring - add clear method??
	if (!source)
		return;

	// uid already exist: check if base object is the same
	if (mSource.count(source->getUid()))
	{
		VideoSourcePtr old = mSource.find(source->getUid())->second;

		ProbeAdapterRTSourcePtr oldAdapter;
		oldAdapter = boost::dynamic_pointer_cast<ProbeAdapterRTSource>(old);
		// check for identity, ignore if no change
		if (oldAdapter && (source==oldAdapter->getBaseSource()))
			return;
	}

	// must have same uid as original: the uid identifies the video source
	mSource[source->getUid()].reset(new ProbeAdapterRTSource(source->getUid(), mSelf.lock(), source));
	emit sectorChanged();

	emit videoSourceAdded(mSource[source->getUid()]);
}
示例#7
0
void VideoImplService::autoSelectActiveVideoSource()
{
    VideoSourcePtr suggestion = this->getGuessForActiveVideoSource(mActiveVideoSource);
    this->setActiveVideoSource(suggestion->getUid());
}