Пример #1
0
void PatientModelImplService::insertData(DataPtr data)
{
	QString outputBasePath = this->patientData()->getActivePatientFolder();

	this->dataService()->loadData(data);
	data->save(outputBasePath);
}
Пример #2
0
DataPtr DataManagerImpl::loadData(QDomElement node, QString rootPath)
{
	QString uid = node.toElement().attribute("uid");
	QString name = node.toElement().attribute("name");
	QString type = node.toElement().attribute("type");

	QDir relativePath = this->findRelativePath(node, rootPath);
	QString absolutePath = this->findAbsolutePath(relativePath, rootPath);

	if (mData.count(uid)) // dont load same image twice
		return mData[uid];

	DataPtr data = mDataFactory->create(type, uid, name);
	if (!data)
	{
		reportWarning(QString("Unknown type: %1 for file %2").arg(type).arg(absolutePath));
		return DataPtr();
	}
	bool loaded = data->load(absolutePath);

	if (!loaded)
	{
		reportWarning("Unknown file: " + absolutePath);
		return DataPtr();
	}

	if (!name.isEmpty())
		data->setName(name);
	data->setFilename(relativePath.path());

	this->loadData(data);

	// conversion for change in format 2013-10-29
	QString newPath = rootPath+"/"+data->getFilename();
	if (QDir::cleanPath(absolutePath) != QDir::cleanPath(newPath))
	{
		reportWarning(QString("Detected old data format, converting from %1 to %2").arg(absolutePath).arg(newPath));
		data->save(rootPath);
	}

	return data;
}