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

Improve Bruker format readers #21

Open
dagewa opened this issue Aug 30, 2017 · 7 comments
Open

Improve Bruker format readers #21

dagewa opened this issue Aug 30, 2017 · 7 comments

Comments

@dagewa
Copy link
Member

dagewa commented Aug 30, 2017

The dxtbx handling of Bruker file formats is limited. FormatBruker relies on iotbx.detectors.BrukerImage. This makes some restrictive assumptions, such as 1024*1024 pixel images, which are not correct for detectors such as the new PHOTON-II. FormatBrukerPhotonII avoids using BrukerImage to work around the restrictions, but fails on datasets using Bruker's own compression scheme.

Arnaud Basle has been in touch with Bruker representatives, and obtained the latest frame file description:
BISFrameFileFormats.zip. We may also be able to see the source for FrmUtility, which is Bruker's own reference example for how to read their .sfrm format.

Ideally, this knowledge should be incorporated into FormatBruker, so that this can read any Bruker image, without unwarranted assumptions.

@dagewa
Copy link
Member Author

dagewa commented Aug 30, 2017

Here are some additional questions and answers from Arnaud and Bruker, specifically about the Photon II:

How is the beam center dealt with? It seems that in the header only the offsets of the beam center at 2theta=0 are saved. Could you explain?

The CENTER is the pixel value that corresponds to the values on ANGLES. RAW and UNWARP values are on this line. For a detector that doesn’t need a spatial correction, he values are h same.

Could you explain as well how works the "Adaptive oversampling"? I guess this is to increase the dynamic range to 163810?

I believe that "Adaptive oversampling" refers to the retake images that was done on CCD detectors. Doesn’t apply to CMOS. CMOS frames have 16381 dynamic range and we read ten images per frame.

If the pixel values are coded in 2 bytes how come the max value is 163810?

With 10 images of 16-bits, the final frame is 19-bits. Round it up to 2 bytes.

@graeme-winter
Copy link
Collaborator

Did Arnaud send an example set?

@dagewa
Copy link
Member Author

dagewa commented Nov 8, 2017

We have the sources for FrmUtility now from Bruker (email to dials-support). From the readme:

Getting Started:

A good place to start is with these source files and routines:

FrmRoutines.cpp: see ReadFrameFile() and SaveFrameFile() routines.
Frm2Frm\frm_lib.c & frm_lib.h: see basically the entire files.

And some general documentation for the Bruker Frame File format is:

help\BISFrameFileFormats.rtf

@dagewa
Copy link
Member Author

dagewa commented Nov 9, 2017

"One caveat. FrmUtility was written before Bruker supported double frame data. Double frame data is either multiplied by 10 or 1000 and written as integers. I would convert all frames to doubles (apply LINEAR and baseline). See PDF file sent earlier."

dagewa referenced this issue in cctbx/cctbx_project Mar 20, 2018
… around #65 for Arnaud Basle. Still requires proper instantiation of beam and goniometer from the header. Check also thickness, material and trusted range of the detector
dagewa referenced this issue in cctbx/cctbx_project May 10, 2018
Bruker Photon II images. Ideally FormatBruker should be rewritten,
but we don't fully understand the Bruker format yet. See #65
@dagewa
Copy link
Member Author

dagewa commented May 15, 2018

I have some more example images from a Photon II detector from Andrew Purkiss, shared here with permission. PhotonII_images.tar.gz

The image matrix_01_0001.sfrm hangs dials.image_viewer or dxtbx.print_header, whilst LT1_CRUK006_10_01_0001.sfrm is fine. It seems this is due to the BrukerImage class, which sets the detectorbase for this format:
https://github.com/cctbx/cctbx_project/blob/master/dxtbx/format/FormatBrukerPhotonII.py#L70

FormatBrukerPhotonII works around deficiencies in FormatBruker (as discussed above), in such a way that the BrukerImage code is not needed (at least not required for get_raw_data). If the detectorbase line is removed, images from this detector can be processed.

However, that would be masking the problem. The real issue is that FormatBruker and BrukerImage cannot support the Photon II, at the very least because they hardcode the assumption of 1024*1024 pixel images. I had a look at the code, but haven't worked out how to fix it yet. This might need input from @nksauter. I think we have enough information now about the Bruker format (see zip file linked to above) to implement complete support for Bruker detectors, in either "86" or "100" format.

@dagewa
Copy link
Member Author

dagewa commented May 15, 2018

I should note, this is not time critical, but we do want to keep this on the radar. It seems to be possible to process most Photon II images fine. These matrix_*sfrm images are collected as part of the indexing procedure rather than full data collection.

dagewa referenced this issue in cctbx/cctbx_project Jun 26, 2018
dagewa referenced this issue in cctbx/cctbx_project Oct 3, 2018
Bruker Photon II images should be read by FormatBrukerPhotonII.
Unfortunately, FormatBrukerFixedChi understood them too if they
have 'FixedChiStage' in the header. This commit settles that
dilemma, but in the ugly way of requiring that FormatBrukerFixedChi
explicitly rejects Photon II images.

A better fix should be possible as part of the resolution of #65.
@Anthchirp Anthchirp transferred this issue from cctbx/cctbx_project Apr 18, 2019
@ndevenish ndevenish changed the title dxtbx: improve Bruker format readers improve Bruker format readers Apr 18, 2019
@ndevenish ndevenish changed the title improve Bruker format readers Improve Bruker format readers Apr 18, 2019
@dagewa
Copy link
Member Author

dagewa commented Jul 10, 2023

NB #637 extended support to the Photon-III detector

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

No branches or pull requests

2 participants