Skip to content

Conversation

@nvaytet
Copy link
Member

@nvaytet nvaytet commented Jul 25, 2025

This adds utilities to compute image sharpness which is used to find the focus point of an imaging detector.

A recording will typically have one image for each camera stage position.
We compute the sharpness of each one of these images, and find the sharpest one which is deemed to be the focus point of the camera.

This is not currently integrated into a full GenericNeXusWorkflow because it is still unclear how the position of the camera will be recorded in the nexus file. Right now, it is recorded in a separate NXlog (camera_stage/position_setpoint), instead of being recorded as a time-dependent translation of the imaging detector.
We don't know if this will still be the case in production.

The notebook produces this plot which shows how the focus point is found
Screenshot_20250725_162316

@nvaytet nvaytet requested a review from YooSunYoung July 25, 2025 14:23


def resample(
image: sc.Variable | sc.DataArray, sizes: dict[str, int], method: str = 'sum'
Copy link
Member

Choose a reason for hiding this comment

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

How about directly passing a callable object as a method argument?

Copy link
Member

@YooSunYoung YooSunYoung left a comment

Choose a reason for hiding this comment

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

I only had a minor comment.

Comment on lines 82 to 84
# if isinstance(image, sc.DataArray):
# image = image.data

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# if isinstance(image, sc.DataArray):
# image = image.data

@nvaytet nvaytet merged commit 0f010db into main Aug 6, 2025
4 checks passed
@nvaytet nvaytet deleted the image_sharpness branch August 6, 2025 11:56
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

Successfully merging this pull request may close these issues.

3 participants