Code Monkey home page Code Monkey logo

skimage-tutorials's Introduction

scikit-image tutorials

A collection of tutorials for the scikit-image package.

Launch the tutorial notebooks directly with MyBinder now:

Binder

Or you can setup and run on your local machine:

  1. Follow the preparation instructions
  2. Start the notebook server from the same directory as this README with jupyter notebook

Refer to the gallery as well as scikit-image demos for more examples.

Usage

These usage guidelines are based on goodwill. They are not a legal contract.

The scikit-image team requests that you follow these guidelines if you use these materials in downstream projects.

All materials in this repository are available free of restriction under the Creative Commons CC0 1.0 Universal Public Domain Dedication (see LICENSE.txt).

However, we ask that you actively acknowledge and give attribution to this repo and to the authors if you reproduce them or create any derivative works. Specifically:

  • Keep the CC0 Public Domain Dedication intact when reusing large portions of the material (such as an entire lecture), so that others may benefit from the same license you did.

  • Do not represent yourself as the author of re-used material.

For more information on these guidelines, which are sometimes known as CC0 (+BY), see this blog post by Dan Cohen.

Contributing

If you make any modifications to these tutorials that you think would benefit the community at large, please create a pull request!

skimage-tutorials's People

Contributors

blink1073 avatar emmanuelle avatar genevievebuckley avatar jdwarner avatar jni avatar katrinleinweber avatar lagru avatar lmmx avatar mkcor avatar nellev avatar richardbeare avatar rossbar avatar sciunto avatar soupault avatar stefanv avatar tonysyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skimage-tutorials's Issues

Unable to build site locally

