16 #include <vtkColorTransferFunction.h>
17 #include <QStringList>
18 #include <QDomElement>
19 #include <QDomDocument>
47 file = file.
descend(
"Preset",
"name", name);
49 QDomNode tf2DNode = file.
getElement(
"lookuptable2D");
50 while (tf2DNode.hasChildNodes())
51 tf2DNode.removeChild(tf2DNode.firstChild());
56 if ((0 <= image->getMin()) && (
imCT == image->getModality()))
58 LUT2D->unsignedCT(
false);
61 LUT2D->addXml(file.
getElement(
"lookuptable2D"));
64 if ((0 <= image->getMin()) && (
imCT == image->getModality()))
66 LUT2D->unsignedCT(
true);
79 file = file.
descend(
"Preset",
"name", name);
81 QDomNode tf3DNode = file.
getElement(
"transferfunctions");
82 while (tf3DNode.hasChildNodes())
83 tf3DNode.removeChild(tf3DNode.firstChild());
85 ImageTF3DPtr transferFunctions = image->getTransferFunctions3D();
88 if ((0 <= image->getMin()) && (
imCT == image->getModality()))
90 transferFunctions->unsignedCT(
false);
93 transferFunctions->addXml(file.
getElement(
"transferfunctions"));
94 image->getShading().addXml(file.
getElement(
"shading"));
97 if ((0 <= image->getMin()) && (
imCT == image->getModality()))
99 transferFunctions->unsignedCT(
true);
109 this->
load2D(name, image);
111 this->
load3D(name, image);
120 image->resetTransferFunctions(
true,
false);
125 LUT2D->parseXml(node.
getElement().namedItem(
"lookuptable2D"));
128 if ((0 <= image->getMin()) && (
imCT == image->getModality()) && (name !=
"Transfer function preset...") )
130 LUT2D->unsignedCT(
true);
137 image->resetTransferFunctions(
false,
true);
139 ImageTF3DPtr transferFunctions = image->getTransferFunctions3D();
142 transferFunctions->parseXml(node.
getElement().namedItem(
"transferfunctions"));
146 image->setShading(shading);
149 if ((0 <= image->getMin()) && (
imCT == image->getModality()) && (name !=
"Transfer function preset...") )
151 transferFunctions->unsignedCT(
true);
157 QStringList presetList;
160 for (
int i = 0; i < presetNodeList.count(); ++i)
162 QString presetName = presetNodeList.item(i).toElement().attribute(
"name");
163 if (presetName ==
"Default")
167 QString sourceModality = presetNodeList.item(i).toElement().attribute(
"modality");
168 if ( (modality == string2enum<IMAGE_MODALITY>(sourceModality)) || (
imUNKNOWN == modality) || imCOUNT == modality )
169 presetList << presetName;
174 presetNodeList = customFile.
getElement().elementsByTagName(
"Preset");
175 for (
int i = 0; i < presetNodeList.count(); ++i)
177 QString presetName = presetNodeList.item(i).toElement().attribute(
"name");
178 QString presetModality = presetNodeList.item(i).toElement().attribute(
"modality");
179 if ( (string2enum<IMAGE_MODALITY>(presetModality) == modality) || (
imUNKNOWN == modality) || imCOUNT == modality )
180 presetList << presetName;
189 std::cout <<
"TODO rewrite TransferFunctions3DPresets::deletePresetData(QString name, bool _2D, bool _3D)" << std::endl;