ENHANCE-PET / MOOSE

MOOSE (Multi-organ objective segmentation) a data-centric AI solution that generates multilabel organ segmentations to facilitate systemic TB whole-person research.The pipeline is based on nn-UNet and has the capability to segment 120 unique tissue classes from a whole-body 18F-FDG PET/CT image.
https://enhance.pet
GNU General Public License v3.0
191 stars 28 forks source link

BUG: Unable to download models #97

Closed vikashg closed 8 months ago

vikashg commented 8 months ago

Describe the bug When I run the code as

moosez -d <subject_dir> -m clin_ct_organs

I get the following error

  /  |/  / __ \/ __ \/ __/ __/ |_  | / _ \
 / /|_/ / /_/ / /_/ /\ \/ _/  / __/_/ // /
/_/  /_/\____/\____/___/___/ /____(_)___/
A part of the ENHANCE community. Join us at www.enhance.pet to build the future of PET imaging together.

 CITATION:

 Shiyam Sundar LK, Yu J, Muzik O, et al. Fully-automated, semantic segmentation of whole-body 18F-FDG PET/CT images based on data-centric artificial intelligence. J Nucl Med. June 2022.
 Copyright 2022, Quantitative Imaging and Medical Physics Team, Medical University of Vienna

 NOTE:

 Requested model: clin_ct_organs | Imaging: Clinical | Modality: CT | Tissue of interest: Organs
 Required modalities: ['CT'] |  No. of modalities: 1 | Required Suffix for non-DICOM files: ['CT_'] 
 Warning: Subjects which don't have the required modalities [check file suffix] will be skipped. 

 MODEL DOWNLOAD:

Traceback (most recent call last):                      
  File "/data/miniconda3/envs/moose/bin/moosez", line 8, in <module>
    sys.exit(main())
  File "/data/miniconda3/envs/moose/lib/python3.8/site-packages/moosez/moosez.py", line 96, in main
    download.model(model_name, model_path)
  File "/data/miniconda3/envs/moose/lib/python3.8/site-packages/moosez/download.py", line 68, in model
    with zipfile.ZipFile(filename, 'r') as zip_ref:
  File "/data/miniconda3/envs/moose/lib/python3.8/zipfile.py", line 1269, in __init__
    self._RealGetContents()
  File "/data/miniconda3/envs/moose/lib/python3.8/zipfile.py", line 1336, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

My subject directory contains two files PET.nii and CT.nii

To Reproduce Steps to reproduce the behavior:

  1. Create a python environment for moose
    conda create -n moose python==3.8
  2. Execute
    moosez -d <subject_dir> -m clin_ct_organs

Screenshots I looked at the path for file downloads on the resources.py file. The download file path gives the following error image

Desktop (please complete the following information):

LalithShiyam commented 8 months ago

Hi @vikashg,

Many thanks for the clear bug. Just as a headsup, the current version of moose requires 3.10 python. Nevertheless the bug that you report is due to dead links. We migrated from IBM to AWS and the latest version of moose 2.4.0 will have the live links from AWS.

Please create an environment with python 3.10 (refer the requirements and installation) and then simply install moosez via pip install moosez.

Kindly let me know if this solves the problem.

Cheers, Lalith

LalithShiyam commented 8 months ago

Hi @vikashg, is this solved?

vikashg commented 8 months ago

hi @LalithShiyam I was ooo last week and I am going to look at it today. Thanks Vikash

LalithShiyam commented 8 months ago

@vikashg All good - kindly let me know how it goes. Please make sure the installed moosez version is 2.4.0. You can verify this by using pip show moosez!

vikashg commented 8 months ago

Hi @LalithShiyam, So it installed perfectly. However I will like to point out couple of things. When I did

pip install -r requirements.txt

matplotlib broke on me with the following error

matplotlib

I know I probably don't need to install the requirements. So following your instructions I did pip install moosez and it worked. I have not checked the results yet.

Another thing which I wanted to do and if I am not wrong was a feature in the previous version of moose was to register the PET and the CT images. Now when I execute moosez -d <subject_dir> -m clin_ct_organs It segments the CT image but doesn't register. the PET scan in the directory. I am sure I am missing something. I am going through the documentation. But please let me know if there is something.

LalithShiyam commented 8 months ago

Hi @vikashg, Glad that it worked. You are right the first version had a proper diffeomorphic aligner between PET and CT. We removed that as it didn’t perform well with really old scanners where the image quality was not the best. And it also took 2.5 min more. Right now we use a reslice-identity resampler, which aligns the PT with CT, assuming that they are simultaneous acquisitions. It’s fast and it works reasonably well, for extracting the activity of organs.

vikashg commented 8 months ago

So, it should in principle produce an aligned image in this version right ?

LalithShiyam commented 8 months ago

It would just extract the activity, the aligned image wouldn’t be written out.

Do you need this feature badly? If yes - I will create this as a feature request :)!

vikashg commented 8 months ago

Oh yes. that would be great. to have some tool to align PET and CT with affine registration. Did you write that registration tool from scratch. I am closing this issue now. Thanks for your comments. and yes I would love to have that tool thanks for creating the feature request. Please tag me on it.

LalithShiyam commented 8 months ago

We basically use FALCON's binaries. Will create a feature request and will tag you.