nx2img [OPTIONS] [NEXUS PATH]
nx2img is a command line program implemented as a Python3 script which converts image data stored in a NeXus file into individual image files. The currently supported image formats are TIFF and CBF. nx2img takes the NeXus path to a data field holding the image data as its only argument. The way how the data will be distributed to the individual image files depends on the rank (number of dimensions) of the input field
If, instead of a full NeXus path, only the file name is given the program assumes the default path to /:NXentry/:NXinstrument/:NXdetector/data.
-h, --help | show a brief program help and terminate the program |
-f, --output-format | |
image format to use for the files (default is TIFF) | |
-p, --output-path | |
path to the directory where to write the data, the default is the current working directory | |
-s, --start-index | |
the starting index of the images (default=0) | |
-t, --file-template | |
the file template used to generate the image file names, the default value is img_%05i.tiff |
The most simplest call to nx2img looks like
$ nx2img data.nxs://:NXentry/:NXinstrument/:NXdetector/data
which would result in
$ ls
img_00000.tiff
img_00001.tiff
img_00002.tiff
a bunch of TIFF files in the current working directory. To change the file names and the numbering scheme one could use something like this
$ nx2img -fcbf -tdata_%i.cbf data.nxs://:NXentry/:NXinstrument/:NXdetector/data
which will result into
$ ls
data_0.cbf
data_1.cbf
data_3.cbf
Returns 0 in case of success and 1 in case of errors.