Mercurial > hg > orthanc-stone
diff Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h @ 1821:36430d73e36c
introducing measure units in AnnotationsSceneLayer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 26 May 2021 14:02:12 +0200 |
parents | 462d7a0e064e |
children | 0489fe25ce48 |
line wrap: on
line diff
--- a/Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h Wed May 26 13:08:49 2021 +0200 +++ b/Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewerApplication.h Wed May 26 14:02:12 2021 +0200 @@ -101,16 +101,23 @@ lock->Invalidate(); } + OrthancStone::Units GetUnits() const + { + return units_; + } + private: ILoadersContext& context_; boost::shared_ptr<IViewport> viewport_; boost::shared_ptr<DicomResourcesLoader> dicomLoader_; boost::shared_ptr<SeriesFramesLoader> framesLoader_; + OrthancStone::Units units_; SdlSimpleViewerApplication(ILoadersContext& context, boost::shared_ptr<IViewport> viewport) : context_(context), - viewport_(viewport) + viewport_(viewport), + units_(OrthancStone::Units_Pixels) { } @@ -141,6 +148,26 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } + OrthancStone::DicomInstanceParameters parameters(message.GetResources()->GetResource(0)); + if (parameters.HasPixelSpacing()) + { + /** + * TODO - Ultrasound (US) images store an equivalent to + * "PixelSpacing" in the "SequenceOfUltrasoundRegions" + * (0018,6011) sequence, cf. tags "PhysicalDeltaX" (0018,602c) + * and "PhysicalDeltaY" (0018,602e) => This would require + * storing the full JSON into the "LoadedDicomResources" class + * or to use DCMTK + **/ + + LOG(INFO) << "Using millimeters units, as the DICOM instance contains the PixelSpacing tag"; + units_ = OrthancStone::Units_Millimeters; + } + else + { + LOG(INFO) << "Using pixels units, as the DICOM instance does *not* contain the PixelSpacing tag"; + } + //message.GetResources()->GetResource(0).Print(stdout); {