Compare commits
14 Commits
chunk_read
...
hdf5-1-12
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ec2cd7437 | |||
| f25a73c667 | |||
| 6165d14c31 | |||
| 19b16ad2a1 | |||
| 4e2b0c7506 | |||
| 34a38e15fd | |||
| 8eaacaed77 | |||
| 2f6348e8d2 | |||
| ffebc60cdb | |||
| c129d095e0 | |||
| 1e202a7429 | |||
| 1929c1149b | |||
| 59f4983524 | |||
| 38b43be701 |
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2018, Diamond Light Source
|
||||
Copyright (c) 2018-2019, Diamond Light Source
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -8,15 +8,15 @@ modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the <organization> nor the
|
||||
* Neither the name of the copyright holder nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
|
||||
@@ -8,14 +8,14 @@ BSLZ4_BUILD_DIR = ./bslz4/build
|
||||
BSLZ4_INC_DIR = $(BSLZ4_SRC_DIR)
|
||||
|
||||
CC=h5cc
|
||||
CFLAGS=-Wall -g -O2 -fpic -I$(INC_DIR) -I$(BSLZ4_INC_DIR) -std=c89
|
||||
|
||||
.PHONY: all
|
||||
all: plugin example test_plugin
|
||||
CFLAGS=-DH5_USE_110_API -Wall -g -O2 -fpic -I$(INC_DIR) -I$(BSLZ4_INC_DIR) -std=c89 -shlib
|
||||
|
||||
.PHONY: plugin
|
||||
plugin: $(BUILD_DIR)/durin-plugin.so
|
||||
|
||||
.PHONY: all
|
||||
all: plugin example test_plugin
|
||||
|
||||
.PHONY: example
|
||||
example: $(BUILD_DIR)/example
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ See:
|
||||
* https://www.dectris.com/features/features-eiger-x/hdf5-and-nexus
|
||||
* https://strucbio.biologie.uni-konstanz.de/xdswiki
|
||||
|
||||
## Get Durin
|
||||
|
||||
Latest release at https://github.com/DiamondLightSource/durin/releases/tag/2019v1
|
||||
|
||||
## Usage
|
||||
In your XDS.INP add:
|
||||
@@ -29,8 +32,69 @@ series of datasets named `data_000001`, `data_000002`, etc.
|
||||
|
||||
|
||||
## Building
|
||||
|
||||
### Building HDF5 library
|
||||
The HDF5 library used when building durin must have been compiled with specific switches enabled
|
||||
to allow the durin plugin to be built and used.
|
||||
|
||||
Download the HDF5 source code (https://www.hdfgroup.org/downloads/hdf5/source-code) and extract
|
||||
to any directory (referred to as `/hdf5_dir`), and run the following commands.
|
||||
```
|
||||
cd durin
|
||||
cd /hdf5_dir
|
||||
mkdir build
|
||||
cd build
|
||||
export CFLAGS=-fPIC
|
||||
../configure --enable-threadsafe --enable-deprecated-symbols --enable-hl --enable-unsupported
|
||||
make
|
||||
make check
|
||||
make install
|
||||
```
|
||||
The hdf5 tools and libraries should now be located in `/hdf5_dir/build/hdf5`
|
||||
|
||||
For reference, the plugin requires the thread-safe switch and the optimised chunk read function.
|
||||
The chunk read function may be defined in the high level library instead of the regular library,
|
||||
depending on the exact HDF5 version downloaded (hence the --enable-deprecated-symbols _and_ --enable-hl).
|
||||
The unsupported flag enables building with both threadsafe and high-level enabled.
|
||||
|
||||
|
||||
### Building durin plugin
|
||||
The plugin makefile will use the "h5cc" compiler wrapper, provided by the HDF5 library, which
|
||||
must be on your PATH.
|
||||
Download or clone the plugin source code (https://github.com/DiamondLightSource/durin)
|
||||
into any directory (referred to as `/durin_dir`) and run the following commands.
|
||||
```
|
||||
cd /durin_dir
|
||||
PATH=/hdf5_dir/build/hdf5/bin:$PATH
|
||||
make
|
||||
```
|
||||
Plugin file is `build/durin-plugin.so`
|
||||
The plugin is located at `/durin_dir/build/durin-plugin.so` and should be added to the
|
||||
XDS.INP file as `LIB=/durin_dir/build/durin-plugin.so`
|
||||
|
||||
|
||||
|
||||
## Example XDS.INP
|
||||
```
|
||||
DETECTOR=PILATUS MINIMUM_VALID_PIXEL_VALUE=0 OVERLOAD=4096
|
||||
LIB=/opt/durin/build/durin-plugin.so
|
||||
SENSOR_THICKNESS= 0.450
|
||||
!SENSOR_MATERIAL / THICKNESS Si 0.450
|
||||
!SILICON= 3.953379
|
||||
DIRECTION_OF_DETECTOR_X-AXIS= 1.00000 0.00000 0.00000
|
||||
DIRECTION_OF_DETECTOR_Y-AXIS= 0.00000 1.00000 0.00000
|
||||
DETECTOR_DISTANCE= 194.633000
|
||||
ORGX= 1041.30 ORGY= 1160.90
|
||||
ROTATION_AXIS= 0.00000 -1.00000 -0.00000
|
||||
STARTING_ANGLE= -30.000
|
||||
OSCILLATION_RANGE= 0.100
|
||||
X-RAY_WAVELENGTH= 0.97891
|
||||
INCIDENT_BEAM_DIRECTION= -0.000 -0.000 1.022
|
||||
FRACTION_OF_POLARIZATION= 0.999
|
||||
POLARIZATION_PLANE_NORMAL= 0.000 1.000 0.000
|
||||
NAME_TEMPLATE_OF_DATA_FRAMES= ../image_9264_??????.h5
|
||||
TRUSTED_REGION= 0.0 1.41
|
||||
DATA_RANGE= 1 600
|
||||
JOB=XYCORR INIT COLSPOT IDXREF DEFPIX INTEGRATE CORRECT
|
||||
```
|
||||
|
||||
N.B. the master file is needed, not the .nxs one which follows the
|
||||
standard.
|
||||
|
||||
+13
-6
@@ -339,7 +339,7 @@ int get_dectris_eiger_dataset_dims(struct ds_desc_t *desc) {
|
||||
ds_id = H5Dopen2(desc->data_g_id, ds_name, H5P_DEFAULT);
|
||||
if (ds_id < 0) {
|
||||
char message[64];
|
||||
sprintf("Unable to open dataset %.16s", ds_name);
|
||||
sprintf(message, "Unable to open dataset %.16s", ds_name);
|
||||
ERROR_JUMP(-1, loop_end, message);
|
||||
}
|
||||
t_id = H5Dget_type(ds_id);
|
||||
@@ -410,14 +410,14 @@ int read_pixel_info(hid_t g_id, const char *path, double *size) {
|
||||
ds_id = H5Dopen2(g_id, path, H5P_DEFAULT);
|
||||
if (ds_id < 0) {
|
||||
char message[64];
|
||||
sprintf("Error opening dataset %.32s", path);
|
||||
sprintf(message, "Error opening dataset %.32s", path);
|
||||
ERROR_JUMP(-1, done, message);
|
||||
}
|
||||
|
||||
err = H5Dread(ds_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value);
|
||||
if (err < 0) {
|
||||
char message[64];
|
||||
sprintf("Error reading dataset %.32s", path);
|
||||
sprintf(message, "Error reading dataset %.32s", path);
|
||||
ERROR_JUMP(-1, close_dataset, message);
|
||||
}
|
||||
|
||||
@@ -429,8 +429,8 @@ int read_pixel_info(hid_t g_id, const char *path, double *size) {
|
||||
double scale = 1;
|
||||
a_id = H5Aopen(ds_id, "units", H5P_DEFAULT);
|
||||
if (a_id < 0) {
|
||||
char message[64];
|
||||
sprintf("Error openeing units attribute for %.32s after existence check", path);
|
||||
char message[100];
|
||||
sprintf(message, "Error openeing units attribute for %.32s after existence check", path);
|
||||
ERROR_JUMP(-1, close_dataset, message);
|
||||
}
|
||||
|
||||
@@ -567,7 +567,13 @@ close_dataset:
|
||||
H5Dclose(ds_id);
|
||||
done:
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
int get_null_pixel_mask(const struct ds_desc_t *desc, int *buffer) {
|
||||
hsize_t buffer_length = desc->dims[1] * desc->dims[2];
|
||||
memset(buffer, 0, sizeof(*buffer) * buffer_length);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -808,7 +814,8 @@ int create_dataset_descriptor(struct ds_desc_t **desc, struct det_visit_objects_
|
||||
H5Lexists(g_id, "detectorSpecific/pixel_mask", H5P_DEFAULT) > 0) {
|
||||
pxl_mask_func = &get_dectris_eiger_pixel_mask;
|
||||
} else {
|
||||
ERROR_JUMP(-1, done, "Could not locate pixel_mask");
|
||||
pxl_mask_func = &get_null_pixel_mask;
|
||||
fprintf(stderr, "WARNING: Could not find pixel mask - no masking will be applied\n");
|
||||
}
|
||||
|
||||
/* determine where the data is stored and what strategy to use */
|
||||
|
||||
+4
-1
@@ -238,7 +238,10 @@ void plugin_close(int *error_flag) {
|
||||
}
|
||||
file_id = 0;
|
||||
|
||||
if (mask_buffer) free(mask_buffer);
|
||||
if (mask_buffer) {
|
||||
free(mask_buffer);
|
||||
mask_buffer = NULL;
|
||||
}
|
||||
if (data_desc->free_desc) {
|
||||
data_desc->free_desc(data_desc);
|
||||
data_desc = NULL;
|
||||
|
||||
Reference in New Issue
Block a user