Skip to content

Mask python training example#4415

Merged
joshmoore merged 4 commits intoome:developfrom
joshmoore:mask_python_training_example
Jan 25, 2016
Merged

Mask python training example#4415
joshmoore merged 4 commits intoome:developfrom
joshmoore:mask_python_training_example

Conversation

@joshmoore
Copy link
Copy Markdown
Member

@joshmoore joshmoore force-pushed the mask_python_training_example branch from fff21d1 to 39bd64c Compare January 18, 2016 13:18
@will-moore
Copy link
Copy Markdown
Member

@joshmoore https://ci.openmicroscopy.org/view/Failing/job/OMERO-DEV-merge-training/214/console failed with

File "/opt/hudson/workspace/OMERO-DEV-merge-training/src/examples/Training/python/ROIs.py", line 141, in <module>
    mask_array = mask_array.tobytes()
AttributeError: 'numpy.ndarray' object has no attribute 'tobytes'

@sbesson
Copy link
Copy Markdown
Member

sbesson commented Jan 19, 2016

@will-moore: reading the commit history, I suspect 69c1e50e0afe7ee96de114806a1b8e2c145334f6 will fix this failure in tomorrow's build

@will-moore
Copy link
Copy Markdown
Member

This seems to be working fine.
I'd really like to try and display the mask in web (as on https://trello.com/c/H1MePy2A/124-mask-support-in-web) and wondered if @emilroz had the "reverse" code in hand to get from OMERO into a PIL image (mask) ideally. Otherwise I should be able to work something out, but didn't want to duplicate effort etc.

@emilroz
Copy link
Copy Markdown
Member

emilroz commented Jan 21, 2016

@will-moore we've have never looked into doing it the other way round (it should be rather straight forward), since the rendering engine has the ability to render the masks. In principle you can request an image with a mask on it from the server. The only problem doing it this way is the fact that it supports only the masks that match the image plane size.

@will-moore
Copy link
Copy Markdown
Member

@joshmoore I wonder if it's slightly nicer to use something like this instead of random array, since then if you're doing some subsequent work with the mask, you have some idea if it's working/looking right?

# Create [0, 1] mask
def f(x, y):
    return (x * y) % 2
mask_array = numpy.fromfunction(f, (mask_w, mask_h))

@will-moore will-moore mentioned this pull request Jan 22, 2016
Emil pointed out that tobytes has been removed
in later numpy versions since both methods were
identical.
@joshmoore joshmoore force-pushed the mask_python_training_example branch from 69c1e50 to b273a07 Compare January 24, 2016 18:51
@joshmoore
Copy link
Copy Markdown
Member Author

Rebased and force pushed on top of 4412 and added @will-moore's non-random mask suggestion.

@joshmoore joshmoore force-pushed the mask_python_training_example branch from b273a07 to 23edf1d Compare January 24, 2016 18:55
@will-moore
Copy link
Copy Markdown
Member

Working fine. Good to merge.

joshmoore added a commit that referenced this pull request Jan 25, 2016
@joshmoore joshmoore merged commit a3f9da3 into ome:develop Jan 25, 2016
@jburel jburel added this to the 5.2.2 milestone Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants