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

Basic image segmentation post (with dask-image) #82

Merged

Conversation

GenevieveBuckley
Copy link
Collaborator

Outline for a blogpost on a basic image segmentation pipeline using dask-image. See #47 (comment)

Content from github.com/GenevieveBuckley/dask-image-talk-2020

@GenevieveBuckley GenevieveBuckley marked this pull request as draft March 8, 2021 08:10
```

![Label image napari screenshot](../images/2021-image-segmentation/napari-label-image.png)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

"Eagle eyed readers will notice that not every nucleus is separated perfectly from its neighbours" (& add link to Nick or Juan's napari interactive segmentation tutorial?)


![Label image napari screenshot](../images/2021-image-segmentation/napari-label-image.png)


Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would be good to have a section on piping the output into a Dask dataframe directly

@GenevieveBuckley GenevieveBuckley marked this pull request as ready for review March 12, 2021 08:29
@GenevieveBuckley
Copy link
Collaborator Author

This has been up for long enough that people have had a fair chance to leave comments, so I'm going to go ahead and merge it now.

@GenevieveBuckley GenevieveBuckley merged commit d172792 into dask:gh-pages Mar 22, 2021
@GenevieveBuckley
Copy link
Collaborator Author

I did think about whether this should have been a runnable notebook in the dask-examples, but I don't think we can stay under the suggested 2GB memory limitation for it.

@jakirkham
Copy link
Member

Sorry didn't know this was here 😅

Anyways this looks great! Thanks for doing this 😄

@GenevieveBuckley GenevieveBuckley deleted the segmentation-pipeline branch March 30, 2021 23:18
@GenevieveBuckley
Copy link
Collaborator Author

Sorry didn't know this was here sweat_smile

That's probably my fault @jakirkham, I'll try to remember to ping you by name on future posts in your area of interest.

Anyways this looks great! Thanks for doing this smile

Thanks! It's clunky in two areas:

  1. At the end of the pipeline, it would be better to put the results into a dask dataframe (one row per nucleus, with measurements of area & intensity). I wasn't sure how to do that well, but I also didn't spend much time trying. Adding this to examples would be useful.
  2. No watershed in dask-image, which is an issue even in this small example. I know that's a technically difficult problem (Added a port of scipy.ndimage.measurement.watershed. dask-image#99 is stalled)

@jakirkham
Copy link
Member

Not at all. It's been a pretty busy month anyways

Idk what parts were tricky with converting to Dask Dataframes, but maybe this simple example helps? If not, would be curious to know where the issues are

In [1]: import numpy as np
   ...: import pandas as pd
   ...: import dask
   ...: import dask.array as da
   ...: import dask.dataframe as dd

In [2]: a = da.stack(3 * [da.arange(1_000, chunks=100)])
   ...: a
Out[2]: dask.array<stack, shape=(3, 1000), dtype=int64, chunksize=(1, 100), chunktype=numpy.ndarray>

In [3]: d = a.T.to_dask_dataframe(["a", "b", "c"])
   ...: d
Out[3]: 
Dask DataFrame Structure:
                    a      b      c
npartitions=10                     
0               int64  int64  int64
100               ...    ...    ...
...               ...    ...    ...
900               ...    ...    ...
999               ...    ...    ...
Dask Name: from-dask, 90 tasks

Yeah that's true remembering talking to Juan about this after we finished connected components. It's tricky, but may be doable

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.

2 participants