Mercurial > hg > orthanc-stone
changeset 1490:5d892f5dd9c4
SortedFrames::IsFrameMonochrome1()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 24 Jun 2020 17:17:06 +0200 |
parents | b931ddbe070e |
children | c5627b8493f3 |
files | Framework/Toolbox/CoordinateSystem3D.h Framework/Toolbox/SortedFrames.cpp Framework/Toolbox/SortedFrames.h |
diffstat | 3 files changed, 30 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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_; }
--- 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 <OrthancException.h> +#include "GeometryToolbox.h" -#include "GeometryToolbox.h" +#include <OrthancException.h> +#include <Toolbox.h> 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 &&
--- 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(); }; }