computationalpathologygroup / ASAP

Program for the analysis and visualization of whole-slide images in digital pathology
https://computationalpathologygroup.github.io/ASAP/
GNU General Public License v2.0
620 stars 165 forks source link

AttributeError: module 'multiresolutionimageinterface' has no attribute 'MultiResolutionImageReader' #168

Closed CapitalZe closed 4 years ago

CapitalZe commented 4 years ago

Running Ubuntu 16.04 via VMware on a Macbook Pro. Tried in both Terminal and Jupyter NB.

I believe all env variables and directories are in order.

when I run:

import multiresolutionimageinterface as mir
reader = mir.MultiResolutionImageReader()
mr_image = reader.open('/media/XXX/book/camelyon17/centre_0/patient_000_node_0.tif')
level = 2
ds = mr_image.getLevelDownsample(level)
image_patch = mr_image.getUCharPatch(int(568 * ds), int(732 * ds), 300, 200, level)

I get the following output:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-2e258b46d239> in <module>
----> 1 import multiresolutionimageinterface as mir
      2 reader = mir.MultiResolutionImageReader()
      3 mr_image = reader.open('/media/XXX/book/camelyon17/centre_0/patient_000_node_0.tif')
      4 level = 2
      5 ds = mr_image.getLevelDownsample(level)

ModuleNotFoundError: No module named 'multiresolutionimageinterface'

I've checked and the module is within the ASAP-1.9 folder. Within ASAP-1.9 ls reads out:

(MIDI) XXX@ubuntu:~/ASAP-1.9$ ls
annotation                  cmakemodules   License.txt
ASAP                        config         Manual.docx
ASAPConfig.cmake.in         Copyright.txt  multiresolutionimageinterface
ASAPConfigVersion.cmake.in  core           Readme.md
buildtools                  executables    runASAP.py
CMakeLists.txt              imgproc        WorklistInterface

I've tried numerous approaches, namely around env vars.

Does anyone have a clue why this is happening?

I'm attempting to process the CAMELYON17 dataset and cannot overcome this impasse.

Thanks in advance.

GeertLitjens commented 4 years ago

Two things: Python needs to find the multiresolutionimage.py file, so you have to make sure the PYTHONPATH environmental variable has a reference to the ASAP bin dir. Second, the kernel needs to know where to look for multiresolutionimage.dll. For this, you need (on Linux) to set the LD_LIBRARY_PATH environmental variable to include the ASAP bin folder

CapitalZe commented 4 years ago

Thank you for the reply. It worked and got me beyond that point.

Now, however, I am faced with this:

AttributeError                            Traceback (most recent call last)
<ipython-input-2-2e258b46d239> in <module>
      3 mr_image = reader.open('/media/XXX/book/camelyon17/centre_0/patient_000_node_0.tif')
      4 level = 2
----> 5 ds = mr_image.getLevelDownsample(level)
      6 image_patch = mr_image.getUCharPatch(int(568 * ds), int(732 * ds), 300, 200, level)

AttributeError: 'NoneType' object has no attribute 'getLevelDownsample'

I decided to go through the entire installation again in a separate environment, and this time when I run sudo cmake . I receive the following:

CMake Error at CMakeLists.txt:44 (find_package):
  By not providing "FindOpenJPEG.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "OpenJPEG",
  but CMake did not find one.

  Could not find a package configuration file provided by "OpenJPEG" with any
  of the following names:

   OpenJPEGConfig.cmake
    openjpeg-config.cmake

  Add the installation prefix of "OpenJPEG" to CMAKE_PREFIX_PATH or set
  "OpenJPEG_DIR" to a directory containing one of the above files.  If
  "OpenJPEG" provides a separate development package or SDK, be sure it has
  been installed.

-- Configuring incomplete, errors occurred!
See also "/home/XXX/ASAP-1.9/CMakeFiles/CMakeOutput.log".

I've reinstalled OpenJPEG and sufficiently followed the variable instructions in the output:

(MIDI) XXX@ubuntu:~/ASAP-1.9$ echo $CMAKE_PREFIX_PATH
/home/XXX/openjpeg/

As well as:

(MIDI) XXX@ubuntu:~/ASAP-1.9$ echo $OpenJPEG_DIR
/home/XXX/openjpeg/build

Constructing FindOpenJPEG.cmake and placing it in /home/XXX/ASAP-1.9/cmakemodules just lead to more errors.

Any ideas?

CapitalZe commented 4 years ago

This was resolved. The problem was, for most of the dependencies it was required to install the 'dev' version or 'tools' version.

This was probably made clear somewhere and I overlooked it.

Issue can be closed.

eternaldolphin commented 3 years ago

AttributeError: 'NoneType' object has no attribute 'getLevelDownsample' So I need install which one ?ASAP-1.9-Linux-Ubuntu1804.deb?