Skip to content

Repository files navigation

NIC@HMS python2: Intro to image processing

setup

install miniconda

https://docs.conda.io/en/latest/miniconda.html

If you haven't already, add conda forge to your channels

conda config --add channels conda-forge
conda config --set channel_priority strict

tip: to download a version of miniconda with conda-forge already setup, use miniforge

clone or download this repository

# to clone
git clone https://github.com/tlambert03/hms_pyintro2.git

or download and unzip: https://github.com/tlambert03/hms_pyintro2/archive/refs/heads/master.zip

... then cd into the new directory

cd hms_pyintro2

create a new environment for this tutorial

conda create -n imgproc python
conda activate imgproc

note: anytime you close and reopen your terminal, you'll need to reactivate your conda environment with conda activate <name_of_env>

install requirements

pip install -r requirements.txt

this will pip install each of the requirements listed in the requirements.txt file. You could also install them with conda if you'd like. See the previous lecture for details on pip vs conda.

start one of the tutorials

jupyter-lab 01_image_io.ipynb

Summary & links to more reading

  • pathlib.Path for filesystem operations. (offers similar functionality to the os.path module, in an object-oriented design)
  • Open files (like text files) with open, or Path.read_text
  • Loading image data:
    • tifffile - read and write TIFF files. Used internally by many other packages.
    • imageio - read and write a wide range of image data (but use volread instead of imread for nd tiffs)
    • scikit-image io module - Utilities to read and write images in various formats. Wraps tifffile and imageio, and other plugins.
    • pims - consistent interface for image sequences. offers Bioformats wrapper, and pure-python nd2 readers with nd2reader and pims_nd2.
    • so many others... let me know if you have a challenging image format...
  • Viewing images:
  • Numpy - the fundamental package for scientific computing in Python. It's critical to understand the basics of working with numpy arrays when dealing with image data (indexing, slicing, operations, etc...). Start with the quickstart and go from there...
  • Saving images:

next steps ... (not covered here)

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages