From 91dd670043a81a0b100eaad3b094c809db06459d Mon Sep 17 00:00:00 2001 From: leonarski_f Date: Sat, 28 Mar 2026 11:51:12 +0100 Subject: [PATCH] OpenAPI: Add integrated NXmx file writer format --- broker/OpenAPIConvert.cpp | 9 +++++++-- broker/gen/model/File_writer_format.cpp | 14 ++++++++++---- broker/gen/model/File_writer_format.h | 7 ++++--- broker/jfjoch_api.yaml | 9 +++++++-- broker/redoc-static.html | 16 ++++++++++------ common/JFJochMessages.h | 2 +- docs/python_client/docs/FileWriterFormat.md | 6 ++++-- frontend/src/components/FileWriterSettings.tsx | 7 ++++--- .../src/openapi/models/file_writer_format.ts | 9 +++++++-- 9 files changed, 54 insertions(+), 25 deletions(-) diff --git a/broker/OpenAPIConvert.cpp b/broker/OpenAPIConvert.cpp index 8bcfd823..cb620533 100644 --- a/broker/OpenAPIConvert.cpp +++ b/broker/OpenAPIConvert.cpp @@ -795,7 +795,7 @@ org::openapitools::server::model::File_writer_format Convert(FileWriterFormat in org::openapitools::server::model::File_writer_format ret; switch (input) { case FileWriterFormat::DataOnly: - ret.setValue(org::openapitools::server::model::File_writer_format::eFile_writer_format::NONE); + ret.setValue(org::openapitools::server::model::File_writer_format::eFile_writer_format::NXMXONLYDATA); break; case FileWriterFormat::NXmxLegacy: ret.setValue(org::openapitools::server::model::File_writer_format::eFile_writer_format::NXMXLEGACY); @@ -803,6 +803,9 @@ org::openapitools::server::model::File_writer_format Convert(FileWriterFormat in case FileWriterFormat::NXmxVDS: ret.setValue(org::openapitools::server::model::File_writer_format::eFile_writer_format::NXMXVDS); break; + case FileWriterFormat::NXmxIntegrated: + ret.setValue(org::openapitools::server::model::File_writer_format::eFile_writer_format::NXMXINTEGRATED); + break; case FileWriterFormat::CBF: ret.setValue(org::openapitools::server::model::File_writer_format::eFile_writer_format::CBF); break; @@ -820,12 +823,14 @@ org::openapitools::server::model::File_writer_format Convert(FileWriterFormat in FileWriterFormat Convert(const org::openapitools::server::model::File_writer_format& input) { switch (input.getValue()) { - case org::openapitools::server::model::File_writer_format::eFile_writer_format::NONE: + case org::openapitools::server::model::File_writer_format::eFile_writer_format::NXMXONLYDATA: return FileWriterFormat::DataOnly; case org::openapitools::server::model::File_writer_format::eFile_writer_format::NXMXLEGACY: return FileWriterFormat::NXmxLegacy; case org::openapitools::server::model::File_writer_format::eFile_writer_format::NXMXVDS: return FileWriterFormat::NXmxVDS; + case org::openapitools::server::model::File_writer_format::eFile_writer_format::NXMXINTEGRATED: + return FileWriterFormat::NXmxIntegrated; case org::openapitools::server::model::File_writer_format::eFile_writer_format::CBF: return FileWriterFormat::CBF; case org::openapitools::server::model::File_writer_format::eFile_writer_format::TIFF: diff --git a/broker/gen/model/File_writer_format.cpp b/broker/gen/model/File_writer_format.cpp index 94a00003..5a1845ec 100644 --- a/broker/gen/model/File_writer_format.cpp +++ b/broker/gen/model/File_writer_format.cpp @@ -75,8 +75,8 @@ void to_json(nlohmann::json& j, const File_writer_format& o) case File_writer_format::eFile_writer_format::INVALID_VALUE_OPENAPI_GENERATED: j = "INVALID_VALUE_OPENAPI_GENERATED"; break; - case File_writer_format::eFile_writer_format::NONE: - j = "None"; + case File_writer_format::eFile_writer_format::NXMXONLYDATA: + j = "NXmxOnlyData"; break; case File_writer_format::eFile_writer_format::NXMXLEGACY: j = "NXmxLegacy"; @@ -84,6 +84,9 @@ void to_json(nlohmann::json& j, const File_writer_format& o) case File_writer_format::eFile_writer_format::NXMXVDS: j = "NXmxVDS"; break; + case File_writer_format::eFile_writer_format::NXMXINTEGRATED: + j = "NXmxIntegrated"; + break; case File_writer_format::eFile_writer_format::CBF: j = "CBF"; break; @@ -100,8 +103,8 @@ void from_json(const nlohmann::json& j, File_writer_format& o) { auto s = j.get(); - if (s == "None") { - o.setValue(File_writer_format::eFile_writer_format::NONE); + if (s == "NXmxOnlyData") { + o.setValue(File_writer_format::eFile_writer_format::NXMXONLYDATA); } else if (s == "NXmxLegacy") { o.setValue(File_writer_format::eFile_writer_format::NXMXLEGACY); @@ -109,6 +112,9 @@ void from_json(const nlohmann::json& j, File_writer_format& o) else if (s == "NXmxVDS") { o.setValue(File_writer_format::eFile_writer_format::NXMXVDS); } + else if (s == "NXmxIntegrated") { + o.setValue(File_writer_format::eFile_writer_format::NXMXINTEGRATED); + } else if (s == "CBF") { o.setValue(File_writer_format::eFile_writer_format::CBF); } diff --git a/broker/gen/model/File_writer_format.h b/broker/gen/model/File_writer_format.h index 6d8638f6..1fab8fd3 100644 --- a/broker/gen/model/File_writer_format.h +++ b/broker/gen/model/File_writer_format.h @@ -12,7 +12,7 @@ /* * File_writer_format.h * - * None - no master file written NXmxLegacy - legacy format with soft links to data files in the master file; necessary for DECTRIS Albula 4.0 and DECTRIS Neggia NXmxVDS - newer format with virtual dataset linking data files in the master file, also includes better metadata handling + * NoFileWritten - no files are written at all NXmxOnlyData - only data files are written, no master file NXmxLegacy - legacy format with soft links to data files in the master file; necessary for DECTRIS Albula 4.0 and DECTRIS Neggia NXmxVDS - newer format with virtual dataset linking data files in the master file, also includes better metadata handling NXmxIntegrated - single HDF5 per dataset CBF - CBF format (limited metadata) TIFF - TIFF format (no metadata) */ #ifndef File_writer_format_H_ @@ -25,7 +25,7 @@ namespace org::openapitools::server::model { /// -/// None - no master file written NXmxLegacy - legacy format with soft links to data files in the master file; necessary for DECTRIS Albula 4.0 and DECTRIS Neggia NXmxVDS - newer format with virtual dataset linking data files in the master file, also includes better metadata handling +/// NoFileWritten - no files are written at all NXmxOnlyData - only data files are written, no master file NXmxLegacy - legacy format with soft links to data files in the master file; necessary for DECTRIS Albula 4.0 and DECTRIS Neggia NXmxVDS - newer format with virtual dataset linking data files in the master file, also includes better metadata handling NXmxIntegrated - single HDF5 per dataset CBF - CBF format (limited metadata) TIFF - TIFF format (no metadata) /// class File_writer_format { @@ -38,9 +38,10 @@ public: // Avoiding name clashes with user defined // enum values INVALID_VALUE_OPENAPI_GENERATED = 0, - NONE, + NXMXONLYDATA, NXMXLEGACY, NXMXVDS, + NXMXINTEGRATED, CBF, TIFF, NOFILEWRITTEN diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 86ba0e1f..e5cbbb5f 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -642,17 +642,22 @@ components: file_writer_format: type: string enum: - - "None" + - "NXmxOnlyData" - "NXmxLegacy" - "NXmxVDS" + - "NXmxIntegrated" - "CBF" - "TIFF" - "NoFileWritten" default: "NXmxLegacy" description: | - None - no master file written + NoFileWritten - no files are written at all + NXmxOnlyData - only data files are written, no master file NXmxLegacy - legacy format with soft links to data files in the master file; necessary for DECTRIS Albula 4.0 and DECTRIS Neggia NXmxVDS - newer format with virtual dataset linking data files in the master file, also includes better metadata handling + NXmxIntegrated - single HDF5 per dataset + CBF - CBF format (limited metadata) + TIFF - TIFF format (no metadata) file_writer_settings: type: object properties: diff --git a/broker/redoc-static.html b/broker/redoc-static.html index 765681ec..493e148f 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -591,16 +591,20 @@ If dataset_settings doesn't have detect_ice_rings

Response samples

Content type
application/json
{
  • "algorithm": "FFBIDX",
  • "fft_max_unit_cell_A": 250,
  • "fft_min_unit_cell_A": 10,
  • "fft_high_resolution_A": 2,
  • "fft_num_vectors": 16384,
  • "tolerance": 0.5,
  • "thread_count": 1,
  • "geom_refinement_algorithm": "BeamCenter",
  • "unit_cell_dist_tolerance": 0.05,
  • "viable_cell_min_spots": 10,
  • "index_ice_rings": false,
  • "rotation_indexing": false,
  • "rotation_indexing_min_angular_range_deg": 20,
  • "rotation_indexing_angular_stride_deg": 0.5
}

Change file writer settings

This can only be done when detector is Idle, Error or Inactive states.

Request Body schema: application/json
overwrite
boolean
Default: false

Inform jfjoch_write to overwrite existing files. Otherwise files would be saved with .h5.{timestamp}.tmp suffix.

-
format
string (file_writer_format)
Default: "NXmxLegacy"
Enum: "None" "NXmxLegacy" "NXmxVDS" "CBF" "TIFF" "NoFileWritten"

None - no master file written -NXmxLegacy - legacy format with soft links to data files in the master file; necessary for DECTRIS Albula 4.0 and DECTRIS Neggia
NXmxVDS - newer format with virtual dataset linking data files in the master file, also includes better metadata handling

+
format
string (file_writer_format)
Default: "NXmxLegacy"
Enum: "NXmxOnlyData" "NXmxLegacy" "NXmxVDS" "NXmxIntegrated" "CBF" "TIFF" "NoFileWritten"

NoFileWritten - no files are written at all +NXmxOnlyData - only data files are written, no master file +NXmxLegacy - legacy format with soft links to data files in the master file; necessary for DECTRIS Albula 4.0 and DECTRIS Neggia
NXmxVDS - newer format with virtual dataset linking data files in the master file, also includes better metadata handling +NXmxIntegrated - single HDF5 per dataset +CBF - CBF format (limited metadata) +TIFF - TIFF format (no metadata)

Responses

Request samples

Content type
application/json
{
  • "overwrite": false,
  • "format": "None"
}

Response samples

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

Get file writer settings

Can be done anytime

+
http://localhost:5232/config/file_writer

Request samples

Content type
application/json
{
  • "overwrite": false,
  • "format": "NXmxOnlyData"
}

Response samples

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

Get file writer settings

Can be done anytime

Responses

Response samples

Content type
application/json
{
  • "overwrite": false,
  • "format": "None"
}

Change instrument metadata

This can only be done when detector is Idle, Error or Inactive states.

+
http://localhost:5232/config/file_writer

Response samples

Content type
application/json
{
  • "overwrite": false,
  • "format": "NXmxOnlyData"
}

Change instrument metadata

This can only be done when detector is Idle, Error or Inactive states.

Request Body schema: application/json
source_name
required
string
source_type
string
Default: ""

Type of radiation source. NXmx gives a fixed dictionary, though Jungfraujoch is not enforcing compliance. https://manual.nexusformat.org/classes/base_classes/NXsource.html#nxsource NXsource allows the following:

@@ -792,7 +796,7 @@ This can only be done when detector is Idle, Error or

Request samples

Content type
application/json
{
  • "box": {
    },
  • "circle": {
    },
  • "azim": {
    }
}

Response samples

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

Get general statistics

Responses

Response samples

Content type
application/json
{
  • "detector": {
    },
  • "detector_list": {
    },
  • "detector_settings": {
    },
  • "image_format_settings": {
    },
  • "instrument_metadata": {
    },
  • "file_writer_settings": {
    },
  • "data_processing_settings": {
    },
  • "measurement": {
    },
  • "broker": {
    },
  • "fpga": [
    ],
  • "calibration": [
    ],
  • "zeromq_preview": {
    },
  • "zeromq_metadata": {
    },
  • "dark_mask": {
    },
  • "pixel_mask": {
    },
  • "roi": {
    },
  • "az_int": {
    },
  • "buffer": {
    },
  • "indexing": {
    },
  • "image_pusher": {
    }
}

Get data collection statistics

Results of the last data collection

+
http://localhost:5232/statistics

Response samples

Content type
application/json
{
  • "detector": {
    },
  • "detector_list": {
    },
  • "detector_settings": {
    },
  • "image_format_settings": {
    },
  • "instrument_metadata": {
    },
  • "file_writer_settings": {
    },
  • "data_processing_settings": {
    },
  • "measurement": {
    },
  • "broker": {
    },
  • "fpga": [
    ],
  • "calibration": [
    ],
  • "zeromq_preview": {
    },
  • "zeromq_metadata": {
    },
  • "dark_mask": {
    },
  • "pixel_mask": {
    },
  • "roi": {
    },
  • "az_int": {
    },
  • "buffer": {
    },
  • "indexing": {
    },
  • "image_pusher": {
    }
}

Get data collection statistics

Results of the last data collection

Responses