adamjtaylor / miniature

Use dimensionality reduction to create thumnails for high-dimensional imaging

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Miniature

Miniature (illuminated manuscript), a small illustration used to decorate an illuminated manuscript

An approach using dimensionality reduction to create thumnails for high-dimensional imaging.
Miniature enables rapid visual assesment of molecular heterogneity within highly multiplexed images of complex tissues.

Miniature images embeds each pixel into low dimensional space by corelation distance, and colours them by conversion of their position in low-D space to LAB colour. Therefore areas of similar colour can be expected to have comperable marker expression (within a single image).

image

  • Load highest (or specified) level of image pyramid
  • Background removal by Otsu's threshold (optional)
  • Remove small objects (Not currently implemented in R version)
  • Reduce each pixel from n-D to 3-D by UMAP with correlation distance
  • Colour pixels by conversion of position in low-D space to LAB colour

Docker

The docker-comppose.yml expects images to be avaliable in ../data (a folder in the current miniature dir called data) Images should be an multichannel ome.tiff containing a image pyramid. Output as a .png, .jpeg or .tif/.tiff

Clone the repository

git clone https://github.com/adamjtaylor/miniature
cd miniature
mkdir data

Run the docker container

cd docker
sudo docker-compose run --rm app

Or from the docker image

docker run -it --rm --platform linux/amd64 -v <local-path>:/data adamjtaylor/htan-artist

Once in the container run

python paint_miniature.py data/<input-file-name> <output-file-name>

For example

python paint_miniature.py 'data/HTA9_1_BA_L_ROI04.ome.tif' 'miniature.jpg'

Optional arguments allow for changing level used, preserving background, saving the 3D embedding plot, and saving the intermediate data (tissue mask, data matrix, embedding and colours as h5. Optionally t-SNE can be used but this is slower than UMAP

For example, to paint a miniature on the second higest level, preserving the background, using t-SNE and saving both the 3D embedding and intermediate data use

python paint_miniature.py 'data/HTA9_1_BA_L_ROI04.ome.tif' 'miniature.jpg' \
     --level -2 --remove_bg True, --dimred tsne --save_data True --plot_embedding True

R

Follow the notebooks in the notebooks folder or use the R/paint_miniature.R script

Examples

Image info Background removed Background retained
40 channel CODEX image image
12 channel MxIF image image
28 channel IMC image image
48 channel MIBI image image
12 channel MxIF image image
12 channel MxIF image image

About

Use dimensionality reduction to create thumnails for high-dimensional imaging


Languages

Language:HTML 87.2%Language:Jupyter Notebook 12.0%Language:R 0.5%Language:Python 0.3%Language:Dockerfile 0.0%Language:Nextflow 0.0%