Processing Perspective
Introduction
The processing perspective is designed to allow sequences of processing steps to be built and applied to stacks of data, in batch, across multiple files.
Currently processing is limited to processing data as images or vectors (spectra, powder patterns etc), either as a single dataset or as a section of a larger multi-dimensional dataset, with or without axes.
A brief introduction to the processing perspective can be found in the quick start guide.
In this guide, we use one of the examples from the quick start guide, an FTIR image of a cell sample, available to download from here:
https://alfred.diamond.ac.uk/DawnExampleData/ftir1.nxs
This is a nice example file because it can be processed either as images (images of the cell at different wavelengths) or spectra (full IR spectra per pixel of the image).
Loading Data
The easiest way to load data into the processing perspective is using the File/Open... menu.
If no data is loaded, a dialog will appear allowing you to select which dataset to process, and how to process it (as image, or line, all the data, or just a subset).
If there is already data loaded, any new files must have a dataset with the same name as that selected to process, and it must have the same rank (if "dataset1" is a 3D dataset in the loaded file, any subsequently loaded files must have "dataset1" and it must also be 3D).
Processing Data as Images
Download ftir1.nxs from the link above and load it into the processing perspective.
The set up dialog will appear and should look like this:
By default, the dataset /entry1/absorbance/data (which has shape [64,64,1608] - 64x64 pixel image at 1608 different wavelengths) has been selected. If it is not, use the Select dataset drop down box to select it.
The default mode for processing multidimensional dataset is as image [2D], using the last two dimensions as the image dimensions (this is the fastest way to iterate through the data).
To process this dataset as the cell image we need to change the display dimensions so that X and Y are set to dimension 0 and 1 (currently the image is wavenumber vs image x - i.e. a stack of spectra). Click in the Display cell for Dimension 0 [64] and select X from the drop down to show the 64x64 image (the order of X and Y - whether they are assigned to dimension 0 or 1 - doesn't matter, the processing loader will not transpose the dataset on load, it must be done as a processing step if required).
Pressing Finish will dismiss the setup dialog, and show the selected data, set up in the selected way, loaded in the processing perspective.
Notice the file name, ftir1.nxs in the Data Slice View. At the bottom of this view, the status label shows the current slice of the data, which in this case is [:64,:64,0] - meaning it is all the 64x64 pixels of the zeroth image (the first image in the stack). This is the image shown in the Input view plot. Using the play/fast forward/end buttons above this status bar, flick through the images in the stack, you should see clear individuals cells in the image at around frame 300.
The processing perspective takes this input image, passes it through the sequence of steps shown in the Processing view and displays the result in the Output view plot.
Currently the Processing list is empty so no data is plotted in the output.
Building a Processing Chain
In the the Processing view, click on the yellow star in the table. A drop-down will open showing all the processing steps available for images.
Selecting a processing step will show a description of what the step does.
The drop down is filterable. If you click on the start and type "Gau" all the processing steps except the Gaussian Filter will be removed from the list.
Add the Gaussian Filter step to the processing list. The processing perspective should now look like this:
The Gaussian filtered data is shown in the Output view plot.
When the Gaussian Filter step is selected the Model view shows that parameters of the processing step that can be altered. For a Gaussian Filter they only parameter is the kernel width. Change the kernel width to 10. The output data will not be updated until you click back onto the Gaussian Filter step (a processing step may take a long time to run, clicking back item in the processing view signifies that all updates to the model are complete and the process should be re-run).
The play/fast-forward buttons can be used to change the input image, which pushes a new frame through the processing chain, changing the output image.
Further steps can be added to this processing chain by repeating the above sequence.
Processing All the Data
Although the processing sequence is currently very simple, it is a complete sequence that can be applied to all the images in the stack (all 1608 different wavelengths). To do this, press the green play button at the top of the Data Slice View.
Pressing this button causes a dialog to appear to allow you to set the directory where the processed data will be written.
This dialog also gives the option to automatically load the processed data in the DataVis perspective when processing is complete - tick this option.
For NeXus files, three additional options are included on what data is written into the output file:
- Processed data only
- Link original data (a link to the NXentry in the original file is added to the processed file. If the processed file is moved relative to the original data this link may get broken)
- Process data into a copy of the original (the original file is copied and the processed data is added here - may make the files very large. Copying only copies the nxs file, it will not follow links to other linked hdf5 files).
For this case leave Processed data only selected, and when you are happy with the output folder press OK to process the data.
A progress dialog will appear and show which slice of the data is being processed, and which step is being run.
Pressing the Cancel button will stop the processing, but any data that has been processed will still be available in the file.
Switching to DataVis will allow you to view the processed data file, but for now stay in the processing perspective.