Skip to content
This repository has been archived by the owner on Jan 3, 2018. It is now read-only.

Medical image processing in the IPython Notebook #529

Merged
merged 5 commits into from
Sep 29, 2014

Conversation

badger-d
Copy link

@badger-d badger-d commented Jun 6, 2014

I have added the ipynb I have developed for helping to teach people the basics of image analysis and quantification in medical imaging.

@jmetz
Copy link

jmetz commented Jun 10, 2014

Overall - great stuff!
Some minor general suggestions / recommendations:

  1. Perhaps if you also include generated html (using nbconvert) line-specific comments can also be added.
  2. While visualization of data is important, I felt that this takes up a disproportionally large amount of space in an image analysis tutorial; I'd cut down the section regarding creating a properly positioned colorbar to the essentials / a summary.
  3. Similarly, I'd remove the exercise requiring proper colormap placement (unless this is specifically also supposed to cover a fair amount of plotting/visualization material).
  4. Above cell 13, mention using the copy library (and import it in cell 13), but then numpy's implicit ndarray.copy method is used instead.
  5. "Pixel number" possibly best replaced by "column index" and "row index" or just "x" and "y" as axes labels for images?
  6. With the space from having condensed the plotting entries, add mention of filters - perhaps give an example of scipy.ndimage.gaussian_filter, or sobel?
  7. Include a motivation for histogram fitting - i.e. answer the question "what's the use (w.r.t. image analysis / processing) of fitting a gaussian to the intensity histogram?" - perhaps in the context of background modelling/estimation?
  8. Include some exercises where experimentation with different filters / filter chains is explored.
  9. ... leads on to discussion of most common image processing tasks (detection / segmentation, de-noising, etc.), and an intro to how one can go about tackling these using scipy.ndimage.
  10. Perhaps also give a mention of opencv and scikit-image

@gdevenyi
Copy link
Contributor

Looking at the content now, but a comment, the origins of Lenna might be a bit inappropriate:
https://en.wikipedia.org/wiki/Lenna

@gdevenyi
Copy link
Contributor

Rather than having the users download the png file, you could load it directly from a URL see
https://scipy-lectures.github.io/packages/scikit-image/#id5

@gdevenyi
Copy link
Contributor

The time you spend plotting and making the plot is a bit too long, consider cutting out some of the plotting things so that you can get to the analysis earlier.

@gvwilson
Copy link
Contributor

I'd prefer some other image as well.

@wltrimbl
Copy link

If we want to use portraits of women, we should use portraits of leaders, not models.

We need a color image that contains objects of a few different colors (and can do better than Lena in this regard).

A portrait of Toni Morrison with colorful flowers would be very good:
https://www.flickr.com/photos/west_point/8598065308/in/photostream/
but I can't tell if the license
https://creativecommons.org/licenses/by-nc-nd/2.0/
is suitable.

Here are some (probably public domain) photographs of government scientists that might serve:
http://www.nist.gov/public_affairs/releases/jin.cfm Debbie Jin
http://www.nrl.navy.mil/media/news-releases/2012/NRL-WISE-Hosts-NIST-Physicist-Dr-Katharine-Gebbie
http://www.history.navy.mil/photos/images/h96000/h96919k.jpg

@gvwilson
Copy link
Contributor

I believe this image:
http://en.wikipedia.org/wiki/Sally_Ride#mediaviewer/File:Ride-s.jpg is
public domain.

@wltrimbl
Copy link

I've tried editing the notebook to replace Lena with Sally Ride, the results are here:

https://github.com/wltrimbl/bc/commits/replacemodel

http://nbviewer.ipython.org/github/wltrimbl/bc/blob/replacemodel/intermediate/python/SoftwareCarpentryDev_MRD_WithSolutions.ipynb

Some notes along the way:

The use of two different sources of the test image in different formats--one from wikipedia (in lenaPNG) and one from scipy.misc (in lenaSciPy)--is confusing. I think the lesson would flow better if there were a single source of the test image. lenaSciPy is grayscale, and you only use it for showing off colormaps. I have tried defining graySally early on, and used it for the black-and-white graphs.

There was a manual histogram parameter that needed to be changed.

An explicit format conversion back to uint8 was useful as well.

The conversion from three channels to monochrome was done twice, and was done twice deliberately. Unfortunately the first definition of redSally and the second definition of redSally differ by a transpose. I renamed the temporary variables (redSallyT) to prevent redSally from having different dimensions at different parts of the program.

The brightness histogram of Sally is multimodal.

The text still alludes to Lena, and there is no reason not to mention her as the placeholder image for EE textbooks for the last quarter of the 20th century.

@wltrimbl
Copy link

Comments apart from choice of model:

In the first imshow, it appears as if the colormap (and the color bar) are ignored because the image is RGB. This is somewhat confusing.

"dot matrix of data." The meaning of this phrase is not completely transparent to me. Perhaps "two- or three- dimensional matrix of pixel values?"

Facts about the digital encoding of images, particularly color images, are not in the numbered list at the top, but are in the lesson. "As medical images may be optical or non-optical..." I think you need text here about the character of color, monochrome, and false-color images instead of text describing the machinery that might produce the images.

The histogram is important--it looks like it would be useful to present before thresholding, near "Image Data Manipulation".

The label # Generate a mask by simple thresholding. is duplicated.

Labels that make the code blocks easier to recognize (and tell apart) might be helpful.

The purpose of the ROI (on a portrait) is not manifestly clear. "Suppose we are trying to build a model of the background separate from our model of the model/astronaut..." perhaps?

@gvwilson gvwilson changed the title Init. commit of (medical) image processing ipynb. Medical image processing in the IPython Notebook Jun 22, 2014
@areff2000
Copy link

I searched Research Data Australia (where I work; ANDS) for example images:

  1. brain images (found none).
  2. medical imaging and found an interesting one.
    Titled: Analysis of cell death in U2Os cells
    http://researchdata.ands.org.au/analysis-cell-death-u2os-cells/341544
    Data is at UTS, University of Technology Sydney:
    http://data.research.uts.edu.au/dataset/au.edu.uts641

Data is 210Mb, in nd2 format, with link provided to imaging software:

The ND2 files are produced in Nikon NIS Elements 3.22.11 and viewable as 'movies' in NIS Elements. http://www.nikoninstruments.com/en_GB/Products/Software/NIS-Elements-Viewer.

@areff2000
Copy link

Tip to finding data in Research Data Australia: (RDA is a metadata data description discovery service);

  • Use the Licence facet to choose only data with Open Data Licence. These records will have the data attached. Many researchers have data descriptions but because of a non-open licence do not provide a link to the data directly.

@badger-d
Copy link
Author

Updated content to include previous suggestions. Moved away from using Lena to Sally Ride.

gvwilson pushed a commit that referenced this pull request Sep 29, 2014
Medical image processing in the IPython Notebook
@gvwilson gvwilson merged commit 990893b into swcarpentry:master Sep 29, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants