Skip to content

Proposal to add 3D image to skimage.data #2513

Closed

Description

@mcquin

Hi folks,

I've been working on supporting volumetric image processing in CellProfiler for the last few months. I've had to manufacture much of my own 3D data for validation and testing. While creating image stacks is simple enough, I wonder if some real-world 3D image data might be a useful addition to skimage.data.

I have cell data from our collaborators at the Allen Institute for Cell Science which they are happy to contribute. There are two available images of size (60, 1024, 1024, 4) and (65, 1024, 1024, 4). Not all channels are necessary for a sample image; a single-channel 3D image would be sufficient. I primarily concentrate on the membrane channel:

membrane

and the nucleus channel:

nuc

What do you think?

Activity

  1. soupault commented on Feb 15, 2017

    @soupault
    Member

    @mcquin Hi! Short answer - absolutely yes! We've been looking for a sample since, at least, #1923 (see the discussion there).

    Could you clarify the meaning of different dimensions of (60, 1024, 1024, 4)? As I understand, there are 60 slices of 1024x1024 images. What does 4 stand for?

  2. mcquin commented on Feb 15, 2017

    @mcquin
    Author

    @soupault Fantastic!

    Correct, the image dimensions are described by (plane, x, y, channel). I think the nucleus channel is probably the most useful.

    Would you like me to submit the raw image as a numpy array? Or would a cleaned up image be preferred? I am also thinking that the slices that are entirely noise (approximately 10 slices at the top and bottom) could be removed, and the image could be cropped or rescaled to 512x512 in the xy-dimensions to save space.

  3. sciunto commented on Feb 16, 2017

    @sciunto
    Member

    That's great. I'm also +1 for the nucleus channel. Space is of course a limitation and your suggestion sounds good to me.

  4. sciunto commented on Feb 16, 2017

    @sciunto
    Member
  5. soupault commented on Feb 16, 2017

    @soupault
    Member

    @mcquin is that "pure" volumetric data (i.e. is the distance between 2 adjacent planes equal to the distance between adjacent pixels in x*y)?

  6. mcquin commented on Feb 16, 2017

    @mcquin
    Author

    @soupault Great question. The image is not a true volume. The resolution in the z-dimension is much lower than the resolution in the xy-dimension. I don't have the exact voxel spacing, but I can get that information from the people who produced the image.

  7. sciunto commented on Feb 16, 2017

    @sciunto
    Member

    @mcquin We need also the permission if you are not the author. Ideally, CC0 public domain.

  8. stefanv commented on Feb 16, 2017

    @stefanv
    Member

    @mcquin Thank you very much for this contribution! It looks like the relevant points are being addressed: meta-data (as much as we can obtain) and license. Also a mention of the Allen institute in the function that loads the data would be good.

  9. soupault commented on Feb 17, 2017

    @soupault
    Member

    I think that it would be better to add some true volumetric 3D image, and add a function to skimage.data with the parameter to choose between true volume and sliced versions (should be easily done via numpy indexing).
    My point is that for many algorithms, such as denoising, skeletonization, inpainting, 3D morphology, etc, true volume is expected, so it will be beneficial to have one. (not saying that the sliced version is of no use)

    @mcquin Is there something of this kind either you or Allen Institute able to provide?

  10. mcquin commented on Feb 17, 2017

    @mcquin
    Author

    @soupault I can't provide any true volume data. This is a result of how the volume is constructed. Each plane is an image captured at a different height of the well in which the cells grow.

    I agree that a true volume would be useful, but such data is not available to me. I work entirely with anisotropic volumes.

  11. grlee77 commented on Feb 17, 2017

    @grlee77
    Contributor

    Two other possibilities for 3D data:

    1.) There are a number of 3D brain MRI datasets that are publicly available online. For example, the 1mm isotriopic resolution brain atlases at the following link are around 50-60 MB, but if only a single contrast is retained the file would be around 10-20 MB:
    http://www.bic.mni.mcgill.ca/ServicesAtlases/ICBM152NLin2009
    If there is interest in this approach I would be willing to convert one of these from the domain-specific NIFTI format to a standard numpy .npy file (e.g. by using nibabel) and make a PR.

    2.) implement a digital phantom that can be defined analytically so that no dataset has to be stored. For instance, there is a 3D variant of the Shepp-Logan phantom (example Matlab implementation: https://www.mathworks.com/matlabcentral/fileexchange/9416-3d-shepp-logan-phantom ). Drawbacks are that someone would have to take time to port to python and a piecewise-constant phantom may not be realistic for some applications.

  12. soupault commented on Feb 19, 2017

    @soupault
    Member

    Thanks for you comments!
    I'd be be in favour adding the brain MRI scans from @grlee77, and not a synthetic data.

    Regarding the sliced one from @mcquin: I do not work with such data, so I let other core devs to decide. Will support any decision.

  13. jni commented on Feb 20, 2017

    @jni
    Member

    Hi all!

    Thanks @mcquin for this! I actually think keeping multiple channels is beneficial, in terms of having a very generic high-dimensional array example.

    (Also, in this project, please refer to coords as (plane, row, column, channel), to avoid confusion with Cartesian x/y (where x is typically the horizontal coordinates). We are still trying to clean up various parts of the project because we were lackadaisical about this in the early days. =P)

    @soupault I think it is very valuable to have anisotropic data. Many algorithms are isotropic only by historical accident. Having an anisotropic example by default might encourage future contributors to consider this use case from the start. =)

    So my vote would be to include this dataset as well as the MRI dataset suggested by @grlee77.

    These datasets are indeed huge though, and I don't know that I would want them distributed with skimage by default — perhaps they can be downloaded on-demand? I've also used github-lfs in the past and quite like it, though others might rightly object to its non-standardness.

    As to the metadata, how about adding a load_<img>_metadata function that returns a dictionary? We can discuss handling metadata dictionaries in various functions later. ;)

  14. grlee77 commented on Feb 20, 2017

    @grlee77
    Contributor

    The 3D brain suggestion was intended to be in addition to the dataset mentioned by the author of this PR. Certainly there is value in having a range of example data for different use cases!

    Along the lines of @jni's suggestion to download on-demand, I would point to the example of the data fetchers used by the Diffusion Imaging in Python project dipy. Specifically:
    https://github.com/nipy/dipy/blob/master/dipy/data/fetcher.py

    The file above is under a BSD 3-clause license. It has various "fetcher" routines that handle downloading large example datasets from a remote location to a folder in the user's home directory (~/.dipy), and then checking their md5 sums. (There is even already a fetcher there for the MNI brain atlas I mentioned previously, but as mentioned above, we would want to use a simple .npy array rather than the NIFTI neuroimaging data format to avoid introducing any new dependencies to scikit-image).

  15. mcquin commented on Feb 20, 2017

    @mcquin
    Author

    Having an anisotropic example by default might encourage future contributors to consider this use case from the start.

    I hope for this future so much. :)

    I have information on the resolution of the image: 0.29 x 0.065 x 0.065 um.

    As to the metadata, how about adding a load_<img>_metadata function that returns a dictionary?

    Great idea! I think "spacing" -> Tuple and "multichannel" -> Boolean are useful. The image dimensionality can be inferred from either of those values. For my own clarification, multichannel typically means RGB/RGBA?

    I actually think keeping multiple channels is beneficial, in terms of having a very generic high-dimensional array example.

    Nice! I think this data would make for an interesting example with all channels. I'll find out from our collaborators what each channel represents. This could be provided with the image metadata, or in the image documentation. I'm less concerned with data size if we're thinking about remote download.

    It has various "fetcher" routines that handle downloading large example datasets from a remote location to a folder in the user's home directory (~/.dipy), and then checking their md5 sums.

    This is a solid pattern.

    I'm not familiar with git-lfs. I'd be concerned about storing large image data on GitHub since repositories are generally limited to 1 GB.

    The 3D brain suggestion was intended to be in addition to the dataset mentioned by the author of this PR. Certainly there is value in having a range of example data for different use cases!

    Yeah!! I love the breadth of the 2D examples. It would be wonderful to have just as many diverse examples of 3D data.

  16. jni commented on Feb 20, 2017

    @jni
    Member

    Great idea! I think "spacing" -> Tuple and "multichannel" -> Boolean are useful.

    Yes. If we do implement meta=, I would also suggest that we introduce aliases. "spacing", "scale", "scaling", and "resolution" have been variously proposed for this purpose. For kwargs we had to unify but for meta we can include common synonyms.

    For my own clarification, multichannel typically means RGB/RGBA?

    Typically, yes, but we want to aim to be general here also. It can also mean other colorspaces (such as Lab), or multispectral data (as in many microscopy applications). So I very much like having a four channel example image. =)

  17. stefanv commented on Feb 20, 2017

    @stefanv
    Member

    @grlee77 and @matthew-brett, who work with Nifti files, would perhaps be able to comment on the kinds of metadata they find useful in neuroimaging. Can we transfer that experience to the question of which types of image metadata we should care about?

  18. grlee77 commented on Feb 21, 2017

    @grlee77
    Contributor

    Unlike the DICOM format, NIFTI does not retain a ton of metadata. Primarily it has information related to voxel dimensions and patient orientation (as defined by a 4x4 affine matrix) so that the user can accurately distinguish left from right etc. Obviously orientation info is very important clinically or when reporting research results, but not so much when using as a generic example volume in scikit-image to demonstrate denoising/segmentation/etc.

    I think for scikit-image purposes, just having the "spacing"/"scaling" info and whether or not the data is "multichannel" should be sufficient.

  19. grlee77 commented on Feb 21, 2017

    @grlee77
    Contributor

    I should also mention that a variety of data types (char, unsigned int, float, complex) can be stored in NIFTI files. For use in scikit image, rescaling the absolute intensities to floats in the range [0, 1] is probably most appropriate.

  20. mcquin commented on Feb 22, 2017

    @mcquin
    Author

    It seems like a few things will need to be in place before any 3D data can be submitted:

    1. A decision on where to host the images.
    2. Implementation of image fetching and local caching.
    3. Metadata format and required fields.

    I'm often 👎 on a gigantic issue thread covering several topics (but I'll admit that's largely a personal preference). Is there any need to break these components out into separate issues and continue discussion there?


    We need also the permission if you are not the author. Ideally, CC0 public domain.

    @sciunto My collaborators are wondering how to give this permission. Do you require a license file with the data, an email expressing permission, or something else?

  21. grlee77 commented on Feb 24, 2017

    @grlee77
    Contributor

    +1 on splitting to separate issues. that way this one can stay focused more narrowly on the Allen Institute dataset

  22. sciunto commented on Apr 9, 2017

    @sciunto
    Member

    @mcquin I think we never set such rules so far. @stefanv can confirm.

  23. stefanv commented on Sep 12, 2018

    @stefanv
    Member
  24. mcquin commented on Sep 13, 2018

    @mcquin
    Author

    @stefanv Yep, same image. The license is CC0.

  25. locked and limited conversation to collaborators on Oct 18, 2021
  26. unlocked this conversation on Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions