예제 #1
0
QString PatientModelService::generateFilePath(QString folderName, QString ending)
{
	QString folder = this->getActivePatientFolder() + "/" +folderName + "/";
	QDir().mkpath(folder);
	QString format = timestampSecondsFormat();
	QString filename = QDateTime::currentDateTime().toString(format) + "." + ending;

	return folder+filename;
}
예제 #2
0
void ElastixManager::preprocessExecuter()
{
	QStringList parameterFiles = mParameters->getActiveParameterFiles();
	QString timestamp = QDateTime::currentDateTime().toString(timestampSecondsFormat());
	QDir outDir(mServices->patient()->getActivePatientFolder()+"/"+mParameters->getConfigUid()+"/"+timestamp);

	mExecuter->setDisplayProcessMessages(mDisplayProcessMessages->getValue());
	mExecuter->setInput(mParameters->getActiveExecutable()->getEmbeddedPath().getAbsoluteFilepath(),
					 mServices->registration()->getFixedData(),
					 mServices->registration()->getMovingData(),
	         outDir.absolutePath(),
	         parameterFiles);

	if (mDisableRendering->getValue())
	{
		mServices->view()->enableRender(false);
	}
}
/**Parse the command line and load a patient if the switch --patient is found
 */
void SessionStorageServiceImpl::startupLoadPatient()
{
	QString folder = this->getCommandLineStartupPatient();

	if (!folder.isEmpty())
	{
		report(QString("Startup Load [%1] from command line").arg(folder));
	}

	if (folder.isEmpty() && settings()->value("Automation/autoLoadRecentPatient").toBool())
	{
		folder = settings()->value("startup/lastPatient").toString();
        if(this->isValidSessionFolder(folder))
        {
            QDateTime lastSaveTime = QDateTime::fromString(settings()->value("startup/lastPatientSaveTime").toString(), timestampSecondsFormat());
            double minsSinceLastSave = lastSaveTime.secsTo(QDateTime::currentDateTime())/60;
            double autoLoadRecentPatientWithinHours = settings()->value("Automation/autoLoadRecentPatientWithinHours").toDouble();
            int allowedMinsSinceLastSave = autoLoadRecentPatientWithinHours*60;
            if (minsSinceLastSave > allowedMinsSinceLastSave) // if less than 8 hours, accept
            {
                report(
                    QString("Startup Load: Ignored recent patient because %1 hours since last save, limit is %2")
                    .arg(int(minsSinceLastSave/60))
                    .arg(int(allowedMinsSinceLastSave/60)));
                folder = "";
            }
            if (!folder.isEmpty())
                report(QString("Startup Load [%1] as recent patient").arg(folder));
        }
        else
        {
            report("Startup Load: Ignored recent patient because it is not valid anymore");
            folder = "";
        }

	}

	if (folder.isEmpty())
		return;

	this->load(folder);
}
/** Writes settings info describing the patient name and current time.
  * Used for auto load.
  */
void SessionStorageServiceImpl::writeRecentPatientData()
{
	settings()->setValue("startup/lastPatient", mActivePatientFolder);
	settings()->setValue("startup/lastPatientSaveTime", QDateTime::currentDateTime().toString(timestampSecondsFormat()));
}
예제 #5
0
void USSavingRecorder::startRecord(RecordSessionPtr session, ToolPtr tool, ToolPtr reference, std::vector<VideoSourcePtr> video)
{
	this->clearRecording(); // clear previous data if any

	mRecordingTool = tool;
	mReference = reference;
	mSession = session;

	QString tempBaseFolder = DataLocations::getCachePath()+"/usacq/"+QDateTime::currentDateTime().toString(timestampSecondsFormat());
	QString cacheFolder = UsReconstructionFileMaker::createUniqueFolder(tempBaseFolder, session->getDescription());

	for (unsigned i=0; i<video.size(); ++i)
	{
		SavingVideoRecorderPtr videoRecorder;
		videoRecorder.reset(new SavingVideoRecorder(
								 video[i],
								 cacheFolder,
								 QString("%1_%2").arg(session->getDescription()).arg(video[i]->getUid()),
								 false, // no compression when saving to cache
								 mDoWriteColor));
		videoRecorder->startRecord();
		mVideoRecorder.push_back(videoRecorder);
	}

	reportSuccess("Ultrasound acquisition started.");
}