jlevy44 / PathFlowAI

A High-Throughput Workflow for Preprocessing, Deep Learning Analytics and Interpretation in Digital Pathology
https://jlevy44.github.io/PathFlowAI/
MIT License
38 stars 8 forks source link

Dask_image issue/bug #28

Closed asmagen closed 4 years ago

asmagen commented 4 years ago

Hi @jlevy44

The same script I used successfully last week to preprocess the images isn't working now with the following error (which is not due to not having the relevant packages installed as you see in the first two install commands):

(saturn) jovyan@jupyter-assafmagen-2dpathflowai:~$ /srv/conda/envs/saturn/bin/pip install dask_imageRequirement already satisfied: dask_image in /srv/conda/envs/saturn/lib/python3.6/site-packages (0.2.0)
Requirement already satisfied: dask[array]>=0.16.1 in /srv/conda/envs/saturn/lib/python3.6/site-packages (from dask_image) (2.12.0)
Requirement already satisfied: scipy>=0.19.1 in /srv/conda/envs/saturn/lib/python3.6/site-packages (from dask_image) (1.4.1)
Requirement already satisfied: pims>=0.4.1 in /srv/conda/envs/saturn/lib/python3.6/site-packages (from dask_image) (0.4.1)
Requirement already satisfied: numpy>=1.11.3 in /srv/conda/envs/saturn/lib/python3.6/site-packages (from dask_image) (1.18.1)
Requirement already satisfied: toolz>=0.7.3; extra == "array" in /srv/conda/envs/saturn/lib/python3.6/site-packages (from dask[array]>=0.16.1->dask_image) (0.10.0)
Requirement already satisfied: slicerator>=0.9.7 in /srv/conda/envs/saturn/lib/python3.6/site-packages (from pims>=0.4.1->dask_image) (1.0.0)
Requirement already satisfied: six>=1.8 in /srv/conda/envs/saturn/lib/python3.6/site-packages (from pims>=0.4.1->dask_image) (1.14.0)
(saturn) jovyan@jupyter-assafmagen-2dpathflowai:~$ pathflowai-preprocess preprocess_pipeline -odb patch_information.db --preprocess --patches --basename Li63NDCLAMP --input_dir /home/jovyan/project/PFAI_inputs --patch_size 512 --intensity_threshold 45. -tc 7 -t 0.05
nonechucks may not work properly with this version of PyTorch (1.5.0). It has only been tested on PyTorch versions 1.0, 1.1, and 1.2
Traceback (most recent call last):
  File "/srv/conda/envs/saturn/bin/pathflowai-preprocess", line 8, in <module>
    sys.exit(preprocessing())
  File "/srv/conda/envs/saturn/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/srv/conda/envs/saturn/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/srv/conda/envs/saturn/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/srv/conda/envs/saturn/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/srv/conda/envs/saturn/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/srv/conda/envs/saturn/lib/python3.6/site-packages/pathflowai/cli_preprocessing.py", line 83, in preprocess_pipeline
    transpose_annotations=transpose_annotations)
  File "/srv/conda/envs/saturn/lib/python3.6/site-packages/pathflowai/utils.py", line 322, in run_preprocessing_pipeline
    arr, masks = load_process_image(svs_file, xml_file, npy_mask, annotations, transpose_annotations)
  File "/srv/conda/envs/saturn/lib/python3.6/site-packages/pathflowai/utils.py", line 267, in load_process_image
    arr = load_image(svs_file)#npy2da(svs_file) if (svs_file.endswith('.npy') or svs_file.endswith('.h5')) else svs2dask_array(svs_file, tile_size=1000, overlap=0)#load_image(svs_file)
  File "/srv/conda/envs/saturn/lib/python3.6/site-packages/pathflowai/utils.py", line 238, in load_image
    return (npy2da(svs_file) if (svs_file.endswith('.npy') or svs_file.endswith('.h5')) else svs2dask_array(svs_file, tile_size=1000, overlap=0))
  File "/srv/conda/envs/saturn/lib/python3.6/site-packages/pathflowai/utils.py", line 131, in svs2dask_array
    return dask_image.imread.imread(svs_file)
NameError: name 'dask_image' is not defined

Is this due to a recent update? (I'm installing the package in each new session so I always pull the most current version). What's the fastest way to address this?

Thanks

sumanthratna commented 4 years ago

At the top of utils.py, try adding import dask_image.imread.