diff --git a/CMakeLists.txt b/CMakeLists.txt index 59b2578a..9eae92be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,12 +47,6 @@ SET(lzma OFF) SET(jpeg OFF) SET(old-jpeg OFF) -# PNG -set(PNG_SHARED OFF) -set(PNG_STATIC ON) -set(PNG_EXECUTABLES OFF) -set(PNG_TESTS OFF) - INCLUDE(CheckLanguage) INCLUDE(CheckIncludeFile) CHECK_LANGUAGE(CUDA) @@ -99,13 +93,6 @@ FetchContent_Declare(tiff GIT_TAG v4.6.0 EXCLUDE_FROM_ALL) -FetchContent_Declare( - png - GIT_REPOSITORY https://github.com/pnggroup/libpng - GIT_TAG v1.6.49 - EXCLUDE_FROM_ALL -) - FetchContent_Declare(hdf5 GIT_REPOSITORY https://github.com/HDFGroup/hdf5/ GIT_TAG hdf5_1.14.5 @@ -149,7 +136,7 @@ FetchContent_Declare( EXCLUDE_FROM_ALL ) -FetchContent_MakeAvailable(pistache_http zstd sls_detector_package catch2 hdf5 tiff png) +FetchContent_MakeAvailable(pistache_http zstd sls_detector_package catch2 hdf5 tiff) ADD_SUBDIRECTORY(jungfrau) ADD_SUBDIRECTORY(compression) diff --git a/broker/JFJochBrokerHttp.cpp b/broker/JFJochBrokerHttp.cpp index e0d9b20f..3816efbe 100644 --- a/broker/JFJochBrokerHttp.cpp +++ b/broker/JFJochBrokerHttp.cpp @@ -497,35 +497,6 @@ void JFJochBrokerHttp::image_buffer_image_jpeg_get(const std::optional response.send(Pistache::Http::Code::Not_Found); } -void JFJochBrokerHttp::image_buffer_image_png_get(const std::optional &id, - const std::optional &showUserMask, - const std::optional &showRoi, - const std::optional &showSpots, - const std::optional &showBeamCenter, - const std::optional &saturation, - const std::optional &jpegQuality, - const std::optional &showResRing, - const std::optional &color, - Pistache::Http::ResponseWriter &response) { - int64_t image_id = id.value_or(ImageBuffer::MaxImage); - PreviewImageSettings settings{}; - - 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.jpeg_quality = jpegQuality.value_or(100); - settings.resolution_ring = showResRing; - settings.scale = ConvertColorScale(color); - settings.show_beam_center = showBeamCenter.value_or(true); - settings.format = PreviewImageFormat::PNG; - std::string s = state_machine.GetPreviewJPEG(settings, image_id); - if (!s.empty()) - response.send(Pistache::Http::Code::Ok, s, Pistache::Http::Mime::MediaType::fromString("image/jpeg")); - else - response.send(Pistache::Http::Code::Not_Found); -} - void JFJochBrokerHttp::image_buffer_image_tiff_get(const std::optional &id, Pistache::Http::ResponseWriter &response) { int64_t image_id = ImageBuffer::MaxImage; diff --git a/broker/JFJochBrokerHttp.h b/broker/JFJochBrokerHttp.h index 43e21ae0..74e5b776 100644 --- a/broker/JFJochBrokerHttp.h +++ b/broker/JFJochBrokerHttp.h @@ -157,16 +157,6 @@ class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi { const std::optional &showResRing, const std::optional &color, Pistache::Http::ResponseWriter &response) override; - void image_buffer_image_png_get(const std::optional &id, - const std::optional &showUserMask, - const std::optional &showRoi, - const std::optional &showSpots, - const std::optional &showBeamCenter, - const std::optional &saturation, - const std::optional &jpegQuality, - const std::optional &showResRing, - const std::optional &color, - Pistache::Http::ResponseWriter &response) override; void image_buffer_image_tiff_get(const std::optional &id, Pistache::Http::ResponseWriter &response) override; diff --git a/broker/gen/api/DefaultApi.cpp b/broker/gen/api/DefaultApi.cpp index bc04315d..f98fad6c 100644 --- a/broker/gen/api/DefaultApi.cpp +++ b/broker/gen/api/DefaultApi.cpp @@ -72,7 +72,6 @@ void DefaultApi::setupRoutes() { Routes::Post(*router, base + "/image_buffer/clear", Routes::bind(&DefaultApi::image_buffer_clear_post_handler, this)); Routes::Get(*router, base + "/image_buffer/image.cbor", Routes::bind(&DefaultApi::image_buffer_image_cbor_get_handler, this)); Routes::Get(*router, base + "/image_buffer/image.jpeg", Routes::bind(&DefaultApi::image_buffer_image_jpeg_get_handler, this)); - Routes::Get(*router, base + "/image_buffer/image.png", Routes::bind(&DefaultApi::image_buffer_image_png_get_handler, this)); Routes::Get(*router, base + "/image_buffer/image.tiff", Routes::bind(&DefaultApi::image_buffer_image_tiff_get_handler, this)); Routes::Get(*router, base + "/image_buffer/start.cbor", Routes::bind(&DefaultApi::image_buffer_start_cbor_get_handler, this)); Routes::Get(*router, base + "/image_buffer/status", Routes::bind(&DefaultApi::image_buffer_status_get_handler, this)); @@ -1078,99 +1077,6 @@ void DefaultApi::image_buffer_image_jpeg_get_handler(const Pistache::Rest::Reque response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } -} -void DefaultApi::image_buffer_image_png_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { - try { - - - // Getting the query params - auto idQuery = request.query().get("id"); - std::optional id; - if(idQuery.has_value()){ - int64_t valueQuery_instance; - if(fromStringValue(idQuery.value(), valueQuery_instance)){ - id = valueQuery_instance; - } - } - auto showUserMaskQuery = request.query().get("show_user_mask"); - std::optional showUserMask; - if(showUserMaskQuery.has_value()){ - bool valueQuery_instance; - if(fromStringValue(showUserMaskQuery.value(), valueQuery_instance)){ - showUserMask = valueQuery_instance; - } - } - auto showRoiQuery = request.query().get("show_roi"); - std::optional showRoi; - if(showRoiQuery.has_value()){ - bool valueQuery_instance; - if(fromStringValue(showRoiQuery.value(), valueQuery_instance)){ - showRoi = valueQuery_instance; - } - } - auto showSpotsQuery = request.query().get("show_spots"); - std::optional showSpots; - if(showSpotsQuery.has_value()){ - bool valueQuery_instance; - if(fromStringValue(showSpotsQuery.value(), valueQuery_instance)){ - showSpots = valueQuery_instance; - } - } - auto showBeamCenterQuery = request.query().get("show_beam_center"); - std::optional showBeamCenter; - if(showBeamCenterQuery.has_value()){ - bool valueQuery_instance; - if(fromStringValue(showBeamCenterQuery.value(), valueQuery_instance)){ - showBeamCenter = valueQuery_instance; - } - } - auto saturationQuery = request.query().get("saturation"); - std::optional saturation; - if(saturationQuery.has_value()){ - float valueQuery_instance; - if(fromStringValue(saturationQuery.value(), valueQuery_instance)){ - saturation = valueQuery_instance; - } - } - auto jpegQualityQuery = request.query().get("jpeg_quality"); - std::optional jpegQuality; - if(jpegQualityQuery.has_value()){ - int64_t valueQuery_instance; - if(fromStringValue(jpegQualityQuery.value(), valueQuery_instance)){ - jpegQuality = valueQuery_instance; - } - } - auto showResRingQuery = request.query().get("show_res_ring"); - std::optional showResRing; - if(showResRingQuery.has_value()){ - float valueQuery_instance; - if(fromStringValue(showResRingQuery.value(), valueQuery_instance)){ - showResRing = valueQuery_instance; - } - } - auto colorQuery = request.query().get("color"); - std::optional color; - if(colorQuery.has_value()){ - std::string valueQuery_instance; - if(fromStringValue(colorQuery.value(), valueQuery_instance)){ - color = valueQuery_instance; - } - } - - try { - this->image_buffer_image_png_get(id, showUserMask, showRoi, showSpots, showBeamCenter, saturation, jpegQuality, showResRing, color, response); - } catch (Pistache::Http::HttpError &e) { - response.send(static_cast(e.code()), e.what()); - return; - } catch (std::exception &e) { - this->handleOperationException(e, response); - return; - } - - } catch (std::exception &e) { - response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); - } - } void DefaultApi::image_buffer_image_tiff_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { diff --git a/broker/gen/api/DefaultApi.h b/broker/gen/api/DefaultApi.h index 076ee5ac..624ee666 100644 --- a/broker/gen/api/DefaultApi.h +++ b/broker/gen/api/DefaultApi.h @@ -107,7 +107,6 @@ private: void image_buffer_clear_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void image_buffer_image_cbor_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void image_buffer_image_jpeg_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - void image_buffer_image_png_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void image_buffer_image_tiff_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void image_buffer_start_cbor_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void image_buffer_status_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); @@ -451,22 +450,6 @@ private: /// Color scale for preview image: 0 - indigo, 1 - viridis, 2 - B/W, 3 - heat (optional, default to "indigo") virtual void image_buffer_image_jpeg_get(const std::optional &id, const std::optional &showUserMask, const std::optional &showRoi, const std::optional &showSpots, const std::optional &showBeamCenter, const std::optional &saturation, const std::optional &jpegQuality, const std::optional &showResRing, const std::optional &color, Pistache::Http::ResponseWriter &response) = 0; /// - /// Get preview image in PNG format using custom settings - /// - /// - /// - /// - /// Image ID in the image buffer. Special values: -1 - last image in the buffer, -2: last indexed image in the buffer (optional, default to -1L) - /// Show user mask (optional, default to false) - /// Show ROI areas on the image (optional, default to false) - /// Show spot finding results on the image (optional, default to true) - /// Show beam center on the image (optional, default to true) - /// Saturation value to set contrast in the preview image (optional, default to 10.0f) - /// Quality of JPEG image (100 - highest; 0 - lowest) (optional, default to 100L) - /// Show resolution ring, provided in Angstrom (optional, default to 0.1f) - /// Color scale for preview image: 0 - indigo, 1 - viridis, 2 - B/W, 3 - heat (optional, default to "indigo") - virtual void image_buffer_image_png_get(const std::optional &id, const std::optional &showUserMask, const std::optional &showRoi, const std::optional &showSpots, const std::optional &showBeamCenter, const std::optional &saturation, const std::optional &jpegQuality, const std::optional &showResRing, const std::optional &color, Pistache::Http::ResponseWriter &response) = 0; - /// /// Get preview image in TIFF format /// /// diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 9192704b..65d5d7ec 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -3103,42 +3103,6 @@ paths: application/json: schema: $ref: '#/components/schemas/error_message' - /image_buffer/image.png: - get: - summary: Get preview image in PNG format using custom settings - parameters: - - $ref: '#/components/parameters/image_id' - - $ref: '#/components/parameters/show_user_mask' - - $ref: '#/components/parameters/show_roi' - - $ref: '#/components/parameters/show_spots' - - $ref: '#/components/parameters/show_beam_center' - - $ref: '#/components/parameters/saturation' - - $ref: '#/components/parameters/jpeg_quality' - - $ref: '#/components/parameters/resolution_ring' - - $ref: '#/components/parameters/color_scale' - responses: - "200": - description: Preview image - content: - image/jpeg: - schema: - type: string - format: binary - "404": - description: Image not present in the buffer - either not yet measured or already replaced by a next image. - "400": - description: Input parsing or validation error - content: - text/plain: - schema: - type: string - description: Exception error - "500": - description: Error within Jungfraujoch code - see output message. - content: - application/json: - schema: - $ref: '#/components/schemas/error_message' /image_buffer/image.tiff: get: summary: Get preview image in TIFF format diff --git a/broker/redoc-static.html b/broker/redoc-static.html index 178d0ddf..32a68173 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -387,7 +387,7 @@ Get user mask of the detector (binary) Get user mask of the detector (TIFF) " aria-expanded="false" class="sc-cgHfjM ixknQI">
putUpload user mask of the detector

