Skip to content

Add first biology example: segmentation of human cells with mitosis.#4648

Merged
jni merged 28 commits intoscikit-image:masterfrom
mkcor:add-biomed-example
Jun 14, 2020
Merged

Add first biology example: segmentation of human cells with mitosis.#4648
jni merged 28 commits intoscikit-image:masterfrom
mkcor:add-biomed-example

Conversation

@mkcor
Copy link
Copy Markdown
Member

@mkcor mkcor commented May 6, 2020

Description

This addition falls under #4601 and aims at paving the way for bioimaging examples.

At the moment, I'm fetching the example data from a public GitHub repo; I'm happy to discuss whether we should include the image in the (newly available) pooch registry.

I would like to have a professional biologist proofread my content.

Anecdotally, I'm happy to share that I have used the 'flag' colormap for the first time ever:

image

Checklist

For reviewers

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    doc/release/release_dev.rst.

@pep8speaks
Copy link
Copy Markdown

pep8speaks commented May 6, 2020

Hello @mkcor! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 29:80: E501 line too long (137 > 79 characters)

Comment last updated at 2020-06-14 20:11:40 UTC

from skimage import feature, filters, io, morphology, util


image = io.imread('https://github.com/CellProfiler/examples/blob/master/ExampleHuman/images/AS_09125_050116030001_D03f00d0.tif?raw=true')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To be safe, I would suggest to host our own copy. Any comment on this @scikit-image/core ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree but I would host it in gitlab.com/scikit-image, or a new github repo, rather than here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@sciunto thanks for reviewing! In the PR description, I wrote: "At the moment, I'm fetching the example data from a public GitHub repo; I'm happy to discuss whether we should include the image in the (newly available) pooch registry." <-- Do you have an opinion on the latter?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This was my thought, ie include it in pooch. @emmanuelle Do you agree?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok, let's host in https://gitlab.com/scikit-image/data as suggested by @jni. That will be our first image in this repo :-). When you do this @mkcor please add the origin of this image in the Readme of the repo. Then for adding the image to the registry you can copy what's done for the cells.tif dataset.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@sciunto
Copy link
Copy Markdown
Member

sciunto commented May 10, 2020

I'm not a biologist, but the example looks really cool :) After we make our decision on the image hosting, this is ready for me.

@sciunto
Copy link
Copy Markdown
Member

sciunto commented May 10, 2020

CI arror:


