]> Creatis software - clitk.git/commitdiff
Add Overlay properties to SaveState / ReadState
authorVivien Delmon <vivien.delmon@creatis.insa-lyon.fr>
Tue, 27 Dec 2011 14:49:12 +0000 (15:49 +0100)
committerVivien Delmon <vivien.delmon@creatis.insa-lyon.fr>
Tue, 27 Dec 2011 14:49:12 +0000 (15:49 +0100)
- Use vvSlicerManagers to Get/Set Overlay properties.

vv/vvReadState.cxx
vv/vvSaveState.cxx
vv/vvSaveState.h

index 62d8b5911ca12b504d6fcd268786657d8d55363f..dafcf3f4865f7f038d17f47820161a93d322bae4 100644 (file)
@@ -141,6 +141,9 @@ std::string vvReadState::ReadFusion(int index)
 std::string vvReadState::ReadOverlay(int index)
 {
   std::string file, value;
+  int vali;
+  double vald;
+  vvSlicerManager* slicerManager = m_Window->GetSlicerManagers()[index];
   while (!m_XmlReader->isEndElement() || value != "Overlay") {
     m_XmlReader->readNext();
     value = m_XmlReader->qualifiedName().toString().toStdString();
@@ -150,8 +153,29 @@ std::string vvReadState::ReadOverlay(int index)
         if (!m_XmlReader->hasError())
           m_Window->AddOverlayImage(index, file.c_str());
       }
+      if (value == "OverlayColorWindow") {
+        vald = m_XmlReader->readElementText().toDouble();
+        if (!m_XmlReader->hasError())
+          slicerManager->SetOverlayColorWindow(vald);
+      }
+      if (value == "OverlayColorLevel") {
+        vald = m_XmlReader->readElementText().toDouble();
+        if (!m_XmlReader->hasError())
+          slicerManager->SetOverlayColorLevel(vald);
+      }
+      if (value == "LinkOverlayWindowLevel") {
+        vali = m_XmlReader->readElementText().toInt();
+        if (!m_XmlReader->hasError())
+          slicerManager->SetLinkOverlayWindowLevel(vali);
+      }
+      if (value == "OverlayColor") {
+        vali = m_XmlReader->readElementText().toInt();
+        if (!m_XmlReader->hasError())
+          slicerManager->SetOverlayColor(vali);
+      }
     }
   }
+  m_Window->ImageInfoChanged();
   return value;
 }
 
index e7b6193df155720990debc2b51b61f966ffa75ac..c1a7e496aa4dacc769832bef41f8e3139d5b050d 100644 (file)
@@ -80,7 +80,7 @@ void vvSaveState::SaveImage(const QTreeWidgetItem* item, int index)
     if (role == "fusion")
       SaveFusion(item_child, slicerManager);
     else if (role == "overlay")
-      SaveOverlay(item_child);
+      SaveOverlay(item_child, slicerManager);
     else if (role == "vector")
       SaveVector(item_child);
   }
@@ -101,11 +101,15 @@ void vvSaveState::SaveFusion(const QTreeWidgetItem* item, const vvSlicerManager*
   m_XmlWriter->writeEndElement();
 }
 
-void vvSaveState::SaveOverlay(QTreeWidgetItem* item)
+void vvSaveState::SaveOverlay(const QTreeWidgetItem* item, const vvSlicerManager* vvManager)
 {
   m_XmlWriter->writeStartElement("Overlay");
   std::string filename = item->data(0, Qt::UserRole).toString().toStdString();
   m_XmlWriter->writeTextElement("FileName", QDir::current().absoluteFilePath(filename.c_str()));
+  m_XmlWriter->writeTextElement("OverlayColorWindow", QString::number(vvManager->GetOverlayColorWindow()));
+  m_XmlWriter->writeTextElement("OverlayColorLevel", QString::number(vvManager->GetOverlayColorLevel()));
+  m_XmlWriter->writeTextElement("LinkOverlayWindowLevel", QString::number(vvManager->GetLinkOverlayWindowLevel()));
+  m_XmlWriter->writeTextElement("OverlayColor", QString::number(vvManager->GetOverlayColor()));
   m_XmlWriter->writeEndElement();
 }
 
index 9d236edff3a85820592588b5b7ab8bb3c911c205..299158029fe01ac783485b65f713c96e1e05130f 100644 (file)
@@ -25,7 +25,7 @@ protected:
   void SaveTree();
   void SaveImage(const QTreeWidgetItem* item, int index);
   void SaveFusion(const QTreeWidgetItem* item, const vvSlicerManager* slicerManager);
-  void SaveOverlay(const QTreeWidgetItem* item);
+  void SaveOverlay(const QTreeWidgetItem* item, const vvSlicerManager* slicerManager);
   void SaveVector(const QTreeWidgetItem* item);
 
   std::auto_ptr<QXmlStreamWriter> m_XmlWriter;