Mercurial > hg > orthanc-stone
changeset 2092:b7d4d288459a dicom-sr
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 08 Nov 2023 10:32:16 +0100 |
parents | 35de56fb6f89 |
children | c336e07b675c |
files | Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp OrthancStone/Sources/Toolbox/DicomStructuredReport.cpp OrthancStone/Sources/Toolbox/DicomStructuredReport.h |
diffstat | 3 files changed, 25 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Wed Nov 08 10:11:21 2023 +0100 +++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Wed Nov 08 10:32:16 2023 +0100 @@ -212,12 +212,6 @@ { } - // TODO - MUST BE REMOVED - virtual std::string GetStudyInstanceUid() const = 0; - - // TODO - MUST BE REMOVED - virtual std::string GetSeriesInstanceUid() const = 0; - virtual size_t GetFramesCount() const = 0; virtual const OrthancStone::DicomInstanceParameters& GetInstanceOfFrame(size_t frameIndex) const = 0; @@ -255,16 +249,6 @@ } } - virtual std::string GetStudyInstanceUid() const ORTHANC_OVERRIDE - { - return frames_->GetStudyInstanceUid(); - } - - virtual std::string GetSeriesInstanceUid() const ORTHANC_OVERRIDE - { - return frames_->GetSeriesInstanceUid(); - } - virtual size_t GetFramesCount() const ORTHANC_OVERRIDE { return frames_->GetFramesCount(); @@ -307,12 +291,12 @@ class Frame : public boost::noncopyable { private: - OrthancStone::DicomStructuredReport::Frame info_; + OrthancStone::DicomStructuredReport::ReferencedFrame info_; Orthanc::DicomMap tags_; std::unique_ptr<OrthancStone::DicomInstanceParameters> parameters_; public: - Frame(const OrthancStone::DicomStructuredReport::Frame& info, + Frame(const OrthancStone::DicomStructuredReport::ReferencedFrame& info, const OrthancStone::LoadedDicomResources& instances) : info_(info) { @@ -324,7 +308,7 @@ parameters_.reset(new OrthancStone::DicomInstanceParameters(tags_)); } - const OrthancStone::DicomStructuredReport::Frame& GetInformation() const + const OrthancStone::DicomStructuredReport::ReferencedFrame& GetInformation() const { return info_; } @@ -376,11 +360,11 @@ studyInstanceUid_(sr.GetStudyInstanceUid()), seriesInstanceUid_(sr.GetSeriesInstanceUid()) { - std::list<OrthancStone::DicomStructuredReport::Frame> tmp; - sr.ExportOrderedFrames(tmp); + std::list<OrthancStone::DicomStructuredReport::ReferencedFrame> tmp; + sr.ExportReferencedFrames(tmp); frames_.reserve(tmp.size()); - for (std::list<OrthancStone::DicomStructuredReport::Frame>::const_iterator + for (std::list<OrthancStone::DicomStructuredReport::ReferencedFrame>::const_iterator it = tmp.begin(); it != tmp.end(); ++it) { try @@ -400,16 +384,6 @@ { Finalize(); } - - virtual std::string GetStudyInstanceUid() const ORTHANC_OVERRIDE - { - return studyInstanceUid_; - } - - virtual std::string GetSeriesInstanceUid() const ORTHANC_OVERRIDE - { - return seriesInstanceUid_; - } virtual size_t GetFramesCount() const ORTHANC_OVERRIDE {
--- a/OrthancStone/Sources/Toolbox/DicomStructuredReport.cpp Wed Nov 08 10:11:21 2023 +0100 +++ b/OrthancStone/Sources/Toolbox/DicomStructuredReport.cpp Wed Nov 08 10:32:16 2023 +0100 @@ -341,6 +341,7 @@ studyInstanceUid_ = GetStringValue(dataset, DCM_StudyInstanceUID); seriesInstanceUid_ = GetStringValue(dataset, DCM_SeriesInstanceUID); + sopInstanceUid_ = GetStringValue(dataset, DCM_SOPInstanceUID); CheckStringValue(dataset, DCM_Modality, "SR"); CheckStringValue(dataset, DCM_SOPClassUID, "1.2.840.10008.5.1.4.1.1.88.33"); // Comprehensive SR IOD @@ -573,7 +574,7 @@ } - void DicomStructuredReport::ExportOrderedFrames(std::list<Frame>& frames) const + void DicomStructuredReport::ExportReferencedFrames(std::list<ReferencedFrame>& frames) const { frames.clear(); @@ -590,10 +591,10 @@ for (std::set<unsigned int>::const_iterator frame = found->second->GetFrames().begin(); frame != found->second->GetFrames().end(); ++frame) { - frames.push_back(Frame(found->second->GetStudyInstanceUid(), - found->second->GetSeriesInstanceUid(), - orderedInstances_[i], - found->second->GetSopClassUid(), *frame)); + frames.push_back(ReferencedFrame(found->second->GetStudyInstanceUid(), + found->second->GetSeriesInstanceUid(), + orderedInstances_[i], + found->second->GetSopClassUid(), *frame)); } } }
--- a/OrthancStone/Sources/Toolbox/DicomStructuredReport.h Wed Nov 08 10:11:21 2023 +0100 +++ b/OrthancStone/Sources/Toolbox/DicomStructuredReport.h Wed Nov 08 10:32:16 2023 +0100 @@ -97,12 +97,13 @@ std::string studyInstanceUid_; std::string seriesInstanceUid_; + std::string sopInstanceUid_; std::map<std::string, ReferencedInstance*> instancesInformation_; std::vector<std::string> orderedInstances_; std::list<Structure*> structures_; public: - class Frame + class ReferencedFrame { private: std::string studyInstanceUid_; @@ -112,11 +113,11 @@ unsigned int frameNumber_; public: - Frame(const std::string& studyInstanceUid, - const std::string& seriesInstanceUid, - const std::string& sopInstanceUid, - const std::string& sopClassUid, - unsigned int frameNumber) : + ReferencedFrame(const std::string& studyInstanceUid, + const std::string& seriesInstanceUid, + const std::string& sopInstanceUid, + const std::string& sopClassUid, + unsigned int frameNumber) : studyInstanceUid_(studyInstanceUid), seriesInstanceUid_(seriesInstanceUid), sopInstanceUid_(sopInstanceUid), @@ -165,6 +166,11 @@ return seriesInstanceUid_; } + const std::string& GetSopInstanceUid() const + { + return sopInstanceUid_; + } + size_t GetReferencedInstancesCount() const { return orderedInstances_.size(); @@ -176,6 +182,6 @@ std::string& sopClassUid, size_t i) const; - void ExportOrderedFrames(std::list<Frame>& frames) const; + void ExportReferencedFrames(std::list<ReferencedFrame>& frames) const; }; }