Skip to content

Instantly share code, notes, and snippets.

@3dimaging
Created June 26, 2018 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save 3dimaging/5c8b279b6ed65e5781e5c8afb5736693 to your computer and use it in GitHub Desktop.
Save 3dimaging/5c8b279b6ed65e5781e5c8afb5736693 to your computer and use it in GitHub Desktop.
I did this under python3.5, which is the default version for python3 in Ubuntu
sudo apt-get install python3-tk
sudo apt-get install libpython3.6-dev
pip3 install matplotlib numpy
then download ASAP from the website: https://github.com/computationalpathologygroup/ASAP/releases
and install it by the command:
dpkg -i ASAP-1.8-python36-Linux.deb
to find where it was installed, use the command:
dpkg -L asap
Now, we put it in the PYTHONPATH:
PYTHONPATH="/opt/ASAP/bin":"${PYTHONPATH}"
export PYTHONPATH
now we can begin
type command : python3
then we enter python,
>>>import matplotlib.pyplot as plt
>>> import multiresolutionimageinterface as mir
>>> reader = mir.MultiResolutionImageReader()
>>>mr_image = reader.open('/home/wli/Downloads/tumor_036.tif')
>>>tile = mr_image.getUCharPatch(0, 0, dims[0], dims[1], 6)
>>> plt.imshow(tile)
>>> plt.show()
>>> tile =mr_image.getUCharPatch(37000, 90000, 1024, 1024, 0)
>>> plt.imshow(tile)
>>>plt.show()
or using openslide
slide = openslide.open_slide(slide_path)
thumbnail = slide.get_thumbnail((slide.dimensions[0] / 256, slide.dimensions[1] / 256))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment