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

need to look into the function of "center of mass" for alignment #49

Open
sichendart opened this issue Feb 4, 2020 · 2 comments
Open

Comments

@sichendart
Copy link
Contributor

the results could be very different by clicking "center of mass" multiple times

@decarlof
Copy link
Member

decarlof commented Feb 9, 2020

For beamline auto alignment I am using regionprops.

My code is something like this:

from skimage.measure import regionprops

def center_of_mass(image):
    
    threshold_value = filters.threshold_otsu(image)
    log.info("  *** threshold_value: %f" % (threshold_value))
    labeled_foreground = (image < threshold_value).astype(int)
    properties = regionprops(labeled_foreground, image)
    return properties[0].weighted_centroid


cmass = center_of_mass(image)
log.info('  *** center of mass: [%f, %f]' % (cmass[0], cmass[1]))

@FabricioSMarin
Copy link
Collaborator

@decarlof The example code I came across is similar to this one, but they have a greater-than sign instead of a less -than sign. Either way it works well.
I added this and a pop-up menu to select between weighted and non-weighted COM options as well as shifting in x only or x and y.

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

3 participants