void TransferFunctions3DPresets::save3D(QString name, ImagePtr image)
{
	//create the node to be saved
	XmlOptionFile file = this->getCustomFile();
	file = file.descend("Preset", "name", name);

	QDomNode tf3DNode = file.getElement("transferfunctions");
	while (tf3DNode.hasChildNodes())
		tf3DNode.removeChild(tf3DNode.firstChild());

	ImageTF3DPtr transferFunctions = image->getTransferFunctions3D();

	// For unsigned CT: Modify transfer function values temporarily prior to save
	if ((0 <= image->getMin()) && ("CT" == image->getModality()))
	{
		transferFunctions->unsignedCT(false);
	}

	transferFunctions->addXml(file.getElement("transferfunctions"));
	image->getShading().addXml(file.getElement("shading"));

	// Revert the transfer function values back again
	if ((0 <= image->getMin()) && ("CT" == image->getModality()))
	{
		transferFunctions->unsignedCT(true);
	}

	file.getElement().setAttribute("modality", image->getModality());
	file.save();
}
示例#2
0
/**
 * Write probe configuration to file. This works even for configs not saved to the ProbeCalibConfigs.xml file.
 */
void UsReconstructionFileMaker::writeProbeConfiguration(QString reconstructionFolder, QString session, ProbeDefinition data, QString uid)
{
	XmlOptionFile file = XmlOptionFile(reconstructionFolder + "/" + session + ".probedata.xml");
	data.addXml(file.getElement("configuration"));
	file.getElement("tool").toElement().setAttribute("toolID", uid);
	file.save();
}
void TransferFunctions3DPresets::save2D(QString name, ImagePtr image)
{
	XmlOptionFile file = this->getCustomFile();
	file = file.descend("Preset", "name", name);

	QDomNode tf2DNode = file.getElement("lookuptable2D");
	while (tf2DNode.hasChildNodes())
		tf2DNode.removeChild(tf2DNode.firstChild());

	ImageLUT2DPtr LUT2D = image->getLookupTable2D();

	// For unsigned CT: Modify transfer function values temporarily prior to save
	if ((0 <= image->getMin()) && ("CT" == image->getModality()))
	{
		LUT2D->unsignedCT(false);
	}

	LUT2D->addXml(file.getElement("lookuptable2D"));

	// Revert the transfer function values back again
	if ((0 <= image->getMin()) && ("CT" == image->getModality()))
	{
		LUT2D->unsignedCT(true);
	}

	file.getElement().setAttribute("modality", image->getModality());
	file.save();

//	emit changed();
}