# HG changeset patch # User Sebastien Jodogne # Date 1593011826 -7200 # Node ID 5d892f5dd9c45ae3380d65382eb3b5f25ae0098f # Parent b931ddbe070e748ee607cf3273a4469e71e5d442 SortedFrames::IsFrameMonochrome1() diff -r b931ddbe070e -r 5d892f5dd9c4 Framework/Toolbox/CoordinateSystem3D.h --- a/Framework/Toolbox/CoordinateSystem3D.h Tue Jun 23 07:50:14 2020 +0200 +++ b/Framework/Toolbox/CoordinateSystem3D.h Wed Jun 24 17:17:06 2020 +0200 @@ -76,7 +76,7 @@ return normal_; } - const Vector& GetOrigin() const + const Vector& GetOrigin() const // This is the "Image Position Patient" tag { return origin_; } diff -r b931ddbe070e -r 5d892f5dd9c4 Framework/Toolbox/SortedFrames.cpp --- a/Framework/Toolbox/SortedFrames.cpp Tue Jun 23 07:50:14 2020 +0200 +++ b/Framework/Toolbox/SortedFrames.cpp Wed Jun 24 17:17:06 2020 +0200 @@ -21,9 +21,10 @@ #include "SortedFrames.h" -#include +#include "GeometryToolbox.h" -#include "GeometryToolbox.h" +#include +#include namespace OrthancStone { @@ -46,6 +47,17 @@ numberOfFrames_ = 1; } + std::string photometric; + if (tags.LookupStringValue(photometric, Orthanc::DICOM_TAG_PHOTOMETRIC_INTERPRETATION, false)) + { + Orthanc::Toolbox::StripSpaces(photometric); + monochrome1_ = (photometric == "MONOCHROME1"); + } + else + { + monochrome1_ = false; + } + hasPosition_ = ( LinearAlgebra::ParseVector(position_, tags, Orthanc::DICOM_TAG_IMAGE_POSITION_PATIENT) && position_.size() == 3 && diff -r b931ddbe070e -r 5d892f5dd9c4 Framework/Toolbox/SortedFrames.h --- a/Framework/Toolbox/SortedFrames.h Tue Jun 23 07:50:14 2020 +0200 +++ b/Framework/Toolbox/SortedFrames.h Wed Jun 24 17:17:06 2020 +0200 @@ -35,8 +35,9 @@ Orthanc::DicomMap tags_; std::string sopInstanceUid_; unsigned int numberOfFrames_; - Vector normal_; - Vector position_; + Vector normal_; // Only used in "Sort()" + Vector position_; // Only used in "Sort()" + bool monochrome1_; public: Instance(const Orthanc::DicomMap& tags); @@ -64,6 +65,11 @@ const Vector& GetNormal() const; const Vector& GetPosition() const; + + bool IsMonochrome1() const + { + return monochrome1_; + } }; struct Frame @@ -164,16 +170,21 @@ return GetFrame(index).GetInstance().GetSopInstanceUid(); } - const unsigned int GetFrameSiblingsCount(size_t index) const + unsigned int GetFrameSiblingsCount(size_t index) const { return GetFrame(index).GetInstance().GetNumberOfFrames(); } - const unsigned int GetFrameIndex(size_t index) const + unsigned int GetFrameIndex(size_t index) const { return GetFrame(index).GetFrameIndex(); } + bool IsFrameMonochrome1(size_t index) const + { + return GetFrame(index).GetInstance().IsMonochrome1(); + } + void Sort(); }; }