Mechanism to read bitshuffle-compressed pixel-mask data - by
loading/using the normal bitshuffle source from https://github.com/kiyo-masui/bitshuffle (see Makefile).
This commit is contained in:
+25
-1
@@ -573,9 +573,33 @@ int get_dectris_eiger_pixel_mask(const struct ds_desc_t *desc, int *buffer) {
|
||||
ERROR_JUMP(-1, done, "Error opening detectorSpecific/pixel_mask");
|
||||
}
|
||||
|
||||
// what if this is compressed?
|
||||
hid_t dcpl = H5Dget_create_plist(ds_id);
|
||||
int n_filters = H5Pget_nfilters(dcpl);
|
||||
H5Z_filter_t filter_id;
|
||||
if (n_filters>0) {
|
||||
unsigned int flags;
|
||||
size_t nelmts = 1;
|
||||
unsigned int values_out[1] = {99};
|
||||
char filter_name[80];
|
||||
filter_id = H5Pget_filter(dcpl, (unsigned) 0, &flags, &nelmts, values_out, sizeof(filter_name), filter_name, NULL);
|
||||
if (filter_id>=0) {
|
||||
fprintf(stderr," filter name =\"%s\"\n",filter_name);
|
||||
}
|
||||
}
|
||||
|
||||
err = H5Dread(ds_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer);
|
||||
if (err < 0) {
|
||||
ERROR_JUMP(-1, close_dataset, "Error reading detectorSpecific/pixel_mask");
|
||||
if (n_filters>0) {
|
||||
ERROR_JUMP(-1, close_dataset, "Error reading detectorSpecific/pixel_mask with filter(s)");
|
||||
}
|
||||
else {
|
||||
ERROR_JUMP(-1, close_dataset, "Error reading detectorSpecific/pixel_mask");
|
||||
}
|
||||
}
|
||||
|
||||
if (H5Zfilter_avail(BS_H5_FILTER_ID)) {
|
||||
fprintf(stderr," bitshuffle filter is available now since H5Dread (of pixel-mask) triggered loading of the filter.\n");
|
||||
}
|
||||
|
||||
close_dataset:
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
#include "filters.h"
|
||||
#include "plugin.h"
|
||||
|
||||
#ifdef USE_BITSHUFFLE
|
||||
#include "bshuf_h5filter.h"
|
||||
#endif
|
||||
|
||||
/* XDS does not provide an error callback facility, so just write to stderr
|
||||
for now - generally regarded as poor practice */
|
||||
#define ERROR_OUTPUT stderr
|
||||
@@ -286,6 +290,12 @@ void plugin_open(const char *filename, int info[1024], int *error_flag) {
|
||||
ERROR_JUMP(-2, done, "Failed to configure HDF5 error handling");
|
||||
}
|
||||
|
||||
#ifdef USE_BITSHUFFLE
|
||||
if (bshuf_register_h5filter() < 0 ) {
|
||||
ERROR_JUMP(-2, done, "Failed to register bitshuffle filter");
|
||||
}
|
||||
#endif
|
||||
|
||||
fill_info_array(info);
|
||||
file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
if (file_id < 0) {
|
||||
|
||||
Reference in New Issue
Block a user