summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWim van Aarle <wimvanaarle@gmail.com>2015-02-25 16:46:09 +0100
committerWim van Aarle <wimvanaarle@gmail.com>2015-02-25 16:46:09 +0100
commit065d9c6a18f2b8eececc608ce850a9a308ca6356 (patch)
tree38ced94765ba77e2b710cd66fb4826f55f52250c /src
parent9adc99793653c92d369bb2710b51c3c1a554b362 (diff)
downloadastra-065d9c6a18f2b8eececc608ce850a9a308ca6356.tar.gz
astra-065d9c6a18f2b8eececc608ce850a9a308ca6356.tar.bz2
astra-065d9c6a18f2b8eececc608ce850a9a308ca6356.tar.xz
astra-065d9c6a18f2b8eececc608ce850a9a308ca6356.zip
get_geometry now uses XML config object (for volumes)
Diffstat (limited to 'src')
-rw-r--r--src/Config.cpp12
-rw-r--r--src/VolumeGeometry2D.cpp20
-rw-r--r--src/VolumeGeometry3D.cpp23
-rw-r--r--src/XMLDocument.cpp8
4 files changed, 62 insertions, 1 deletions
diff --git a/src/Config.cpp b/src/Config.cpp
index 3a3cb53..653935e 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -54,12 +54,24 @@ Config::Config(XMLNode* _self)
self = _self;
}
+//-----------------------------------------------------------------------------
Config::~Config()
{
delete self;
self = 0;
}
+//-----------------------------------------------------------------------------
+void Config::initialize(std::string rootname)
+{
+ if (self == 0) {
+ XMLDocument* doc = XMLDocument::createDocument(rootname);
+ self = doc->getRootNode();
+ }
+}
+
+
+//-----------------------------------------------------------------------------
template <class T>
ConfigStackCheck<T>::ConfigStackCheck(const char *_name, T* _obj, const Config& _cfg)
: object(_obj), cfg(&_cfg), name(_name)
diff --git a/src/VolumeGeometry2D.cpp b/src/VolumeGeometry2D.cpp
index 19aa905..d412914 100644
--- a/src/VolumeGeometry2D.cpp
+++ b/src/VolumeGeometry2D.cpp
@@ -152,7 +152,7 @@ CVolumeGeometry2D* CVolumeGeometry2D::clone()
}
//----------------------------------------------------------------------------------------
-// Initialization witha COnfig object
+// Initialization witha Config object
bool CVolumeGeometry2D::initialize(const Config& _cfg)
{
ASTRA_ASSERT(_cfg.self);
@@ -277,6 +277,24 @@ bool CVolumeGeometry2D::isEqual(CVolumeGeometry2D* _pGeom2) const
return true;
}
+
+//----------------------------------------------------------------------------------------
+// Get the configuration object
+Config* CVolumeGeometry2D::getConfiguration() const
+{
+ Config* cfg = new Config();
+ cfg->initialize("VolumeGeometry2D");
+
+ cfg->self->addChildNode("GridColCount", m_iGridColCount);
+ cfg->self->addChildNode("GridRowCount", m_iGridRowCount);
+
+ cfg->self->addOption("WindowMinX", m_fWindowMinX);
+ cfg->self->addOption("WindowMaxX", m_fWindowMaxX);
+ cfg->self->addOption("WindowMinY", m_fWindowMinY);
+ cfg->self->addOption("WindowMaxY", m_fWindowMaxY);
+
+ return cfg;
+}
//----------------------------------------------------------------------------------------
} // namespace astra
diff --git a/src/VolumeGeometry3D.cpp b/src/VolumeGeometry3D.cpp
index d7a93a9..66e6f0c 100644
--- a/src/VolumeGeometry3D.cpp
+++ b/src/VolumeGeometry3D.cpp
@@ -380,5 +380,28 @@ CVolumeGeometry2D * CVolumeGeometry3D::createVolumeGeometry2D() const
}
//----------------------------------------------------------------------------------------
+// Get the configuration object
+Config* CVolumeGeometry3D::getConfiguration() const
+{
+ Config* cfg = new Config();
+ cfg->initialize("VolumeGeometry3D");
+
+ cfg->self->addChildNode("GridColCount", m_iGridColCount);
+ cfg->self->addChildNode("GridRowCount", m_iGridRowCount);
+ cfg->self->addChildNode("GridSliceCount", m_iGridSliceCount);
+
+ cfg->self->addOption("WindowMinX", m_fWindowMinX);
+ cfg->self->addOption("WindowMaxX", m_fWindowMaxX);
+ cfg->self->addOption("WindowMinY", m_fWindowMinY);
+ cfg->self->addOption("WindowMaxY", m_fWindowMaxY);
+ cfg->self->addOption("WindowMinZ", m_fWindowMinZ);
+ cfg->self->addOption("WindowMaxZ", m_fWindowMaxZ);
+
+ return cfg;
+}
+//----------------------------------------------------------------------------------------
+
+
+//----------------------------------------------------------------------------------------
} // namespace astra
diff --git a/src/XMLDocument.cpp b/src/XMLDocument.cpp
index b39875b..406564f 100644
--- a/src/XMLDocument.cpp
+++ b/src/XMLDocument.cpp
@@ -109,4 +109,12 @@ void XMLDocument::saveToFile(string sFilename)
}
//-----------------------------------------------------------------------------
+std::string XMLDocument::toString()
+{
+ std::stringstream ss;
+ ss << *fDOMDocument->first_node();
+ return ss.str();
+}
+
+//-----------------------------------------------------------------------------