Mercurial > hg > orthanc-stone
changeset 118:a4d0b6c82b29 wasm
using Orthanc::DicomMap instead of OrthancPlugins::DicomDatasetReader
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 02 Oct 2017 14:31:26 +0200 |
parents | 42c05a3baee3 |
children | ba83e38cf3ff |
files | Framework/Toolbox/DicomFrameConverter.cpp Framework/Toolbox/DicomFrameConverter.h Framework/Toolbox/DicomStructureSet.cpp Framework/Toolbox/GeometryToolbox.cpp Framework/Toolbox/GeometryToolbox.h Framework/Toolbox/MessagingToolbox.cpp Framework/Toolbox/MessagingToolbox.h Framework/Toolbox/OrthancSeriesLoader.cpp Framework/Toolbox/OrthancSeriesLoader.h Framework/Toolbox/OrthancSlicesLoader.cpp Framework/Toolbox/Slice.cpp Framework/Toolbox/Slice.h |
diffstat | 12 files changed, 149 insertions(+), 150 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Toolbox/DicomFrameConverter.cpp Thu Sep 28 16:55:51 2017 +0200 +++ b/Framework/Toolbox/DicomFrameConverter.cpp Mon Oct 02 14:31:26 2017 +0200 @@ -62,13 +62,13 @@ } - void DicomFrameConverter::ReadParameters(const OrthancPlugins::IDicomDataset& dicom) + void DicomFrameConverter::ReadParameters(const Orthanc::DicomMap& dicom) { SetDefaultParameters(); Vector c, w; - if (GeometryToolbox::ParseVector(c, dicom, OrthancPlugins::DICOM_TAG_WINDOW_CENTER) && - GeometryToolbox::ParseVector(w, dicom, OrthancPlugins::DICOM_TAG_WINDOW_WIDTH) && + if (GeometryToolbox::ParseVector(c, dicom, Orthanc::DICOM_TAG_WINDOW_CENTER) && + GeometryToolbox::ParseVector(w, dicom, Orthanc::DICOM_TAG_WINDOW_WIDTH) && c.size() > 0 && w.size() > 0) { @@ -76,10 +76,8 @@ defaultWindowWidth_ = static_cast<float>(w[0]); } - OrthancPlugins::DicomDatasetReader reader(dicom); - - int tmp; - if (!reader.GetIntegerValue(tmp, OrthancPlugins::DICOM_TAG_PIXEL_REPRESENTATION)) + int32_t tmp; + if (!dicom.ParseInteger32(tmp, Orthanc::DICOM_TAG_PIXEL_REPRESENTATION)) { // Type 1 tag, must be present throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); @@ -87,15 +85,23 @@ isSigned_ = (tmp == 1); - if (reader.GetFloatValue(rescaleIntercept_, OrthancPlugins::DICOM_TAG_RESCALE_INTERCEPT) && - reader.GetFloatValue(rescaleSlope_, OrthancPlugins::DICOM_TAG_RESCALE_SLOPE)) + if (dicom.ParseFloat(rescaleIntercept_, Orthanc::DICOM_TAG_RESCALE_INTERCEPT) && + dicom.ParseFloat(rescaleSlope_, Orthanc::DICOM_TAG_RESCALE_SLOPE)) { hasRescale_ = true; } - // Type 1 tag, must be present - std::string photometric = reader.GetMandatoryStringValue(OrthancPlugins::DICOM_TAG_PHOTOMETRIC_INTERPRETATION); - photometric = Orthanc::Toolbox::StripSpaces(photometric); + std::string photometric; + if (dicom.CopyToString(photometric, Orthanc::DICOM_TAG_PHOTOMETRIC_INTERPRETATION, false)) + { + photometric = Orthanc::Toolbox::StripSpaces(photometric); + } + else + { + // Type 1 tag, must be present + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); + } + isColor_ = (photometric != "MONOCHROME1" && photometric != "MONOCHROME2"); }
--- a/Framework/Toolbox/DicomFrameConverter.h Thu Sep 28 16:55:51 2017 +0200 +++ b/Framework/Toolbox/DicomFrameConverter.h Mon Oct 02 14:31:26 2017 +0200 @@ -21,8 +21,8 @@ #pragma once +#include <Core/DicomFormat/DicomMap.h> #include <Core/Images/ImageAccessor.h> -#include <Plugins/Samples/Common/IDicomDataset.h> #include <memory> @@ -56,7 +56,7 @@ Orthanc::PixelFormat GetExpectedPixelFormat() const; - void ReadParameters(const OrthancPlugins::IDicomDataset& dicom); + void ReadParameters(const Orthanc::DicomMap& dicom); float GetDefaultWindowCenter() const {
--- a/Framework/Toolbox/DicomStructureSet.cpp Thu Sep 28 16:55:51 2017 +0200 +++ b/Framework/Toolbox/DicomStructureSet.cpp Mon Oct 02 14:31:26 2017 +0200 @@ -26,6 +26,7 @@ #include <Core/Logging.h> #include <Core/OrthancException.h> #include <Plugins/Samples/Common/FullOrthancDataset.h> +#include <Plugins/Samples/Common/DicomDatasetReader.h> #include <stdio.h> #include <boost/lexical_cast.hpp> @@ -62,11 +63,21 @@ } - CoordinateSystem3D DicomStructureSet::ExtractSliceGeometry(double& sliceThickness, - OrthancPlugins::IOrthancConnection& orthanc, - const OrthancPlugins::IDicomDataset& tags, - size_t contourIndex, - size_t sliceIndex) + static bool ParseVector(Vector& target, + const OrthancPlugins::IDicomDataset& dataset, + const OrthancPlugins::DicomPath& tag) + { + std::string value; + return (dataset.GetStringValue(value, tag) && + GeometryToolbox::ParseVector(target, value)); + } + + CoordinateSystem3D DicomStructureSet:: + ExtractSliceGeometry(double& sliceThickness, + OrthancPlugins::IOrthancConnection& orthanc, + const OrthancPlugins::IDicomDataset& tags, + size_t contourIndex, + size_t sliceIndex) { using namespace OrthancPlugins; @@ -80,10 +91,11 @@ } DicomDatasetReader reader(tags); - std::string parentUid = reader.GetMandatoryStringValue(DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, contourIndex, - DICOM_TAG_CONTOUR_SEQUENCE, sliceIndex, - DICOM_TAG_CONTOUR_IMAGE_SEQUENCE, 0, - DICOM_TAG_REFERENCED_SOP_INSTANCE_UID)); + std::string parentUid = reader.GetMandatoryStringValue + (DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, contourIndex, + DICOM_TAG_CONTOUR_SEQUENCE, sliceIndex, + DICOM_TAG_CONTOUR_IMAGE_SEQUENCE, 0, + DICOM_TAG_REFERENCED_SOP_INSTANCE_UID)); Json::Value parentLookup; MessagingToolbox::RestApiPost(parentLookup, orthanc, "/tools/lookup", parentUid); @@ -126,7 +138,7 @@ CoordinateSystem3D slice(parentTags); Vector v; - if (GeometryToolbox::ParseVector(v, parentTags, DICOM_TAG_SLICE_THICKNESS) && + if (ParseVector(v, parentTags, DICOM_TAG_SLICE_THICKNESS) && v.size() > 0) { sliceThickness = v[0]; @@ -201,8 +213,8 @@ "No interpretation"); Vector color; - if (GeometryToolbox::ParseVector(color, tags, DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i, - DICOM_TAG_ROI_DISPLAY_COLOR)) && + if (ParseVector(color, tags, DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i, + DICOM_TAG_ROI_DISPLAY_COLOR)) && color.size() == 3) { structures_[i].red_ = ConvertColor(color[0]);
--- a/Framework/Toolbox/GeometryToolbox.cpp Thu Sep 28 16:55:51 2017 +0200 +++ b/Framework/Toolbox/GeometryToolbox.cpp Mon Oct 02 14:31:26 2017 +0200 @@ -68,11 +68,11 @@ bool ParseVector(Vector& target, - const OrthancPlugins::IDicomDataset& dataset, - const OrthancPlugins::DicomPath& tag) + const Orthanc::DicomMap& dataset, + const Orthanc::DicomTag& tag) { std::string value; - return (dataset.GetStringValue(value, tag) && + return (dataset.CopyToString(value, tag, false) && ParseVector(target, value)); } @@ -351,11 +351,11 @@ void GetPixelSpacing(double& spacingX, double& spacingY, - const OrthancPlugins::IDicomDataset& dicom) + const Orthanc::DicomMap& dicom) { Vector v; - if (ParseVector(v, dicom, OrthancPlugins::DICOM_TAG_PIXEL_SPACING)) + if (ParseVector(v, dicom, Orthanc::DICOM_TAG_PIXEL_SPACING)) { if (v.size() != 2 || v[0] <= 0 ||
--- a/Framework/Toolbox/GeometryToolbox.h Thu Sep 28 16:55:51 2017 +0200 +++ b/Framework/Toolbox/GeometryToolbox.h Mon Oct 02 14:31:26 2017 +0200 @@ -30,7 +30,7 @@ #include <boost/numeric/ublas/vector.hpp> -#include <Plugins/Samples/Common/DicomDatasetReader.h> +#include <Core/DicomFormat/DicomMap.h> namespace OrthancStone { @@ -44,8 +44,8 @@ const std::string& s); bool ParseVector(Vector& target, - const OrthancPlugins::IDicomDataset& dataset, - const OrthancPlugins::DicomPath& tag); + const Orthanc::DicomMap& dataset, + const Orthanc::DicomTag& tag); void AssignVector(Vector& v, double v1, @@ -111,6 +111,6 @@ void GetPixelSpacing(double& spacingX, double& spacingY, - const OrthancPlugins::IDicomDataset& dicom); + const Orthanc::DicomMap& dicom); }; }
--- a/Framework/Toolbox/MessagingToolbox.cpp Thu Sep 28 16:55:51 2017 +0200 +++ b/Framework/Toolbox/MessagingToolbox.cpp Mon Oct 02 14:31:26 2017 +0200 @@ -32,58 +32,10 @@ #include <boost/lexical_cast.hpp> #include <json/reader.h> -#if defined(__native_client__) -# include <boost/math/special_functions/round.hpp> -#else -# include <boost/date_time/posix_time/posix_time.hpp> -# include <boost/date_time/microsec_time_clock.hpp> -#endif - namespace OrthancStone { namespace MessagingToolbox { -#if defined(__native_client__) - static pp::Core* core_ = NULL; - - void Timestamp::Initialize(pp::Core* core) - { - if (core == NULL) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); - } - - core_ = core; - } - - Timestamp::Timestamp() - { - if (core_ == NULL) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); - } - - time_ = core_->GetTimeTicks(); - } - - int Timestamp::GetMillisecondsSince(const Timestamp& other) - { - double difference = time_ - other.time_; - return static_cast<int>(boost::math::iround(difference * 1000.0)); - } -#else - Timestamp::Timestamp() - { - time_ = boost::posix_time::microsec_clock::local_time(); - } - - int Timestamp::GetMillisecondsSince(const Timestamp& other) - { - boost::posix_time::time_duration difference = time_ - other.time_; - return static_cast<int>(difference.total_milliseconds()); - } -#endif - static bool ParseVersion(std::string& version, unsigned int& major, unsigned int& minor, @@ -446,5 +398,48 @@ return image.release(); } + + + static void AddTag(Orthanc::DicomMap& target, + const OrthancPlugins::IDicomDataset& source, + const Orthanc::DicomTag& tag) + { + OrthancPlugins::DicomTag key(tag.GetGroup(), tag.GetElement()); + + std::string value; + if (source.GetStringValue(value, key)) + { + target.SetValue(tag, value, false); + } + } + + + void ConvertDataset(Orthanc::DicomMap& target, + const OrthancPlugins::IDicomDataset& source) + { + target.Clear(); + + AddTag(target, source, Orthanc::DICOM_TAG_BITS_ALLOCATED); + AddTag(target, source, Orthanc::DICOM_TAG_BITS_STORED); + AddTag(target, source, Orthanc::DICOM_TAG_COLUMNS); + AddTag(target, source, Orthanc::DICOM_TAG_FRAME_INCREMENT_POINTER); + AddTag(target, source, Orthanc::DICOM_TAG_GRID_FRAME_OFFSET_VECTOR); + AddTag(target, source, Orthanc::DICOM_TAG_HIGH_BIT); + AddTag(target, source, Orthanc::DICOM_TAG_IMAGE_ORIENTATION_PATIENT); + AddTag(target, source, Orthanc::DICOM_TAG_IMAGE_POSITION_PATIENT); + AddTag(target, source, Orthanc::DICOM_TAG_NUMBER_OF_FRAMES); + AddTag(target, source, Orthanc::DICOM_TAG_PHOTOMETRIC_INTERPRETATION); + AddTag(target, source, Orthanc::DICOM_TAG_PIXEL_REPRESENTATION); + AddTag(target, source, Orthanc::DICOM_TAG_PIXEL_SPACING); + AddTag(target, source, Orthanc::DICOM_TAG_PLANAR_CONFIGURATION); + AddTag(target, source, Orthanc::DICOM_TAG_RESCALE_INTERCEPT); + AddTag(target, source, Orthanc::DICOM_TAG_RESCALE_SLOPE); + AddTag(target, source, Orthanc::DICOM_TAG_ROWS); + AddTag(target, source, Orthanc::DICOM_TAG_SAMPLES_PER_PIXEL); + AddTag(target, source, Orthanc::DICOM_TAG_SLICE_THICKNESS); + AddTag(target, source, Orthanc::DICOM_TAG_SOP_CLASS_UID); + AddTag(target, source, Orthanc::DICOM_TAG_WINDOW_CENTER); + AddTag(target, source, Orthanc::DICOM_TAG_WINDOW_WIDTH); + } } }
--- a/Framework/Toolbox/MessagingToolbox.h Thu Sep 28 16:55:51 2017 +0200 +++ b/Framework/Toolbox/MessagingToolbox.h Mon Oct 02 14:31:26 2017 +0200 @@ -24,40 +24,16 @@ #include "../Enumerations.h" #include <Plugins/Samples/Common/IOrthancConnection.h> +#include <Plugins/Samples/Common/IDicomDataset.h> #include <Core/Images/ImageAccessor.h> +#include <Core/DicomFormat/DicomMap.h> #include <json/value.h> -#if defined(__native_client__) -# include <ppapi/cpp/core.h> -#else -# include <boost/date_time/posix_time/ptime.hpp> -#endif - namespace OrthancStone { namespace MessagingToolbox { - class Timestamp // TODO REMOVE THIS - { - private: -#if defined(__native_client__) - PP_TimeTicks time_; -#else - boost::posix_time::ptime time_; -#endif - - public: - Timestamp(); - -#if defined(__native_client__) - static void Initialize(pp::Core* core); -#endif - - int GetMillisecondsSince(const Timestamp& other); - }; - - bool ParseJson(Json::Value& target, const void* content, size_t size); @@ -88,5 +64,8 @@ unsigned int frame, unsigned int quality, Orthanc::PixelFormat targetFormat); + + void ConvertDataset(Orthanc::DicomMap& target, + const OrthancPlugins::IDicomDataset& source); } }
--- a/Framework/Toolbox/OrthancSeriesLoader.cpp Thu Sep 28 16:55:51 2017 +0200 +++ b/Framework/Toolbox/OrthancSeriesLoader.cpp Mon Oct 02 14:31:26 2017 +0200 @@ -356,16 +356,18 @@ std::string uri = "/instances/" + slices_->GetSlice(0).GetInstanceId() + "/tags"; OrthancPlugins::FullOrthancDataset dataset(orthanc_, uri); - OrthancPlugins::DicomDatasetReader reader(dataset); - if (!reader.GetUnsignedIntegerValue(width_, OrthancPlugins::DICOM_TAG_COLUMNS) || - !reader.GetUnsignedIntegerValue(height_, OrthancPlugins::DICOM_TAG_ROWS)) + Orthanc::DicomMap dicom; + MessagingToolbox::ConvertDataset(dicom, dataset); + + if (!dicom.ParseUnsignedInteger32(width_, Orthanc::DICOM_TAG_COLUMNS) || + !dicom.ParseUnsignedInteger32(height_, Orthanc::DICOM_TAG_ROWS)) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InexistentTag); } DicomFrameConverter converter; - converter.ReadParameters(dataset); + converter.ReadParameters(dicom); format_ = converter.GetExpectedPixelFormat(); } @@ -375,10 +377,12 @@ std::string uri = "/instances/" + slices_->GetSlice(index).GetInstanceId() + "/tags"; std::auto_ptr<OrthancPlugins::IDicomDataset> dataset(new OrthancPlugins::FullOrthancDataset(orthanc_, uri)); - OrthancPlugins::DicomDatasetReader reader(*dataset); - unsigned int frames; - if (reader.GetUnsignedIntegerValue(frames, OrthancPlugins::DICOM_TAG_NUMBER_OF_FRAMES) && + Orthanc::DicomMap dicom; + MessagingToolbox::ConvertDataset(dicom, *dataset); + + uint32_t frames; + if (dicom.ParseUnsignedInteger32(frames, Orthanc::DICOM_TAG_NUMBER_OF_FRAMES) && frames != 1) { LOG(ERROR) << "One instance in this series has more than 1 frame";
--- a/Framework/Toolbox/OrthancSeriesLoader.h Thu Sep 28 16:55:51 2017 +0200 +++ b/Framework/Toolbox/OrthancSeriesLoader.h Mon Oct 02 14:31:26 2017 +0200 @@ -42,8 +42,8 @@ boost::shared_ptr<SetOfSlices> slices_; ParallelSlices geometry_; Orthanc::PixelFormat format_; - unsigned int width_; - unsigned int height_; + uint32_t width_; + uint32_t height_; void CheckFrame(const Orthanc::ImageAccessor& frame) const;
--- a/Framework/Toolbox/OrthancSlicesLoader.cpp Thu Sep 28 16:55:51 2017 +0200 +++ b/Framework/Toolbox/OrthancSlicesLoader.cpp Mon Oct 02 14:31:26 2017 +0200 @@ -31,7 +31,6 @@ #include <Core/Logging.h> #include <Core/OrthancException.h> #include <Core/Toolbox.h> -#include <Plugins/Samples/Common/DicomDatasetReader.h> #include <Plugins/Samples/Common/FullOrthancDataset.h> #include <boost/lexical_cast.hpp> @@ -295,10 +294,12 @@ for (size_t i = 0; i < instances.size(); i++) { OrthancPlugins::FullOrthancDataset dataset(series[instances[i]]); - OrthancPlugins::DicomDatasetReader reader(dataset); + + Orthanc::DicomMap dicom; + MessagingToolbox::ConvertDataset(dicom, dataset); unsigned int frames; - if (!reader.GetUnsignedIntegerValue(frames, OrthancPlugins::DICOM_TAG_NUMBER_OF_FRAMES)) + if (!dicom.ParseUnsignedInteger32(frames, Orthanc::DICOM_TAG_NUMBER_OF_FRAMES)) { frames = 1; } @@ -306,7 +307,7 @@ for (unsigned int frame = 0; frame < frames; frame++) { Slice slice; - if (slice.ParseOrthancFrame(dataset, instances[i], frame)) + if (slice.ParseOrthancFrame(dicom, instances[i], frame)) { slices_.AddSlice(slice); } @@ -359,10 +360,12 @@ } OrthancPlugins::FullOrthancDataset dataset(tags); - OrthancPlugins::DicomDatasetReader reader(dataset); + Orthanc::DicomMap dicom; + MessagingToolbox::ConvertDataset(dicom, dataset); + unsigned int frames; - if (!reader.GetUnsignedIntegerValue(frames, OrthancPlugins::DICOM_TAG_NUMBER_OF_FRAMES)) + if (!dicom.ParseUnsignedInteger32(frames, Orthanc::DICOM_TAG_NUMBER_OF_FRAMES)) { frames = 1; } @@ -374,7 +377,7 @@ for (unsigned int frame = 0; frame < frames; frame++) { Slice slice; - if (slice.ParseOrthancFrame(dataset, instanceId, frame)) + if (slice.ParseOrthancFrame(dicom, instanceId, frame)) { slices_.AddSlice(slice); } @@ -406,9 +409,12 @@ OrthancPlugins::FullOrthancDataset dataset(tags); state_ = State_GeometryReady; - + + Orthanc::DicomMap dicom; + MessagingToolbox::ConvertDataset(dicom, dataset); + Slice slice; - if (slice.ParseOrthancFrame(dataset, instanceId, frame)) + if (slice.ParseOrthancFrame(dicom, instanceId, frame)) { LOG(INFO) << "Loaded instance " << instanceId; slices_.AddSlice(slice);
--- a/Framework/Toolbox/Slice.cpp Thu Sep 28 16:55:51 2017 +0200 +++ b/Framework/Toolbox/Slice.cpp Mon Oct 02 14:31:26 2017 +0200 @@ -45,18 +45,15 @@ } } - bool Slice::ComputeRTDoseGeometry(const OrthancPlugins::DicomDatasetReader& reader, + bool Slice::ComputeRTDoseGeometry(const Orthanc::DicomMap& dataset, unsigned int frame) { // http://dicom.nema.org/medical/Dicom/2016a/output/chtml/part03/sect_C.8.8.3.2.html - static const OrthancPlugins::DicomTag DICOM_TAG_GRID_FRAME_OFFSET_VECTOR(0x3004, 0x000c); - static const OrthancPlugins::DicomTag DICOM_TAG_FRAME_INCREMENT_POINTER(0x0028, 0x0009); + + std::string increment, offsetTag; - std::string increment = reader.GetStringValue(DICOM_TAG_FRAME_INCREMENT_POINTER, ""); - std::string offsetTag; - - bool ok = reader.GetDataset().GetStringValue(offsetTag, DICOM_TAG_GRID_FRAME_OFFSET_VECTOR); - if (!ok) + if (!dataset.CopyToString(increment, Orthanc::DICOM_TAG_FRAME_INCREMENT_POINTER, false) || + !dataset.CopyToString(offsetTag, Orthanc::DICOM_TAG_GRID_FRAME_OFFSET_VECTOR, false)) { LOG(ERROR) << "Cannot read the \"GridFrameOffsetVector\" tag, check you are using Orthanc >= 1.3.1"; return false; @@ -103,7 +100,7 @@ } - bool Slice::ParseOrthancFrame(const OrthancPlugins::IDicomDataset& dataset, + bool Slice::ParseOrthancFrame(const Orthanc::DicomMap& dataset, const std::string& instanceId, unsigned int frame) { @@ -111,16 +108,14 @@ frame_ = frame; type_ = Type_OrthancDecodableFrame; - OrthancPlugins::DicomDatasetReader reader(dataset); - - sopClassUid_ = reader.GetStringValue(OrthancPlugins::DICOM_TAG_SOP_CLASS_UID, ""); - if (sopClassUid_.empty()) + if (!dataset.CopyToString(sopClassUid_, Orthanc::DICOM_TAG_SOP_CLASS_UID, false) || + sopClassUid_.empty()) { LOG(ERROR) << "Instance without a SOP class UID"; return false; } - - if (!reader.GetUnsignedIntegerValue(frameCount_, OrthancPlugins::DICOM_TAG_NUMBER_OF_FRAMES)) + + if (!dataset.ParseUnsignedInteger32(frameCount_, Orthanc::DICOM_TAG_NUMBER_OF_FRAMES)) { frameCount_ = 1; // Assume instance with one frame } @@ -130,8 +125,8 @@ return false; } - if (!reader.GetUnsignedIntegerValue(width_, OrthancPlugins::DICOM_TAG_COLUMNS) || - !reader.GetUnsignedIntegerValue(height_, OrthancPlugins::DICOM_TAG_ROWS)) + if (!dataset.ParseUnsignedInteger32(width_, Orthanc::DICOM_TAG_COLUMNS) || + !dataset.ParseUnsignedInteger32(height_, Orthanc::DICOM_TAG_ROWS)) { return false; } @@ -139,7 +134,7 @@ thickness_ = 100.0 * std::numeric_limits<double>::epsilon(); std::string tmp; - if (dataset.GetStringValue(tmp, OrthancPlugins::DICOM_TAG_SLICE_THICKNESS)) + if (dataset.CopyToString(tmp, Orthanc::DICOM_TAG_SLICE_THICKNESS, false)) { if (!tmp.empty() && !ParseDouble(thickness_, tmp)) @@ -153,8 +148,8 @@ GeometryToolbox::GetPixelSpacing(pixelSpacingX_, pixelSpacingY_, dataset); std::string position, orientation; - if (dataset.GetStringValue(position, OrthancPlugins::DICOM_TAG_IMAGE_POSITION_PATIENT) && - dataset.GetStringValue(orientation, OrthancPlugins::DICOM_TAG_IMAGE_ORIENTATION_PATIENT)) + if (dataset.CopyToString(position, Orthanc::DICOM_TAG_IMAGE_POSITION_PATIENT, false) && + dataset.CopyToString(orientation, Orthanc::DICOM_TAG_IMAGE_ORIENTATION_PATIENT, false)) { geometry_ = CoordinateSystem3D(position, orientation); @@ -167,7 +162,7 @@ { case SopClassUid_RTDose: type_ = Type_OrthancRawFrame; - ok = ComputeRTDoseGeometry(reader, frame); + ok = ComputeRTDoseGeometry(dataset, frame); break; default:
--- a/Framework/Toolbox/Slice.h Thu Sep 28 16:55:51 2017 +0200 +++ b/Framework/Toolbox/Slice.h Mon Oct 02 14:31:26 2017 +0200 @@ -24,6 +24,8 @@ #include "CoordinateSystem3D.h" #include "DicomFrameConverter.h" +#include <Core/DicomFormat/DicomMap.h> + namespace OrthancStone { class Slice @@ -38,7 +40,7 @@ // TODO A slice could come from some DICOM file (URL) }; - bool ComputeRTDoseGeometry(const OrthancPlugins::DicomDatasetReader& reader, + bool ComputeRTDoseGeometry(const Orthanc::DicomMap& dataset, unsigned int frame); Type type_; @@ -99,7 +101,7 @@ return type_ != Type_Invalid; } - bool ParseOrthancFrame(const OrthancPlugins::IDicomDataset& dataset, + bool ParseOrthancFrame(const Orthanc::DicomMap& dataset, const std::string& instanceId, unsigned int frame);