Skip to content

Bit depth image#1284

Open
phyy-nx wants to merge 9 commits intomainfrom
bit-depth-image
Open

Bit depth image#1284
phyy-nx wants to merge 9 commits intomainfrom
bit-depth-image

Conversation

@phyy-nx
Copy link
Copy Markdown
Contributor

@phyy-nx phyy-nx commented Jun 19, 2023

New PR superseding #1262 with additional edits from code camp review

From @graeme-winter:

Fixes #1258 by including it, using effectively the same definition as is currently in the field from DECTRIS

graeme-winter and others added 5 commits June 19, 2023 10:28
Fixes #1258 by including it, using effectively the same definition as is
currently in the field from DECTRIS
@phyy-nx phyy-nx mentioned this pull request Jun 19, 2023
@phyy-nx phyy-nx self-assigned this Jun 19, 2023
Copy link
Copy Markdown
Contributor

@yayahjb yayahjb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth doing

rjgildea pushed a commit to dials/nxmx that referenced this pull request Jun 26, 2023
rjgildea pushed a commit to dials/nxmx that referenced this pull request Jun 26, 2023
This is written by the DECTRIS filewrite to say how many pixel bits are used,
which can be different to those read from the hardware.

See:
  https://www.dectris.com/support/downloads/header-docs/nexus/
  nexusformat/definitions#1284

Co-authored-by: Richard Gildea <richard.gildea@diamond.ac.uk>
@tacaswell
Copy link
Copy Markdown
Contributor

The name is over-determined by DECTRIS already writing with this name so we have to accept it as is.

I am still confused by why this not redundant with asking the dataset what type it has.

Some of the linked discussions make the good point that there is not a way to note if the data is signed or unsigned. Might be notionally better to have image_datatype, but as noted above we are being jammed by DECTRIS so we should just accept this and move on.

@phyy-nx
Copy link
Copy Markdown
Contributor Author

phyy-nx commented Sep 27, 2024

Proposal is instead to try bit_depth_STORED in the base class, but this convention requires #1436

@benajamin
Copy link
Copy Markdown
Contributor

I don't like the proposal to to add bit_depth_STORED. It is implementing a feature whose only current use case is to make the name flexible enough to legitimise the "bit_depth_image" that DECTRIS is already writing. We don't need to make it ambiguous with this feature. We should just give the field a simple name (e.g. "bit_depth_stored") and and if that name is not "bit_depth_image", then we should both define and deprecate "bit_depth_image".

@phyy-nx
Copy link
Copy Markdown
Contributor Author

phyy-nx commented Sep 29, 2024

How about this? Use bit_depth_stored for NXdetector and bit_depth_image for NXmx, and just accept a redundant field in NXmx. Awkward, but it's less awkward than bit_depth_STORED for sure.

@phyy-nx
Copy link
Copy Markdown
Contributor Author

phyy-nx commented Sep 29, 2024

Chatting more with @benajamin, go with the deprecated bit_depth_image instead.

@tacaswell
Copy link
Copy Markdown
Contributor

I think we should either bless exactly what dectris/MX is doing in the most minimal way or consider ways to more accurately specify the data types (signed int vs unsigned int vs float (and if you want to open up floats there are non-standard floats (that you can write to hdf5) that use varying fractions of available bits for the exponent and mantissa and rgb (is a color image 8 bits or 24 bits under bit_depth_image?) of both what was collected from the hardware and what is written to the disk.

The first is pragmatic but wrong, the second is a lot of work but likely the correct thing to do.

@phyy-nx
Copy link
Copy Markdown
Contributor Author

phyy-nx commented Sep 29, 2024

Would changing to NX_NUMBER suffice for all the edge cases? Could do that for both bit_depth_image and bit_depth_stored.

Copy link
Copy Markdown
Contributor

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still approve after recent changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for Review
Status: In Progress

Development

Successfully merging this pull request may close these issues.

NXmx should (or should not?) mention bit_depth_image

5 participants