-
Notifications
You must be signed in to change notification settings - Fork 97
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
Manage orientation of detector #2001
Conversation
Rotate90 = 8 | ||
|
||
Orientation(0).__doc__ = "An orientation flag is not set." | ||
Orientation(1).__doc__ = "Camera default. Origin at the top left of the image when looking at the sample." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So origin at top right when looking from the sample ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This enum is the default one used in EXIF, for visible light cameras.
In pyFAI, the origin is at the bottom left when looking from the sample. Thus the orientation should be flipped-ud for the origin at the bottom and flipped-rl to change the direction of sight. This makes the default orientation used in pyFAI to 3
or Rotate180
.
I just got the answer from Dectris that their detector have to be seen from the sample and not from the other side.
At this stage, orientation is just shipped around and used nowhere ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
When speaking about images, looking at the detector from the sample makes sense. Looking at the sample from the detector is a bit harder to figure out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the sample is the standard when considering camera ... outside the X-ray scattering world.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. After thinking again about it this morning, this is indeed just a personal feeling.
remains 2 failures 2 errors
I believe this PR is beefy enough -> ready for merge (once test pass) |
Checked with Edgar that flipped image can be processed as expected. "just" declare an orientation different from "3" |
src/pyFAI/detectors/_rayonix.py
Outdated
@@ -640,4 +643,5 @@ def set_config(self, config): | |||
raise err | |||
self.set_pixel1(config.get("pixel1")) | |||
self.set_pixel2(config.get("pixel2")) | |||
self.orientation = Orientation(config.get("orientatio", 3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.orientation = Orientation(config.get("orientatio", 3)) | |
self.orientation = Orientation(config.get("orientation", 3)) |
src/pyFAI/test/test_geometry.py
Outdated
@@ -348,6 +361,8 @@ def test_corner_array(self): | |||
for data, space in params: | |||
with self.subTest(data=data, space=space): | |||
geo = geometry.Geometry(**data) | |||
print(data) | |||
print(geo.detector.orientation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be removed, I guess.
this means one fiddles with it at ones' own risk
Co-authored-by: Loïc Huder <[email protected]>
Co-authored-by: Loïc Huder <[email protected]>
Co-authored-by: Loïc Huder <[email protected]>
Co-authored-by: Loïc Huder <[email protected]>
Co-authored-by: Loïc Huder <[email protected]>
Co-authored-by: Loïc Huder <[email protected]>
Co-authored-by: Loïc Huder <[email protected]>
7d9e966
to
f68cc43
Compare
It does fix the dioptas incompatibility. |
src/pyFAI/detectors/orientation.py
Outdated
Orientation(0).__doc__ = "An orientation flag is not set." | ||
Orientation(1).__doc__ = "Camera default. Origin at the top left of the image when looking at the sample." | ||
Orientation(2).__doc__ = "Origin at the top left of the image when looking from the sample." | ||
Orientation(3).__doc__ = "Native orientation of pyFAI. Origin at the bottom left when looking from the sample" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me. If I understood, choosing the orientation 3 (native pyFAI) would be equal to 0 (default, non-defined) during the calculation of pixel coordinates?
Edit: Yes :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well spotted
Co-authored-by: Edgar Gutierrez <[email protected]>
attn @CPrescher, a "detector orientation tag" has been added to pyFAI to deal with image flip (not released yet). |
This is likely to be a beefy one ...
Ensurethe Detector cache gets reset when changing the orientation (--> use a property)Ensurethe geometry cache gets reset when changing the orientation ( what is the best way of doing this ?)close #1994