Mercurial > hg > orthanc-wsi
changeset 64:63d0a5c74460
DicomPyramidInstance::Serialize
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Nov 2016 18:34:17 +0100 |
parents | 3252fbf149e3 |
children | cd84f27bc8e2 |
files | Framework/Inputs/DicomPyramidInstance.cpp Framework/Inputs/DicomPyramidInstance.h TODO |
diffstat | 3 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Inputs/DicomPyramidInstance.cpp Fri Nov 25 18:23:09 2016 +0100 +++ b/Framework/Inputs/DicomPyramidInstance.cpp Fri Nov 25 18:34:17 2016 +0100 @@ -29,6 +29,7 @@ #include "../DicomToolbox.h" #include <cassert> +#include <json/writer.h> namespace OrthancWSI { @@ -205,4 +206,29 @@ assert(frame < frames_.size()); return frames_[frame].second; } + + + void DicomPyramidInstance::Serialize(std::string& result) const + { + Json::Value frames = Json::arrayValue; + for (size_t i = 0; i < frames_.size(); i++) + { + Json::Value frame = Json::arrayValue; + frame.append(frames_[i].first); + frame.append(frames_[i].second); + + frames.append(frame); + } + + Json::Value value; + value["PixelFormat"] = Orthanc::EnumerationToString(format_); + value["TileHeight"] = tileHeight_; + value["TileWidth"] = tileWidth_; + value["TotalHeight"] = totalHeight_; + value["TotalWidth"] = totalWidth_; + value["Frames"] = frames; + + Json::FastWriter writer; + result = writer.write(value); + } }
--- a/Framework/Inputs/DicomPyramidInstance.h Fri Nov 25 18:23:09 2016 +0100 +++ b/Framework/Inputs/DicomPyramidInstance.h Fri Nov 25 18:34:17 2016 +0100 @@ -87,5 +87,7 @@ unsigned int GetFrameLocationX(size_t frame) const; unsigned int GetFrameLocationY(size_t frame) const; + + void Serialize(std::string& result) const; }; }