Mercurial > hg > orthanc-wsi
comparison Framework/Inputs/OpenSlidePyramid.cpp @ 280:34b507959e32 iiif
integration mainline->iiif
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 12 Jul 2023 18:08:27 +0200 |
parents | 77afef2cf64b |
children | 7020852a8fa9 |
comparison
equal
deleted
inserted
replaced
277:ac1508b438b1 | 280:34b507959e32 |
---|---|
24 #include "OpenSlidePyramid.h" | 24 #include "OpenSlidePyramid.h" |
25 | 25 |
26 #include <Compatibility.h> // For std::unique_ptr | 26 #include <Compatibility.h> // For std::unique_ptr |
27 #include <Images/ImageProcessing.h> | 27 #include <Images/ImageProcessing.h> |
28 #include <OrthancException.h> | 28 #include <OrthancException.h> |
29 #include <SerializationToolbox.h> | |
29 #include <Logging.h> | 30 #include <Logging.h> |
30 | 31 |
31 #include <memory> | 32 #include <memory> |
32 | 33 |
33 namespace OrthancWSI | 34 namespace OrthancWSI |
48 image_(path), | 49 image_(path), |
49 tileWidth_(tileWidth), | 50 tileWidth_(tileWidth), |
50 tileHeight_(tileHeight) | 51 tileHeight_(tileHeight) |
51 { | 52 { |
52 } | 53 } |
54 | |
55 | |
56 bool OpenSlidePyramid::LookupImagedVolumeSize(float& width, | |
57 float& height) const | |
58 { | |
59 std::string s; | |
60 double mppx; | |
61 double mppy; | |
62 | |
63 if (image_.LookupProperty(s, "openslide.mpp-x") && | |
64 Orthanc::SerializationToolbox::ParseDouble(mppx, s) && | |
65 image_.LookupProperty(s, "openslide.mpp-y") && | |
66 Orthanc::SerializationToolbox::ParseDouble(mppy, s)) | |
67 { | |
68 // In the 2 lines below, remember to switch X/Y when going from physical to pixel coordinates! | |
69 width = mppy / 1000.0 * static_cast<double>(image_.GetLevelHeight(0)); | |
70 height = mppx / 1000.0 * static_cast<double>(image_.GetLevelWidth(0)); | |
71 return true; | |
72 } | |
73 else | |
74 { | |
75 return false; | |
76 } | |
77 } | |
53 } | 78 } |