/home/travis/build/scikit-image/scikit-image/doc/source/auto_examples/applications/plot_human_mitosis.rst:77:undefined label: sphx-glr-auto-examples-segmentation-plot-multiotsu-py (if the link has no caption the label must precede a section header)```

@mkcor
Copy link
Copy Markdown
Member Author

mkcor commented May 10, 2020

@sciunto thanks for pointing to the specific error in the CI build; I just looked up the Sphinx docs
https://www.sphinx-doc.org/en/1.7/markup/inline.html#cross-referencing-arbitrary-locations and:

#####################################################################
# To find suitable values for thresholds and filtering parameters, we proceed
# by dichotomy, visually and manually.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here an alternative solution would be to use Hysteresis thresholding to keep connected components with values higher than the high multi-otsu threshold, but only if they also have pixels of higher value than an other (higher) threshold. This is a classical method to remove small spurious objects but have instead large smooth objects

divinding = filters.apply_hysteresis_threshold(image, thresholds[1], 1.4 * thresholds[1]), [0.5], colors="yellow"

The results are not completely the same as with the current method, but not being a biologist I would not know which result is the best.

@emmanuelle
Copy link
Copy Markdown
Member

I think one of the figures could use plt.contour on the original image to visualize the result, it's a another way to visualize a binary array which is often useful.

@emmanuelle
Copy link
Copy Markdown
Member

Thank you very much @mkcor for this very nice tutorial! You're right that it'd be great to have a review of the approach and the text by someone from life or medical sciences. Pinging @ThomasWalter and @JDWarner, and also the friends from CellProfiler who are kind enough to let us use their image @0x00b1 @AnneCarpenter

mkcor and others added 2 commits May 10, 2020 23:46
@AnneCarpenter
Copy link
Copy Markdown

It's certainly fine with the CellProfiler team to make a copy of that image if you deem that preferable.

@emmanuelle
Copy link
Copy Markdown
Member

This should be fixed in tifffile-2020.5.30, which uses a pure Python PackBits decoder in case the imagecodecs package is not installed.

Awesome thanks a lot @cgohlke. @mkcor you can bump the version of tifffile in requirements/default.txt to see if Travis gets completely green.

@mkcor
Copy link
Copy Markdown
Member Author

mkcor commented Jun 5, 2020

For me, the label2rgb default colours are too bright and there's not enough of them! We should probably change that but that should be done in another PR. =)

@jni ok, happy to leave the improvement of these colours to subsequent iterations!

I just wanted to acknowledge @alexdesiqueira's suggestion

what if we had a white background?

explicitly: I guess that, if the background is fully transparent -- as conventionally done, as @jni pointed out -- it may appear either black or white, depending on a convention(?) and/or the overlay situation.

@alexdesiqueira
Copy link
Copy Markdown
Member

@jni:

For me, the label2rgb default colours are too bright and there's not enough of them! We should probably change that but that should be done in another PR. =)

@mkcor please don't mind me then! This PR is great as is right now 🙂

@mkcor
Copy link
Copy Markdown
Member Author

mkcor commented Jun 10, 2020

@emmanuelle I was about to update the changelog to acknowledge the reviewers on the biology side; just to make sure, is https://github.com/scikit-image/scikit-image/blob/master/doc/release/release_dev.rst the right file for me to update?

@mkcor
Copy link
Copy Markdown
Member Author

mkcor commented Jun 11, 2020

I think one of the figures could use plt.contour on the original image to visualize the result, it's a another way to visualize a binary array which is often useful.

@emmanuelle done 6819653. I thought that the segment counts would be a nice transition into the mitotic index discussion.

PS: By 'binary array' I understand that you mean mono-channel image, right?

@emmanuelle
Copy link
Copy Markdown
Member

@emmanuelle I was about to update the changelog to acknowledge the reviewers on the biology side; just to make sure, is https://github.com/scikit-image/scikit-image/blob/master/doc/release/release_dev.rst the right file for me to update?

Yes exactly! As you're editing this file you can also add an entry about your tutorial (see for example the changelog of 0.17 as an example)

@emmanuelle
Copy link
Copy Markdown
Member

In the gallery the thumbnail is very dark (as in the attached picture)
image. Maybe you could take one of the other images of the tutorial like the one with contours which is on a white background? See https://github.com/scikit-image/scikit-image/blob/master/doc/examples/transform/plot_transform_types.py#L129 for how this is done. I tried with the image #2 for example
image

@emmanuelle
Copy link
Copy Markdown
Member

The CI failure has nothing to do with this PR (I'm working on it BTW).

@emmanuelle
Copy link
Copy Markdown
Member

I think one of the figures could use plt.contour on the original image to visualize the result, it's a another way to visualize a binary array which is often useful.

@emmanuelle done 6819653. I thought that the segment counts would be a nice transition into the mitotic index discussion.

PS: By 'binary array' I understand that you mean mono-channel image, right?

The way you've used contours is cool, indeed. I was thinking more of representing the 0.5 contour of a binary 0-1 / False-True array, so that the contour is the boundary between False and True, it can be a nice viz to superimpose such a contour over the initial image so that you can see both the image and its segmentation. But never mind it's not crucial here.

@emmanuelle emmanuelle self-requested a review June 12, 2020 21:21
Copy link
Copy Markdown
Member

@emmanuelle emmanuelle left a comment

Choose a reason for hiding this comment

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

Approved once the warning raised by the watershed has been fixed. Thank you @mkcor!

@mkcor
Copy link
Copy Markdown
Member Author

mkcor commented Jun 13, 2020

Thank you for the detailed review, @emmanuelle!
I will load the original image from https://gitlab.com/scikit-image/data/ via pooch in a subsequent PR.
I will also follow up with the scientific reviewers.

Copy link
Copy Markdown
Member

@jni jni left a comment

Choose a reason for hiding this comment

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

@mkcor this is basically ready! I've made a small formatting suggestion to the release note update, as it needs to be a bullet point rather than a paragraph. I've also added another question for discussion about the dependency, but imho this can be merged without that suggestion, just wanted to flag it. Thanks! 🎉

Copy link
Copy Markdown
Member

@jni jni left a comment

Choose a reason for hiding this comment

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

🎉

@jni jni merged commit a092fdd into scikit-image:master Jun 14, 2020
@emmanuelle
Copy link
Copy Markdown
Member

thank you all!

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.

10 participants