- Add constness on QTreeWidgetItem.
- Use vvSlicerManagers to Get/Set Fusion properties.
#include "vvReadState.h"
#include "vvMainWindow.h"
+#include "vvSlicerManager.h"
#include <qtreewidget.h>
}
}
else if (current_index >= 0) {
- if (value == "Fusion")
+ if (value == "Fusion")
value = ReadFusion(current_index);
else if (value == "Overlay")
value = ReadOverlay(current_index);
std::string vvReadState::ReadFusion(int index)
{
std::string file, value;
+ int vali;
+ double vald;
+ vvSlicerManager* slicerManager = m_Window->GetSlicerManagers()[index];
while (!m_XmlReader->isEndElement() || value != "Fusion") {
m_XmlReader->readNext();
value = m_XmlReader->qualifiedName().toString().toStdString();
if (!m_XmlReader->hasError())
m_Window->AddFusionImage(index, file.c_str());
}
+ if (value == "FusionOpacity") {
+ vali = m_XmlReader->readElementText().toInt();
+ if (!m_XmlReader->hasError())
+ slicerManager->SetFusionOpacity(vali);
+ }
+ if (value == "FusionThresholdOpacity") {
+ vali = m_XmlReader->readElementText().toInt();
+ if (!m_XmlReader->hasError())
+ slicerManager->SetFusionThresholdOpacity(vali);
+ }
+ if (value == "FusionColorMap") {
+ vali = m_XmlReader->readElementText().toInt();
+ if (!m_XmlReader->hasError())
+ slicerManager->SetFusionColorMap(vali);
+ }
+ if (value == "FusionWindow") {
+ vald = m_XmlReader->readElementText().toDouble();
+ if (!m_XmlReader->hasError())
+ slicerManager->SetFusionWindow(vald);
+ }
+ if (value == "FusionLevel") {
+ vald = m_XmlReader->readElementText().toDouble();
+ if (!m_XmlReader->hasError())
+ slicerManager->SetFusionLevel(vald);
+ }
}
}
+ m_Window->ImageInfoChanged();
return value;
}
m_XmlWriter->writeEndElement();
}
-void vvSaveState::SaveImage(QTreeWidgetItem* item, int index)
+void vvSaveState::SaveImage(const QTreeWidgetItem* item, int index)
{
+ const vvSlicerManager * slicerManager = m_Window->GetSlicerManagers()[index];
m_XmlWriter->writeStartElement("Image");
-
+
std::ostringstream indexStr;
indexStr.str("");
indexStr << index;
std::string filename = item->data(0, Qt::UserRole).toString().toStdString();
m_XmlWriter->writeTextElement("FileName", QDir::current().absoluteFilePath(filename.c_str()));
-
+
QTreeWidgetItem* item_child;
std::string role;
for (int i = 0; i < item->childCount(); i++) {
item_child = item->child(i);
role = item_child->data(1,Qt::UserRole).toString().toStdString();
if (role == "fusion")
- SaveFusion(item_child);
+ SaveFusion(item_child, slicerManager);
else if (role == "overlay")
SaveOverlay(item_child);
else if (role == "vector")
SaveVector(item_child);
}
-
+
m_XmlWriter->writeEndElement();
}
-void vvSaveState::SaveFusion(QTreeWidgetItem* item)
+void vvSaveState::SaveFusion(const QTreeWidgetItem* item, const vvSlicerManager* vvManager)
{
m_XmlWriter->writeStartElement("Fusion");
std::string filename = item->data(0, Qt::UserRole).toString().toStdString();
m_XmlWriter->writeTextElement("FileName", QDir::current().absoluteFilePath(filename.c_str()));
+ m_XmlWriter->writeTextElement("FusionOpacity", QString::number(vvManager->GetFusionOpacity()));
+ m_XmlWriter->writeTextElement("FusionThresholdOpacity", QString::number(vvManager->GetFusionThresholdOpacity()));
+ m_XmlWriter->writeTextElement("FusionColorMap", QString::number(vvManager->GetFusionColorMap()));
+ m_XmlWriter->writeTextElement("FusionWindow", QString::number(vvManager->GetFusionWindow()));
+ m_XmlWriter->writeTextElement("FusionLevel", QString::number(vvManager->GetFusionLevel()));
m_XmlWriter->writeEndElement();
}
m_XmlWriter->writeEndElement();
}
-void vvSaveState::SaveVector(QTreeWidgetItem* item)
+void vvSaveState::SaveVector(const QTreeWidgetItem* item)
{
m_XmlWriter->writeStartElement("Vector");
std::string filename = item->data(0, Qt::UserRole).toString().toStdString();
#include <string>
#include <memory>
+#include "vvSlicerManager.h"
class vvMainWindow;
class QXmlStreamWriter;
void SaveGlobals();
void SaveGUI();
void SaveTree();
- void SaveImage(QTreeWidgetItem* item, int index);
- void SaveFusion(QTreeWidgetItem* item);
- void SaveOverlay(QTreeWidgetItem* item);
- void SaveVector(QTreeWidgetItem* item);
+ void SaveImage(const QTreeWidgetItem* item, int index);
+ void SaveFusion(const QTreeWidgetItem* item, const vvSlicerManager* slicerManager);
+ void SaveOverlay(const QTreeWidgetItem* item);
+ void SaveVector(const QTreeWidgetItem* item);
std::auto_ptr<QXmlStreamWriter> m_XmlWriter;
std::auto_ptr<QFile> m_File;