I've attempted to build the site locally through various methods, including via the Makefile and with jupyter-book. So far, I haven't been successful with either approach. When I try to build with the Makefile (after manually installing the dependencies to work around #63) I see the following:

make[1]: *** book: No such file or directory.  Stop.
make: *** [Makefile:37: html] Error 2

I tried working through some of the other steps in the Makefile manually, but haven't been able to progress to getting the site built.

When I try with jupyter-book (e.g. jb build .) I see the following:

jb build output
Running Jupyter-Book v0.11.3
Traceback (most recent call last):
  File "/home/ross/.virtualenvs/skimage-tutorials/lib/python3.9/site-packages/jupyter_book/cli/main.py", line 244, in build
    parse_toc_yaml(toc)
  File "/home/ross/.virtualenvs/skimage-tutorials/lib/python3.9/site-packages/sphinx_external_toc/parsing.py", line 82, in parse_toc_yaml
    return parse_toc_data(data)
  File "/home/ross/.virtualenvs/skimage-tutorials/lib/python3.9/site-packages/sphinx_external_toc/parsing.py", line 88, in parse_toc_data
    raise MalformedError(f"toc is not a mapping: {type(data)}")
sphinx_external_toc.parsing.MalformedError: toc is not a mapping: 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ross/.virtualenvs/skimage-tutorials/bin/jb", line 8, in
sys.exit(main())
File "/home/ross/.virtualenvs/skimage-tutorials/lib/python3.9/site-packages/click/core.py", line 829, in call
return self.main(*args, **kwargs)
File "/home/ross/.virtualenvs/skimage-tutorials/lib/python3.9/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/ross/.virtualenvs/skimage-tutorials/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/ross/.virtualenvs/skimage-tutorials/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/ross/.virtualenvs/skimage-tutorials/lib/python3.9/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/ross/.virtualenvs/skimage-tutorials/lib/python3.9/site-packages/jupyter_book/cli/main.py", line 246, in build
_error(
File "/home/ross/.virtualenvs/skimage-tutorials/lib/python3.9/site-packages/jupyter_book/utils.py", line 48, in _error
raise kind(box)
RuntimeError:

The Table of Contents file is malformed: toc is not a mapping: <class 'list'>
You may need to migrate from the old format, using:

    jupyter-book toc migrate /home/ross/repos/skimage-tutorials/_toc.yml -o /home/ross/repos/skimage-tutorials/_toc.yml

===============================================================================

Start every notebook with `from __future__ import division`

We will have people using both Python 2 and Python 3 at tutorial sessions for the forseeable future. This is just prudent to keep us out of trouble.

If a print statement is ever used in a cell, it would also be reasonable to import print_function in that notebook.

Personally I like this to be cell zero, even before the title, along with %matplotlib inline, in the style of scikit-learn.

Image moments tutorial

As discussed a couple months back I've put together a tutorial on image moments from some notes for a particular project. I've put it in its own repo here for now and can submit a PR when it's improved and meets the format for this repo.

Tutorial outline

  • The tutorial gives a background introducing what image moments are and then shows how to calculate them in scikit-image.
    • Since it's reasonable(?) to assume images are going to be discrete when working with scikit-image, I quickly dropped the integral notation for summation
  • After the technical intro, there's a practical extension on drawing a "clock" and showing how it's possible to "tell the time" (or not quite!) by using the orientation obtained from SVD on the covariance matrix formed from the 2nd order central moments matrix.
  • Lastly there's a brief note on some further reading where the topic can be explained in greater depth

Interactivity

I used ipywidgets to make an interactive slider so the "clock hand" could be moved around and the effect on the image moment-derived orientation could be observed directly by the reader, however all the web platforms I've looked at seem to remove this functionality and I've saved the widget state so it's now viewable on nbviewer

Screenshot from 2021-06-23 15-33-37
Screenshot from 2021-06-23 15-33-16

The interactive widgets are usable in Binder (I used f strings so it requires 3.8 and binder default is 3.7 so I had to specify that in an environment.yml file) after a bit of investigation!

It's just a first draft and I'll take a look at the style guides for how to clean this up for publishing, thoughts welcome! ๐Ÿ˜ƒ

File `viewer_examples/6_watershed_demo.py` won't work; how to deal with QT5?

Dear all,
recently I tried to run some viewer examples, and I had an issue with 6_watershed_demo.py. It follows:

jaguar@spaghetti:~/Documents/Repositories/skimage-tutorials/viewer_examples$ python 6_watershed_demo.py 
Watershed plugin
----------------
Use mouse to paint each region with a different label.
Press OK to display segmented image.
Traceback (most recent call last):
  File "6_watershed_demo.py", line 39, in <module>
    plugin += OKCancelButtons()
  File "/home/jaguar/anaconda3/lib/python3.6/site-packages/skimage/viewer/widgets/history.py", line 25, in __init__
    self.ok = QtGui.QPushButton('OK')
AttributeError: module 'PyQt5.QtGui' has no attribute 'QPushButton'

For PyQT5, this issue could be solved with:

in __init__
    self.ok = QtWidgets.QPushButton('OK')

in skimage/viewer/widgets/history.py, I think. However, this file is adapted to work also with PyQT4.
Is that right? How could we solve that?
Thanks in advance. Kind regards,

Alex

ImageCollection Error

ic = io.ImageCollection('../images/.png:../.jpg') Does not work even though I am able to load
the balloon image. so it does not seem to be a path issue?
image = io.imread('../images/balloon.jpg') works fine!

The image collection is given an error which implies 0 images. I tried even this piece of code from imported data_dir within skimage and it gave the same error. I am on windows 7 and python 2.7

from skimage import data_dir
coll = io.ImageCollection(data_dir + '/lena*.png')
len(coll)
coll[0].shape

IndexError: There are only 0 images in the collection

Migrating tutorials to website todo

We now have the tutorials up at

https://scikit-image.org/skimage-tutorials/

To do:

  • use myst or a plain .py format supported by jupytext rather than nb as source. This just involves conversion of source files using nbconvert. Jupyter book should take care of the rest (But, see reference).
  • add more tutorials to the full list. This is done by moving them from lectures/not_yet_booked/ to lectures, updating _toc.yml, and ensuring that they build (no errors).
  • Rename the repo to just tutorials so that the URL is scikit-image.org/tutorials
  • (bigger) integrate with main site: look/theme, links from top navigation bar, etc.

Suggestion: Put solutions in .py files

The idea comes from https://github.com/amueller/scipy-2018-sklearn

Instead of duplicating the notebooks, they use the %load instruction to load py files stored in a solution directory. I think it's brilliant. I moved to this way for my notebooks; it will be much easier to maintain the code, and it makes the repo lighter.

For the tutorial, the lecturer can either provide the solutions or not, can type the solution or load it...

I have to admit that moving to this solution takes some time... :(

Replace "draw an H" with "draw a grid"

In the "images are numpy arrays" section, my "draw an H" exercise was rather contrived and a bit tedious. Drawing a grid is a bit more natural and would show the same principles.

Error check_setup.py

When I run the check_setup.py I get the following error:
Traceback (most recent call last):
File "check_setup.py", line 41, in
status, pkg.ljust(13), version_installed)
UnicodeEncodeError: 'ascii' codec can't encode character '\u2713' in position 1: ordinal not in range(128)

Note that I am using a Mac OS X 10.13.6, with miniconda installation; conda version 4.7.5 and python version 3.6.8

Exception in example code, notebooks/lectures/4_segmentation.ipynb

When working through the tutorial 'Image analysis in Python with SciPy and scikit-image', I encountered a problem in the section Combining regions with a Region Adjacency Graph (RAG). When attempting to generate the graph, I get an exception:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-123-d2130ec30b20> in <module>
      6 # Pass centroid data into the graph
      7 for region in regions:
----> 8     rag.node[region['label']]['centroid'] = region['centroid']

AttributeError: 'RAG' object has no attribute 'node'

It appears the API has changed since the tutorial was given.

I am using scikit-image version: 0.16.2 (downloaded with pip3 today), IPython version 7.8.0 and Python version 3.7.4.

imagecollection

The provided command ic = io.ImageCollection('..\images*.png:..\images*.jpg') is not working in python 3.9

although an append of files is working by seprately reading two ic individually, enumerating the appended ic wont show the jpg files.

ic1 = io.ImageCollection('../images/*.png')
ic2 = io.ImageCollection('../images/*.jpg')

#append ic1 files to ic2
for images in ic1.files:
    ic2.files.append(images)

print('Type:', type(ic2))
ic2.files

Pip dependency resolution conflict with requirements.txt

The first step of make html is pip install -q -r requirements.txt, but unfortunately it is not currently possible to install the dependencies with pip due to conflicts in pip's dependency resolver. The failure mode is particularly frustrating because it sends pip down a path where it tries to download very old versions of e.g. pytest and will only fail after these fail to build.

I've encountered this problem before with the executablebooks project (executablebooks/MyST-NB#333, executablebooks/MyST-NB#289) so I suspected jupyter-book/jupytext as the culprit. Indeed, if jupyterbook and jupytext are removed from the requirements file and installed separately, the failure is resolved.

Papers to turn into tutorials / case studies

I'm creating this issue as an external to-do for possible papers on which to build tutorials / examples.

RFC: Require IPython/Jupyter >=3.0

I upgraded my Anaconda distribution after submitting #17 and noticed IPython/Jupyter is now converting notebooks to a new format.

We need to decide if we want to

  • keep the dependency at 2.0, in which case we must be extremely careful all of our changes are saved and committed only from 2.x
  • require version 3.x, which is backwards compatible with older notebooks (the consensus decision)

I favor requiring version 3.x. The former is possible, but it's going to be increasingly difficult to support. One accidental save, commit, and merge, and we're in trouble.

This would require modifications to the check_env.py script.

Removing Brag's peaks from image!

diffuse scatt_1
Hi respected Developers!

In above image you see red dots are the brags peaks from electron diffraction simulation in an ideal crystal(image 512x512). I wanted to remove dominant these red spots( called brags peaks ) so that i can see only diffuse scattering(background) in my images. The problem is intensity of diffuse scattering is quite low as comparing to brags peaks , that can be only be seen by plotting this image at low intensity limit,(so when i try to reduce the intensity, brags peaks becomes so dominant that i almost lost the information of diffuse scattering from background,hence therefore) would it be possible that i can somehow able to mask those red dots and remove these brags diffraction peaks and see the only diffuse patterns in background, can any one walk me through this (i am not pro in python).? I shall be very grateful for this!

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.