Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write flat and dark field data to the CIL Nexus format #940

Closed
wants to merge 10 commits into from

Conversation

lauramurgatroyd
Copy link
Member

@lauramurgatroyd lauramurgatroyd commented Aug 4, 2021

Closes: #934
Writes dark and flat field data out to a CIL nexus file, and reads this in with the NEXUSReader.
The dark and flat fields must be arrays with the same dimensions and ordering as the data set.

Dark field data is saved to: entry1/tomo_entry/data/dark_field/data
A position key for this data is saved to: entry1/tomo_entry/data/dark_field/position_key
And similar for flat fields.
Any suggestions on renaming the location of these would be welcome.

The position key is an array of length [number of flat fields] which contains 0s and 1s. 0 indicates the field was taken before the projections, 1 indicates after.

I originally tried adding the flat and dark field data into the array that is saved in entry1/tomo_entry/data/data and saving an image key to identify which are flat fields, dark fields and projections (as is done in the NXTomo format), but this quickly became complicated due to different orderings the data dimensions could have (see here 86f2ae2)
It seems better to save the dark and flat fields as separate arrays because that is how they will be read back and used in processing anyway.

More detailed information about the ordering of the dark and flat fields (i.e. if some were taken in between projections) could be added to the nexus file in the future if needed - this could be in another array entry within entry1/tomo_entry/data/dark_field/

Saves an image key to identify flat, dark and projections.
Limitations:
- only works if data is ordered: [angles, ..]
- does not allow setting of angles associated with dark/flat field
- not tested with channels, but believe it wouldn't work currently
@lauramurgatroyd lauramurgatroyd changed the title Nexus readwrite flat dark Write flat and dark field data to the CIL Nexus format Aug 4, 2021
@lauramurgatroyd
Copy link
Member Author

This may mean we don't need

class NXTomoWriter(object):

as we would prefer to write out the CIL Nexus format containing the dark and flat field info, instead of an NXTomo file

@lauramurgatroyd
Copy link
Member Author

lauramurgatroyd commented Aug 4, 2021

To do:

  • Add checks for dimensions of dark and flat fields relative to the data
  • Add docstrings
  • Add default values of dark and flat keys - or throw an error if they are not set

@lauramurgatroyd lauramurgatroyd marked this pull request as ready for review August 16, 2021 09:27
@lauramurgatroyd
Copy link
Member Author

Closing this, because instead of writing dark and flat fields to the CIL Nexus file, we are going to keep the data as NXTomo format until we get to a processing step (e.g. Centre of Rotation Correction) where we need to specifically write out CIL info (such as the geometry). The other steps just modify the data which will be saved in an NXTomo anyway.
Therefore we will just need the NXTomo reader and writers (see #939 and #949)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Save dark and flat fields in nexus file produced with NEXUSDataWriter
1 participant