jfjoch_broker: Add auto-contrast option
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 11m23s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 12m3s
Build Packages / Generate python client (push) Successful in 32s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 12m43s
Build Packages / Build documentation (push) Successful in 37s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky8) (push) Successful in 13m13s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 13m35s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 13m29s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 13m42s
Build Packages / build:rpm (rocky9) (push) Successful in 14m6s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 9m39s
Build Packages / build:rpm (ubuntu2404_nocuda) (pull_request) Successful in 11m2s
Build Packages / build:rpm (rocky8_nocuda) (pull_request) Successful in 11m53s
Build Packages / build:rpm (ubuntu2204_nocuda) (pull_request) Successful in 12m4s
Build Packages / build:rpm (rocky8) (pull_request) Successful in 11m34s
Build Packages / Generate python client (pull_request) Successful in 14s
Build Packages / build:rpm (rocky8_sls9) (pull_request) Successful in 12m18s
Build Packages / Create release (pull_request) Has been skipped
Build Packages / build:rpm (rocky9_nocuda) (pull_request) Successful in 12m55s
Build Packages / Build documentation (pull_request) Successful in 35s
Build Packages / build:rpm (rocky9) (pull_request) Successful in 10m16s
Build Packages / build:rpm (ubuntu2404) (pull_request) Successful in 7m39s
Build Packages / build:rpm (ubuntu2204) (pull_request) Successful in 8m28s
Build Packages / Unit tests (push) Has been cancelled
Build Packages / Unit tests (pull_request) Failing after 1h35m36s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 11m23s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 12m3s
Build Packages / Generate python client (push) Successful in 32s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 12m43s
Build Packages / Build documentation (push) Successful in 37s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky8) (push) Successful in 13m13s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 13m35s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 13m29s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 13m42s
Build Packages / build:rpm (rocky9) (push) Successful in 14m6s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 9m39s
Build Packages / build:rpm (ubuntu2404_nocuda) (pull_request) Successful in 11m2s
Build Packages / build:rpm (rocky8_nocuda) (pull_request) Successful in 11m53s
Build Packages / build:rpm (ubuntu2204_nocuda) (pull_request) Successful in 12m4s
Build Packages / build:rpm (rocky8) (pull_request) Successful in 11m34s
Build Packages / Generate python client (pull_request) Successful in 14s
Build Packages / build:rpm (rocky8_sls9) (pull_request) Successful in 12m18s
Build Packages / Create release (pull_request) Has been skipped
Build Packages / build:rpm (rocky9_nocuda) (pull_request) Successful in 12m55s
Build Packages / Build documentation (pull_request) Successful in 35s
Build Packages / build:rpm (rocky9) (pull_request) Successful in 10m16s
Build Packages / build:rpm (ubuntu2404) (pull_request) Successful in 7m39s
Build Packages / build:rpm (ubuntu2204) (pull_request) Successful in 8m28s
Build Packages / Unit tests (push) Has been cancelled
Build Packages / Unit tests (pull_request) Failing after 1h35m36s
This commit is contained in:
1 parent
338bbc9519
commit
8210a08454
15 files changed
+105
-31
No files matched your search
@@ -478,6 +478,7 @@ void JFJochBrokerHttp::image_buffer_image_jpeg_get(const std::optional<int64_t>
|
||||
const std::optional<int64_t> &jpegQuality,
|
||||
const std::optional<float> &showResRing,
|
||||
const std::optional<std::string> &color,
|
||||
const std::optional<bool> &showResEst,
|
||||
Pistache::Http::ResponseWriter &response) {
|
||||
int64_t image_id = id.value_or(ImageBuffer::MaxImage);
|
||||
PreviewImageSettings settings{};
|
||||
@@ -485,7 +486,8 @@ void JFJochBrokerHttp::image_buffer_image_jpeg_get(const std::optional<int64_t>
|
||||
settings.show_user_mask = showUserMask.value_or(true);
|
||||
settings.show_roi = showRoi.value_or(false);
|
||||
settings.show_spots = showSpots.value_or(true);
|
||||
settings.saturation_value = saturation.value_or(10);
|
||||
settings.saturation_value = saturation;
|
||||
settings.background_value = 0.0;
|
||||
settings.jpeg_quality = jpegQuality.value_or(100);
|
||||
settings.resolution_ring = showResRing;
|
||||
settings.scale = ConvertColorScale(color);
|
||||
|
||||
@@ -147,6 +147,7 @@ class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi {
|
||||
|
||||
void image_buffer_image_cbor_get(const std::optional<int64_t> &id,
|
||||
Pistache::Http::ResponseWriter &response) override;
|
||||
|
||||
void image_buffer_image_jpeg_get(const std::optional<int64_t> &id,
|
||||
const std::optional<bool> &showUserMask,
|
||||
const std::optional<bool> &showRoi,
|
||||
@@ -156,6 +157,7 @@ class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi {
|
||||
const std::optional<int64_t> &jpegQuality,
|
||||
const std::optional<float> &showResRing,
|
||||
const std::optional<std::string> &color,
|
||||
const std::optional<bool> &showResEst,
|
||||
Pistache::Http::ResponseWriter &response) override;
|
||||
|
||||
void image_buffer_image_tiff_get(const std::optional<int64_t> &id, Pistache::Http::ResponseWriter &response) override;
|
||||
|
||||
@@ -1114,9 +1114,17 @@ void DefaultApi::image_buffer_image_jpeg_get_handler(const Pistache::Rest::Reque
|
||||
color = valueQuery_instance;
|
||||
}
|
||||
}
|
||||
auto showResEstQuery = request.query().get("show_res_est");
|
||||
std::optional<bool> showResEst;
|
||||
if(showResEstQuery.has_value()){
|
||||
bool valueQuery_instance;
|
||||
if(fromStringValue(showResEstQuery.value(), valueQuery_instance)){
|
||||
showResEst = valueQuery_instance;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
this->image_buffer_image_jpeg_get(id, showUserMask, showRoi, showSpots, showBeamCenter, saturation, jpegQuality, showResRing, color, response);
|
||||
this->image_buffer_image_jpeg_get(id, showUserMask, showRoi, showSpots, showBeamCenter, saturation, jpegQuality, showResRing, color, showResEst, response);
|
||||
} catch (Pistache::Http::HttpError &e) {
|
||||
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
||||
return;
|
||||
|
||||
@@ -462,11 +462,12 @@ private:
|
||||
/// <param name="showRoi">Show ROI areas on the image (optional, default to false)</param>
|
||||
/// <param name="showSpots">Show spot finding results on the image (optional, default to true)</param>
|
||||
/// <param name="showBeamCenter">Show beam center on the image (optional, default to true)</param>
|
||||
/// <param name="saturation">Saturation value to set contrast in the preview image (optional, default to 10.0f)</param>
|
||||
/// <param name="saturation">Saturation value to set contrast in the preview image; if not provided, then autocontrast procedure is used (optional, default to 0.0f)</param>
|
||||
/// <param name="jpegQuality">Quality of JPEG image (100 - highest; 0 - lowest) (optional, default to 100L)</param>
|
||||
/// <param name="showResRing">Show resolution ring, provided in Angstrom (optional, default to 0.1f)</param>
|
||||
/// <param name="color">Color scale for preview image: 0 - indigo, 1 - viridis, 2 - B/W, 3 - heat (optional, default to "indigo")</param>
|
||||
virtual void image_buffer_image_jpeg_get(const std::optional<int64_t> &id, const std::optional<bool> &showUserMask, const std::optional<bool> &showRoi, const std::optional<bool> &showSpots, const std::optional<bool> &showBeamCenter, const std::optional<float> &saturation, const std::optional<int64_t> &jpegQuality, const std::optional<float> &showResRing, const std::optional<std::string> &color, Pistache::Http::ResponseWriter &response) = 0;
|
||||
/// <param name="showResEst">Show resolution estimation as a ring (optional, default to false)</param>
|
||||
virtual void image_buffer_image_jpeg_get(const std::optional<int64_t> &id, const std::optional<bool> &showUserMask, const std::optional<bool> &showRoi, const std::optional<bool> &showSpots, const std::optional<bool> &showBeamCenter, const std::optional<float> &saturation, const std::optional<int64_t> &jpegQuality, const std::optional<float> &showResRing, const std::optional<std::string> &color, const std::optional<bool> &showResEst, Pistache::Http::ResponseWriter &response) = 0;
|
||||
/// <summary>
|
||||
/// Get preview image in TIFF format
|
||||
/// </summary>
|
||||
|
||||
+11
-2
@@ -143,16 +143,17 @@ components:
|
||||
saturation:
|
||||
in: query
|
||||
name: saturation
|
||||
required: false
|
||||
schema:
|
||||
type: number
|
||||
format: float
|
||||
default: 10
|
||||
minimum: -32767
|
||||
maximum: 32767
|
||||
description: "Saturation value to set contrast in the preview image"
|
||||
description: "Saturation value to set contrast in the preview image; if not provided, then autocontrast procedure is used"
|
||||
background:
|
||||
in: query
|
||||
name: background
|
||||
required: false
|
||||
schema:
|
||||
type: number
|
||||
format: float
|
||||
@@ -208,6 +209,13 @@ components:
|
||||
default: 0.1
|
||||
minimum: 0.1
|
||||
maximum: 100.0
|
||||
resolution_estimate:
|
||||
in: query
|
||||
name: show_res_est
|
||||
description: "Show resolution estimation as a ring"
|
||||
schema:
|
||||
type: boolean
|
||||
default: false
|
||||
color_scale:
|
||||
in: query
|
||||
name: color
|
||||
@@ -3166,6 +3174,7 @@ paths:
|
||||
- $ref: '#/components/parameters/jpeg_quality'
|
||||
- $ref: '#/components/parameters/resolution_ring'
|
||||
- $ref: '#/components/parameters/color_scale'
|
||||
- $ref: '#/components/parameters/resolution_estimate'
|
||||
responses:
|
||||
"200":
|
||||
description: Preview image
|
||||
|
||||
@@ -1351,14 +1351,16 @@ For still measurement the number is ignored</p>
|
||||
" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr"><p>Show spot finding results on the image</p>
|
||||
</div></div></div></td></tr><tr class=""><td kind="field" title="show_beam_center" class="sc-kCuUfV sc-fbQrwq gdmNWp dFOJWJ"><span class="sc-hwddKA cteAyA"></span><span class="property-name">show_beam_center</span></td><td class="sc-gGKoUb ixGaBD"><div><div><span class="sc-bEjUoa sc-boKDdR lhyyLL jYezsP"></span><span class="sc-bEjUoa sc-fOOuSg lhyyLL dbKJYq">boolean</span></div><div><span class="sc-bEjUoa lhyyLL"> <!-- -->Default:<!-- --> </span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">true</span></div> <div><div html="<p>Show beam center on the image</p>
|
||||
" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr"><p>Show beam center on the image</p>
|
||||
</div></div></div></td></tr><tr class=""><td kind="field" title="saturation" class="sc-kCuUfV sc-fbQrwq gdmNWp dFOJWJ"><span class="sc-hwddKA cteAyA"></span><span class="property-name">saturation</span></td><td class="sc-gGKoUb ixGaBD"><div><div><span class="sc-bEjUoa sc-boKDdR lhyyLL jYezsP"></span><span class="sc-bEjUoa sc-fOOuSg lhyyLL dbKJYq">number</span><span class="sc-bEjUoa sc-fOOuSg lhyyLL dbKJYq"> <!-- --><<!-- -->float<!-- -->><!-- --> </span><span> <span class="sc-bEjUoa sc-goiVcJ lhyyLL bDfgbe"> <!-- -->[ -32767 .. 32767 ]<!-- --> </span></span></div><div><span class="sc-bEjUoa lhyyLL"> <!-- -->Default:<!-- --> </span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">10</span></div> <div><div html="<p>Saturation value to set contrast in the preview image</p>
|
||||
" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr"><p>Saturation value to set contrast in the preview image</p>
|
||||
</div></div></div></td></tr><tr class=""><td kind="field" title="saturation" class="sc-kCuUfV sc-fbQrwq gdmNWp dFOJWJ"><span class="sc-hwddKA cteAyA"></span><span class="property-name">saturation</span></td><td class="sc-gGKoUb ixGaBD"><div><div><span class="sc-bEjUoa sc-boKDdR lhyyLL jYezsP"></span><span class="sc-bEjUoa sc-fOOuSg lhyyLL dbKJYq">number</span><span class="sc-bEjUoa sc-fOOuSg lhyyLL dbKJYq"> <!-- --><<!-- -->float<!-- -->><!-- --> </span><span> <span class="sc-bEjUoa sc-goiVcJ lhyyLL bDfgbe"> <!-- -->[ -32767 .. 32767 ]<!-- --> </span></span></div> <div><div html="<p>Saturation value to set contrast in the preview image; if not provided, then autocontrast procedure is used</p>
|
||||
" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr"><p>Saturation value to set contrast in the preview image; if not provided, then autocontrast procedure is used</p>
|
||||
</div></div></div></td></tr><tr class=""><td kind="field" title="jpeg_quality" class="sc-kCuUfV sc-fbQrwq gdmNWp dFOJWJ"><span class="sc-hwddKA cteAyA"></span><span class="property-name">jpeg_quality</span></td><td class="sc-gGKoUb ixGaBD"><div><div><span class="sc-bEjUoa sc-boKDdR lhyyLL jYezsP"></span><span class="sc-bEjUoa sc-fOOuSg lhyyLL dbKJYq">integer</span><span class="sc-bEjUoa sc-fOOuSg lhyyLL dbKJYq"> <!-- --><<!-- -->int64<!-- -->><!-- --> </span><span> <span class="sc-bEjUoa sc-goiVcJ lhyyLL bDfgbe"> <!-- -->[ 0 .. 100 ]<!-- --> </span></span></div><div><span class="sc-bEjUoa lhyyLL"> <!-- -->Default:<!-- --> </span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">100</span></div> <div><div html="<p>Quality of JPEG image (100 - highest; 0 - lowest)</p>
|
||||
" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr"><p>Quality of JPEG image (100 - highest; 0 - lowest)</p>
|
||||
</div></div></div></td></tr><tr class=""><td kind="field" title="show_res_ring" class="sc-kCuUfV sc-fbQrwq gdmNWp dFOJWJ"><span class="sc-hwddKA cteAyA"></span><span class="property-name">show_res_ring</span></td><td class="sc-gGKoUb ixGaBD"><div><div><span class="sc-bEjUoa sc-boKDdR lhyyLL jYezsP"></span><span class="sc-bEjUoa sc-fOOuSg lhyyLL dbKJYq">number</span><span class="sc-bEjUoa sc-fOOuSg lhyyLL dbKJYq"> <!-- --><<!-- -->float<!-- -->><!-- --> </span><span> <span class="sc-bEjUoa sc-goiVcJ lhyyLL bDfgbe"> <!-- -->[ 0.1 .. 100 ]<!-- --> </span></span></div><div><span class="sc-bEjUoa lhyyLL"> <!-- -->Default:<!-- --> </span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">0.1</span></div> <div><div html="<p>Show resolution ring, provided in Angstrom</p>
|
||||
" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr"><p>Show resolution ring, provided in Angstrom</p>
|
||||
</div></div></div></td></tr><tr class="last "><td kind="field" title="color" class="sc-kCuUfV sc-fbQrwq gdmNWp dFOJWJ"><span class="sc-hwddKA cteAyA"></span><span class="property-name">color</span></td><td class="sc-gGKoUb ixGaBD"><div><div><span class="sc-bEjUoa sc-boKDdR lhyyLL jYezsP"></span><span class="sc-bEjUoa sc-fOOuSg lhyyLL dbKJYq">string</span></div><div><span class="sc-bEjUoa lhyyLL"> <!-- -->Default:<!-- --> </span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">"indigo"</span></div><div><span class="sc-bEjUoa lhyyLL"> <!-- -->Enum<!-- -->:</span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">"indigo"</span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">"viridis"</span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">"bw"</span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">"heat"</span> </div> <div><div html="<p>Color scale for preview image: 0 - indigo, 1 - viridis, 2 - B/W, 3 - heat</p>
|
||||
</div></div></div></td></tr><tr class=""><td kind="field" title="color" class="sc-kCuUfV sc-fbQrwq gdmNWp dFOJWJ"><span class="sc-hwddKA cteAyA"></span><span class="property-name">color</span></td><td class="sc-gGKoUb ixGaBD"><div><div><span class="sc-bEjUoa sc-boKDdR lhyyLL jYezsP"></span><span class="sc-bEjUoa sc-fOOuSg lhyyLL dbKJYq">string</span></div><div><span class="sc-bEjUoa lhyyLL"> <!-- -->Default:<!-- --> </span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">"indigo"</span></div><div><span class="sc-bEjUoa lhyyLL"> <!-- -->Enum<!-- -->:</span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">"indigo"</span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">"viridis"</span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">"bw"</span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">"heat"</span> </div> <div><div html="<p>Color scale for preview image: 0 - indigo, 1 - viridis, 2 - B/W, 3 - heat</p>
|
||||
" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr"><p>Color scale for preview image: 0 - indigo, 1 - viridis, 2 - B/W, 3 - heat</p>
|
||||
</div></div></div></td></tr><tr class="last "><td kind="field" title="show_res_est" class="sc-kCuUfV sc-fbQrwq gdmNWp dFOJWJ"><span class="sc-hwddKA cteAyA"></span><span class="property-name">show_res_est</span></td><td class="sc-gGKoUb ixGaBD"><div><div><span class="sc-bEjUoa sc-boKDdR lhyyLL jYezsP"></span><span class="sc-bEjUoa sc-fOOuSg lhyyLL dbKJYq">boolean</span></div><div><span class="sc-bEjUoa lhyyLL"> <!-- -->Default:<!-- --> </span> <span class="sc-bEjUoa sc-dTWiOz lhyyLL kMQdIk">false</span></div> <div><div html="<p>Show resolution estimation as a ring</p>
|
||||
" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr"><p>Show resolution estimation as a ring</p>
|
||||
</div></div></div></td></tr></tbody></table></div><div><h3 class="sc-gDzyrw kjrVcG">Responses</h3><div><button class="sc-jIDBmd lkmdtA"><svg class="sc-dntSTA cGxVlA" version="1.1" viewBox="0 0 24 24" x="0" xmlns="http://www.w3.org/2000/svg" y="0" aria-hidden="true"><polygon points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 "></polygon></svg><strong class="sc-eJvlPh fBhAXU">200<!-- --> </strong><div html="<p>Preview image</p>
|
||||
" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG"><p>Preview image</p>
|
||||
</div></button></div><div><button class="sc-jIDBmd ifAHvq"><svg class="sc-dntSTA jKYZgc" version="1.1" viewBox="0 0 24 24" x="0" xmlns="http://www.w3.org/2000/svg" y="0" aria-hidden="true"><polygon points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 "></polygon></svg><strong class="sc-eJvlPh fBhAXU">400<!-- --> </strong><div html="<p>Input parsing or validation error</p>
|
||||
@@ -1403,7 +1405,7 @@ then image might be replaced in the buffer between calling /images and /image.cb
|
||||
" class="sc-eVqvcJ sc-fszimp kIppRw drqpJr"><p>Test Jungfraujoch system</p>
|
||||
</div><div tabindex="0" role="button"><div class="sc-xKhEK okJpy"><span>http://localhost:5232</span>/version</div></div></div></div></div></div></div></div></div><div class="sc-evkzZa iZqpqg"></div></div></div>
|
||||
<script>
|
||||
const __redoc_state = {"menu":{"activeItemIdx":-1},"spec":{"data":{"openapi":"3.0.3","info":{"title":"Jungfraujoch","description":"API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland).\nJungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU.\nJungfraujoch uses FPGA boards to acquire data at high data rates.\n\n# License Clarification\n\nWhile this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply**\nwhen this file is used solely to generate OpenAPI clients or when implementing applications that\ninteract with the API. Generated client code and applications using this API definition are not\nsubject to the GPL license requirements and may be distributed under terms of your choosing.\n\nThis exception is similar in spirit to the Linux Kernel's approach to userspace API headers and\nthe GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that\nuser programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not\nderivative works of the kernel and are not subject to the terms of the GPL.\n\nThis exception is intended to allow wider use of this API specification without imposing GPL\nrequirements on applications that merely interact with the API, regardless of whether they\ncommunicate through network calls or other mechanisms.\n","version":"1.0.0-rc.110","contact":{"name":"Filip Leonarski (Paul Scherrer Institute)","email":"filip.leonarski@psi.ch"},"license":{"name":"GPL-3.0","url":"https://www.gnu.org/licenses/gpl-3.0.html"}},"servers":[{"url":"http://localhost:5232","description":"Test Jungfraujoch system"}],"components":{"parameters":{"binning":{"in":"query","name":"binning","required":false,"schema":{"type":"integer"},"description":"Binning of frames for the plot (0 = default binning)"},"compression":{"in":"query","name":"compression","required":false,"schema":{"type":"boolean","default":false},"description":"Enable DEFLATE compression of output data."},"experimental_coord":{"in":"query","name":"experimental_coord","required":false,"schema":{"type":"boolean","default":false},"description":"If measurement has goniometer axis defined, plot X-axis will represent rotation angle\nIf measurement has grid scan defined, plot X-axis and Y-axis will represent grid position, Z will be used as the final value\nFor still measurement the number is ignored\n"},"azint_unit":{"in":"query","name":"azint_unit","required":false,"schema":{"type":"string","enum":["Q_recipA","d_A","two_theta_deg"],"default":"Q_recipA"},"description":"Unit used for azim int.\n"},"fill_value":{"in":"query","name":"fill","required":false,"schema":{"type":"number","format":"float"},"description":"Fill value for elements that were missed during data collection\n"},"plot_type":{"in":"query","name":"type","required":true,"description":"Type of requested plot","schema":{"type":"string","enum":["bkg_estimate","azint","azint_1d","spot_count","spot_count_low_res","spot_count_indexed","spot_count_ice","indexing_rate","indexing_time","indexing_unit_cell_length","indexing_unit_cell_angle","profile_radius","b_factor","error_pixels","saturated_pixels","image_collection_efficiency","receiver_delay","receiver_free_send_buf","strong_pixels","roi_sum","roi_mean","roi_max_count","roi_pixels","roi_weighted_x","roi_weighted_y","packets_received","max_pixel_value","resolution_estimate","pixel_sum","processing_time","beam_center_x","beam_center_y"]}},"roi":{"in":"query","name":"roi","required":false,"schema":{"type":"string","minLength":1},"description":"Name of ROI for which plot is requested"},"image_id":{"in":"query","name":"id","required":false,"schema":{"type":"integer","format":"int64","default":-1,"minimum":-2},"description":"Image ID in the image buffer. Special values: -1 - last image in the buffer, -2: last indexed image in the buffer"},"saturation":{"in":"query","name":"saturation","schema":{"type":"number","format":"float","default":10,"minimum":-32767,"maximum":32767},"description":"Saturation value to set contrast in the preview image"},"background":{"in":"query","name":"background","schema":{"type":"number","format":"float","default":0,"minimum":-32767,"maximum":32767},"description":"Background value to set contrast in the preview image"},"show_spots":{"in":"query","name":"show_spots","schema":{"type":"boolean","default":true},"description":"Show spot finding results on the image"},"show_beam_center":{"in":"query","name":"show_beam_center","schema":{"type":"boolean","default":true},"description":"Show beam center on the image"},"show_roi":{"in":"query","name":"show_roi","schema":{"type":"boolean","default":false},"description":"Show ROI areas on the image"},"jpeg_quality":{"in":"query","name":"jpeg_quality","description":"Quality of JPEG image (100 - highest; 0 - lowest)","schema":{"type":"integer","format":"int64","default":100,"minimum":0,"maximum":100}},"show_user_mask":{"in":"qLine truncated
|
||||
const __redoc_state = {"menu":{"activeItemIdx":-1},"spec":{"data":{"openapi":"3.0.3","info":{"title":"Jungfraujoch","description":"API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland).\nJungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU.\nJungfraujoch uses FPGA boards to acquire data at high data rates.\n\n# License Clarification\n\nWhile this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply**\nwhen this file is used solely to generate OpenAPI clients or when implementing applications that\ninteract with the API. Generated client code and applications using this API definition are not\nsubject to the GPL license requirements and may be distributed under terms of your choosing.\n\nThis exception is similar in spirit to the Linux Kernel's approach to userspace API headers and\nthe GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that\nuser programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not\nderivative works of the kernel and are not subject to the terms of the GPL.\n\nThis exception is intended to allow wider use of this API specification without imposing GPL\nrequirements on applications that merely interact with the API, regardless of whether they\ncommunicate through network calls or other mechanisms.\n","version":"1.0.0-rc.110","contact":{"name":"Filip Leonarski (Paul Scherrer Institute)","email":"filip.leonarski@psi.ch"},"license":{"name":"GPL-3.0","url":"https://www.gnu.org/licenses/gpl-3.0.html"}},"servers":[{"url":"http://localhost:5232","description":"Test Jungfraujoch system"}],"components":{"parameters":{"binning":{"in":"query","name":"binning","required":false,"schema":{"type":"integer"},"description":"Binning of frames for the plot (0 = default binning)"},"compression":{"in":"query","name":"compression","required":false,"schema":{"type":"boolean","default":false},"description":"Enable DEFLATE compression of output data."},"experimental_coord":{"in":"query","name":"experimental_coord","required":false,"schema":{"type":"boolean","default":false},"description":"If measurement has goniometer axis defined, plot X-axis will represent rotation angle\nIf measurement has grid scan defined, plot X-axis and Y-axis will represent grid position, Z will be used as the final value\nFor still measurement the number is ignored\n"},"azint_unit":{"in":"query","name":"azint_unit","required":false,"schema":{"type":"string","enum":["Q_recipA","d_A","two_theta_deg"],"default":"Q_recipA"},"description":"Unit used for azim int.\n"},"fill_value":{"in":"query","name":"fill","required":false,"schema":{"type":"number","format":"float"},"description":"Fill value for elements that were missed during data collection\n"},"plot_type":{"in":"query","name":"type","required":true,"description":"Type of requested plot","schema":{"type":"string","enum":["bkg_estimate","azint","azint_1d","spot_count","spot_count_low_res","spot_count_indexed","spot_count_ice","indexing_rate","indexing_time","indexing_unit_cell_length","indexing_unit_cell_angle","profile_radius","b_factor","error_pixels","saturated_pixels","image_collection_efficiency","receiver_delay","receiver_free_send_buf","strong_pixels","roi_sum","roi_mean","roi_max_count","roi_pixels","roi_weighted_x","roi_weighted_y","packets_received","max_pixel_value","resolution_estimate","pixel_sum","processing_time","beam_center_x","beam_center_y"]}},"roi":{"in":"query","name":"roi","required":false,"schema":{"type":"string","minLength":1},"description":"Name of ROI for which plot is requested"},"image_id":{"in":"query","name":"id","required":false,"schema":{"type":"integer","format":"int64","default":-1,"minimum":-2},"description":"Image ID in the image buffer. Special values: -1 - last image in the buffer, -2: last indexed image in the buffer"},"saturation":{"in":"query","name":"saturation","required":false,"schema":{"type":"number","format":"float","minimum":-32767,"maximum":32767},"description":"Saturation value to set contrast in the preview image; if not provided, then autocontrast procedure is used"},"background":{"in":"query","name":"background","required":false,"schema":{"type":"number","format":"float","default":0,"minimum":-32767,"maximum":32767},"description":"Background value to set contrast in the preview image"},"show_spots":{"in":"query","name":"show_spots","schema":{"type":"boolean","default":true},"description":"Show spot finding results on the image"},"show_beam_center":{"in":"query","name":"show_beam_center","schema":{"type":"boolean","default":true},"description":"Show beam center on the image"},"show_roi":{"in":"query","name":"show_roi","schema":{"type":"boolean","default":false},"description":"Show ROI areas on the image"},"jpeg_quality":{"in":"query","name":"jpeg_quality","description":"Quality of JPEG image (100 - highest; 0 - lowest)","schema":{"type":"integer","format":Line truncated
|
||||
|
||||
var container = document.getElementById('redoc');
|
||||
Redoc.hydrate(__redoc_state, container);
|
||||
|
||||
@@ -2665,7 +2665,7 @@ No authorization required
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **image_buffer_image_jpeg_get**
|
||||
> bytearray image_buffer_image_jpeg_get(id=id, show_user_mask=show_user_mask, show_roi=show_roi, show_spots=show_spots, show_beam_center=show_beam_center, saturation=saturation, jpeg_quality=jpeg_quality, show_res_ring=show_res_ring, color=color)
|
||||
> bytearray image_buffer_image_jpeg_get(id=id, show_user_mask=show_user_mask, show_roi=show_roi, show_spots=show_spots, show_beam_center=show_beam_center, saturation=saturation, jpeg_quality=jpeg_quality, show_res_ring=show_res_ring, color=color, show_res_est=show_res_est)
|
||||
|
||||
Get preview image in JPEG format using custom settings
|
||||
|
||||
@@ -2693,14 +2693,15 @@ with jfjoch_client.ApiClient(configuration) as api_client:
|
||||
show_roi = False # bool | Show ROI areas on the image (optional) (default to False)
|
||||
show_spots = True # bool | Show spot finding results on the image (optional) (default to True)
|
||||
show_beam_center = True # bool | Show beam center on the image (optional) (default to True)
|
||||
saturation = 10 # float | Saturation value to set contrast in the preview image (optional) (default to 10)
|
||||
saturation = 3.4 # float | Saturation value to set contrast in the preview image; if not provided, then autocontrast procedure is used (optional)
|
||||
jpeg_quality = 100 # int | Quality of JPEG image (100 - highest; 0 - lowest) (optional) (default to 100)
|
||||
show_res_ring = 0.1 # float | Show resolution ring, provided in Angstrom (optional) (default to 0.1)
|
||||
color = indigo # str | Color scale for preview image: 0 - indigo, 1 - viridis, 2 - B/W, 3 - heat (optional) (default to indigo)
|
||||
show_res_est = False # bool | Show resolution estimation as a ring (optional) (default to False)
|
||||
|
||||
try:
|
||||
# Get preview image in JPEG format using custom settings
|
||||
api_response = api_instance.image_buffer_image_jpeg_get(id=id, show_user_mask=show_user_mask, show_roi=show_roi, show_spots=show_spots, show_beam_center=show_beam_center, saturation=saturation, jpeg_quality=jpeg_quality, show_res_ring=show_res_ring, color=color)
|
||||
api_response = api_instance.image_buffer_image_jpeg_get(id=id, show_user_mask=show_user_mask, show_roi=show_roi, show_spots=show_spots, show_beam_center=show_beam_center, saturation=saturation, jpeg_quality=jpeg_quality, show_res_ring=show_res_ring, color=color, show_res_est=show_res_est)
|
||||
print("The response of DefaultApi->image_buffer_image_jpeg_get:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
@@ -2719,10 +2720,11 @@ Name | Type | Description | Notes
|
||||
**show_roi** | **bool**| Show ROI areas on the image | [optional] [default to False]
|
||||
**show_spots** | **bool**| Show spot finding results on the image | [optional] [default to True]
|
||||
**show_beam_center** | **bool**| Show beam center on the image | [optional] [default to True]
|
||||
**saturation** | **float**| Saturation value to set contrast in the preview image | [optional] [default to 10]
|
||||
**saturation** | **float**| Saturation value to set contrast in the preview image; if not provided, then autocontrast procedure is used | [optional]
|
||||
**jpeg_quality** | **int**| Quality of JPEG image (100 - highest; 0 - lowest) | [optional] [default to 100]
|
||||
**show_res_ring** | **float**| Show resolution ring, provided in Angstrom | [optional] [default to 0.1]
|
||||
**color** | **str**| Color scale for preview image: 0 - indigo, 1 - viridis, 2 - B/W, 3 - heat | [optional] [default to indigo]
|
||||
**show_res_est** | **bool**| Show resolution estimation as a ring | [optional] [default to False]
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "jungfraujoch-frontend",
|
||||
"version": "1.0.0-rc.109",
|
||||
"version": "1.0.0-rc.110",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "jungfraujoch-frontend",
|
||||
"version": "1.0.0-rc.109",
|
||||
"version": "1.0.0-rc.110",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.10.4",
|
||||
|
||||
@@ -54,6 +54,7 @@ export type { plot } from './models/plot';
|
||||
export { plot_type } from './models/plot_type';
|
||||
export { plot_unit_x } from './models/plot_unit_x';
|
||||
export type { plots } from './models/plots';
|
||||
export type { resolution_estimate } from './models/resolution_estimate';
|
||||
export type { resolution_ring } from './models/resolution_ring';
|
||||
export type { roi } from './models/roi';
|
||||
export type { roi_azim_list } from './models/roi_azim_list';
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/* generated using openapi-typescript-codegen -- do no edit */
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
/**
|
||||
* Show resolution estimation as a ring
|
||||
*/
|
||||
export type resolution_estimate = boolean;
|
||||
@@ -4,6 +4,6 @@
|
||||
/* eslint-disable */
|
||||
|
||||
/**
|
||||
* Saturation value to set contrast in the preview image
|
||||
* Saturation value to set contrast in the preview image; if not provided, then autocontrast procedure is used
|
||||
*/
|
||||
export type saturation = number;
|
||||
@@ -1078,10 +1078,11 @@ export class DefaultService {
|
||||
* @param showRoi Show ROI areas on the image
|
||||
* @param showSpots Show spot finding results on the image
|
||||
* @param showBeamCenter Show beam center on the image
|
||||
* @param saturation Saturation value to set contrast in the preview image
|
||||
* @param saturation Saturation value to set contrast in the preview image; if not provided, then autocontrast procedure is used
|
||||
* @param jpegQuality Quality of JPEG image (100 - highest; 0 - lowest)
|
||||
* @param showResRing Show resolution ring, provided in Angstrom
|
||||
* @param color Color scale for preview image: 0 - indigo, 1 - viridis, 2 - B/W, 3 - heat
|
||||
* @param showResEst Show resolution estimation as a ring
|
||||
* @returns binary Preview image
|
||||
* @throws ApiError
|
||||
*/
|
||||
@@ -1091,10 +1092,11 @@ export class DefaultService {
|
||||
showRoi: boolean = false,
|
||||
showSpots: boolean = true,
|
||||
showBeamCenter: boolean = true,
|
||||
saturation: number = 10,
|
||||
saturation?: number,
|
||||
jpegQuality: number = 100,
|
||||
showResRing: number = 0.1,
|
||||
color: 'indigo' | 'viridis' | 'bw' | 'heat' = 'indigo',
|
||||
showResEst: boolean = false,
|
||||
): CancelablePromise<Blob> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
@@ -1109,6 +1111,7 @@ export class DefaultService {
|
||||
'jpeg_quality': jpegQuality,
|
||||
'show_res_ring': showResRing,
|
||||
'color': color,
|
||||
'show_res_est': showResEst,
|
||||
},
|
||||
errors: {
|
||||
400: `Input parsing or validation error`,
|
||||
|
||||
+42
-10
@@ -48,14 +48,46 @@ void PreviewImage::roi(std::vector<rgb> &ret, int64_t in_xpixel, int64_t in_ypix
|
||||
}
|
||||
|
||||
template<class T>
|
||||
std::vector<rgb> PreviewImage::GenerateRGB(const uint8_t* value_8,
|
||||
std::vector<rgb> PreviewImage::GenerateRGB(const uint8_t *value_8,
|
||||
int64_t special_value_64,
|
||||
int64_t sat_value_64,
|
||||
const ColorScale &scale,
|
||||
const PreviewImageSettings& settings) const {
|
||||
const PreviewImageSettings &settings) const {
|
||||
auto value = reinterpret_cast<const T *>(value_8);
|
||||
auto special_value = static_cast<T>(special_value_64);
|
||||
|
||||
std::vector<rgb> ret(xpixel*ypixel);
|
||||
float background = settings.background_value.value_or(0.0);
|
||||
float foreground;
|
||||
if (settings.saturation_value.has_value())
|
||||
foreground = settings.saturation_value.value();
|
||||
else {
|
||||
// Auto-contrast procedure
|
||||
std::vector<int64_t> valid;
|
||||
valid.reserve(xpixel * ypixel);
|
||||
for (int i = 0; i < xpixel * ypixel; i++) {
|
||||
if ((value[i] != special_value)
|
||||
&& (value[i] != sat_value_64)
|
||||
&& (mask[i] != MaskDet)
|
||||
&& (mask[i] != MaskGap)
|
||||
&& (!settings.show_user_mask || (mask[i] != MaskUsr)))
|
||||
valid.push_back(static_cast<int64_t>(value[i]));
|
||||
}
|
||||
|
||||
if (!valid.empty()) {
|
||||
const size_t m = valid.size();
|
||||
size_t ignore = std::max<size_t>(1, static_cast<size_t>(std::floor(m * auto_foreground_range)));
|
||||
if (ignore >= m) ignore = m - 1; // ensure at least one value remains
|
||||
const size_t rank = m - ignore - 1; // 0-based index for the desired value
|
||||
std::nth_element(valid.begin(), valid.begin() + rank, valid.end());
|
||||
foreground = static_cast<float>(valid[rank]);
|
||||
} else {
|
||||
// Fallback to something above background if no valid pixels remain
|
||||
foreground = background + 1.0f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::vector<rgb> ret(xpixel * ypixel);
|
||||
for (int i = 0; i < xpixel*ypixel; i++) {
|
||||
if (mask[i] == MaskGap)
|
||||
ret[i] = scale.Apply(ColorScaleSpecial::Gap);
|
||||
@@ -64,7 +96,7 @@ std::vector<rgb> PreviewImage::GenerateRGB(const uint8_t* value_8,
|
||||
|| (settings.show_user_mask && (mask[i] == MaskUsr))) {
|
||||
ret[i] = scale.Apply(ColorScaleSpecial::BadPixel);
|
||||
} else
|
||||
ret[i] = scale.Apply(value[i], 0.0, settings.saturation_value);;
|
||||
ret[i] = scale.Apply(value[i], background, foreground);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -214,22 +246,22 @@ std::vector<rgb> PreviewImage::GenerateRGB(const PreviewImageSettings &settings,
|
||||
|
||||
switch (msg.image.GetMode()) {
|
||||
case CompressedImageMode::Int8:
|
||||
v = GenerateRGB<int8_t>(image_ptr, INT8_MIN, scale, settings);
|
||||
v = GenerateRGB<int8_t>(image_ptr, INT8_MIN, INT8_MAX, scale, settings);
|
||||
break;
|
||||
case CompressedImageMode::Int16:
|
||||
v = GenerateRGB<int16_t>(image_ptr, INT16_MIN, scale, settings);
|
||||
v = GenerateRGB<int16_t>(image_ptr, INT16_MIN, INT16_MAX, scale, settings);
|
||||
break;
|
||||
case CompressedImageMode::Int32:
|
||||
v = GenerateRGB<int32_t>(image_ptr, INT32_MIN, scale, settings);
|
||||
v = GenerateRGB<int32_t>(image_ptr, INT32_MIN, INT32_MAX, scale, settings);
|
||||
break;
|
||||
case CompressedImageMode::Uint8:
|
||||
v = GenerateRGB<uint8_t>(image_ptr,UINT8_MAX, scale, settings);
|
||||
v = GenerateRGB<uint8_t>(image_ptr,UINT8_MAX, UINT8_MAX, scale, settings);
|
||||
break;
|
||||
case CompressedImageMode::Uint16:
|
||||
v = GenerateRGB<uint16_t>(image_ptr,UINT16_MAX, scale, settings);
|
||||
v = GenerateRGB<uint16_t>(image_ptr,UINT16_MAX, UINT16_MAX, scale, settings);
|
||||
break;
|
||||
case CompressedImageMode::Uint32:
|
||||
v = GenerateRGB<uint32_t>(image_ptr,UINT16_MAX, scale, settings);
|
||||
v = GenerateRGB<uint32_t>(image_ptr,UINT32_MAX, UINT32_MAX, scale, settings);
|
||||
break;
|
||||
default:
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Mode not supported");
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
enum class PreviewImageFormat {JPEG, TIFF};
|
||||
|
||||
struct PreviewImageSettings {
|
||||
float saturation_value = 10;
|
||||
std::optional<float> saturation_value = 10;
|
||||
std::optional<float> background_value = 0;
|
||||
int64_t jpeg_quality = 70;
|
||||
bool show_beam_center = true;
|
||||
bool show_spots = true;
|
||||
@@ -46,9 +47,12 @@ class PreviewImage {
|
||||
constexpr static uint8_t MaskUsr = 2;
|
||||
constexpr static uint8_t MaskDet = 3;
|
||||
|
||||
constexpr static float auto_foreground_range = 0.001f;
|
||||
|
||||
template<class T>
|
||||
std::vector<rgb> GenerateRGB(const uint8_t* value,
|
||||
int64_t special_value,
|
||||
int64_t sat_value,
|
||||
const ColorScale &scale,
|
||||
const PreviewImageSettings& settings) const;
|
||||
std::vector<rgb> GenerateRGB(const PreviewImageSettings& settings, const DataMessage &msg) const;
|
||||
|
||||
@@ -995,7 +995,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_lysozyme_spot_and_index_32", "[JFJochReceiv
|
||||
|
||||
std::string jpeg;
|
||||
PreviewImageSettings jpeg_settings{
|
||||
.saturation_value = 10,
|
||||
.jpeg_quality = 100,
|
||||
.show_spots = true
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user