Error within Jungfraujoch code - see output message.

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get preview image in PNG format using custom settings

query Parameters
id
integer <int64> >= -2
Default: -1

Image ID in the image buffer. Special values: -1 - last image in the buffer, -2: last indexed image in the buffer

-
show_user_mask
boolean
Default: false

Show user mask

-
show_roi
boolean
Default: false

Show ROI areas on the image

-
show_spots
boolean
Default: true

Show spot finding results on the image

-
show_beam_center
boolean
Default: true

Show beam center on the image

-
saturation
number <float> [ -32767 .. 32767 ]
Default: 10

Saturation value to set contrast in the preview image

-
jpeg_quality
integer <int64> [ 0 .. 100 ]
Default: 100

Quality of JPEG image (100 - highest; 0 - lowest)

-
show_res_ring
number <float> [ 0.1 .. 100 ]
Default: 0.1

Show resolution ring, provided in Angstrom

-
color
string
Default: "indigo"
Enum: "indigo" "viridis" "bw" "heat"

Color scale for preview image: 0 - indigo, 1 - viridis, 2 - B/W, 3 - heat

-

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get preview image in TIFF format

query Parameters
id
integer <int64> >= -2
Default: -1
http://localhost:5232/image_buffer/image.jpeg

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get preview image in TIFF format

query Parameters
id
integer <int64> >= -2
Default: -1

Image ID in the image buffer. Special values: -1 - last image in the buffer, -2: last indexed image in the buffer

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get status of the image buffers

http://localhost:5232/image_buffer/clear

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get status of the image buffers

Can be run at any stage of Jungfraujoch operation, including during data collection. @@ -1391,13 +1363,13 @@ then image might be replaced in the buffer between calling /images and /image.cb " class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Error within Jungfraujoch code - see output message.

Response samples

Content type
application/json
{
  • "min_image_number": 0,
  • "max_image_number": 0,
  • "image_numbers": [
    ],
  • "total_slots": 0,
  • "available_slots": 0
}

Get Jungfraujoch version of jfjoch_broker

Responses

Response samples

Content type
application/json
{
  • "min_image_number": 0,
  • "max_image_number": 0,
  • "image_numbers": [
    ],
  • "total_slots": 0,
  • "available_slots": 0
}

Get Jungfraujoch version of jfjoch_broker

Responses