ccipd / MRQy

RadQy is a quality assurance and checking tool for quantitative assessment of magnetic resonance imaging (MRI) and computed tomography (CT) data.
https://ccipd.github.io/MRQy/
BSD 3-Clause Clear License
94 stars 27 forks source link

QC.py npt recognized #22

Closed drkitty28 closed 1 year ago

drkitty28 commented 1 year ago

This looks great and exactly what I need, but can't get past the install. I'm using Ubuntu 20.04, python 3.8

I followed the README instructions and I can launch the shell - setting up in my home .local directory .local/share/virtualenvs/MRQy-yxYQvYdT/bin/activate

I can install mrqy pipenv install . Installing .... Adding mrqy to Pipfile's [packages]... ✔ Installation Succeeded Installing dependencies from Pipfile.lock (829554)...

and I can get the help to output to the screen python -m mrqy.QC --help usage: QC.py [-h] [-r R] [-s S] [-b B] [-u U] [-t T] [-c C] output_folder_name [inputdir [inputdir ...]]

But, when I try to run "pipenv run -m pytest tests/" I get "Error: the command -m could not be found within PATH or Pipfile's [scripts]."

What PATH variable is it looking for? There seems to be a PATH that was created in the .local/share/virtualenvs directory

Any help would be greatly appreciated. And, yes, I did pip install the requirements.txt without issue.

drkitty28 commented 1 year ago

Hi, I really need to get this working. Can someone please help?

Amir-Reza-Sadri commented 1 year ago

I am working on this error. Meantime can you download the QC.py and QCF.py scripts and run them without using the mrqy env?

drkitty28 commented 1 year ago

Where are the scripts?

drkitty28 commented 1 year ago

OK, I found scripts under the build/lib/mrqy directory. Tried running in the mrqy shell and got "command not found" - Also, tried importing mrqy in python and running and got "no mdoule named mrqy" - So, I'm at a loss.

Amir-Reza-Sadri commented 1 year ago

In the QC.py code uncomment line#11 and comment line#12.

drkitty28 commented 1 year ago

OK, closer. I'm testing with OpenNeuro images and I think they may be corrupted re error message. I'll try with my own data and update status

MRQy is starting.... The number of patients is 12 Traceback (most recent call last): File "QC.py", line 358, in v = volume_notdicom(k, nondicom_names[l]) File "QC.py", line 144, in volume_notdicom image_data, image_header = load(scan) File "/home/cat/.local/lib/python3.8/site-packages/medpy/io/load.py", line 106, in load raise ImageLoadingError('The supplied image {} does not exist.'.format(image)) medpy.core.exceptions.ImageLoadingError: The supplied image /home/cat/MRQy/sub-001/func/sub-001_task-sitrep_run-06_bold.nii.gz does not exist.

drkitty28 commented 1 year ago

I downloaded the TCIA data. Tried the main directory as well as directories with only dcm files (e.g., CIA/manifest-1668519901652/UPENN-GBM/UPENN-GBM-00001/02-06-2002-NA-BRAINROUTINE-33106)

Using the command: python build/lib/mrqy/QC.py "tests/TCIA/manifest-1668519901652/UPENN-GBM/UPENN-GBM-00001/02-06-2002-NA-BRAINROUTINE-33106" I get the error message:

Traceback (most recent call last): File "build/lib/mrqy/QC.py", line 273, in root = args.inputdir[0] IndexError: list index out of range

What am I doing wrong?

drkitty28 commented 1 year ago

Tried running pytest re the README file but got an error where it can't find the -m

pipenv run -m pytest tests/ Creating a virtualenv for this project... Pipfile: /home/cat/APPS/MRQy/build/lib/mrqy/Pipfile Using /home/cat/.local/share/virtualenvs/MRQy-yxYQvYdT/bin/python (3.8.10) to create virtualenv... ⠋ Creating virtual environment...created virtual environment CPython3.8.10.final.0-64 in 1140ms creator Venv(dest=/home/cat/.local/share/virtualenvs/mrqy-6GTtRS1Y, clear=False, no_vcs_ignore=False, global=False, describe=CPython3Posix) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/cat/.local/share/virtualenv) added seed packages: pip==22.3.1, setuptools==65.5.1, wheel==0.37.1 activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment! Virtualenv location: /home/cat/.local/share/virtualenvs/mrqy-6GTtRS1Y Creating a Pipfile for this project... Error: the command -m could not be found within PATH or Pipfile's [scripts].

drkitty28 commented 1 year ago

Tried running with the -m:

(MRQy) cat@catlapXPS:~/APPS/MRQy$ pipenv run pytest tests/ ============================================================ test session starts ============================================================ platform linux -- Python 3.8.10, pytest-7.2.0, pluggy-1.0.0 rootdir: /home/cat/APPS/MRQy collected 0 items / 1 error

================================================================== ERRORS =================================================================== ___ ERROR collecting tests/testQC.py ____ ImportError while importing test module '/home/cat/APPS/MRQy/tests/test_QC.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: /usr/lib/python3.8/importlib/init__.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) tests/test_QC.py:2: in import mrqy.QC as QC ../../.local/share/virtualenvs/MRQy-yxYQvYdT/lib/python3.8/site-packages/mrqy/QC.py:11: in import QCF E ModuleNotFoundError: No module named 'QCF' ========================================================== short test summary info ========================================================== ERROR tests/test_QC.py !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ============================================================= 1 error in 5.78s ==========

drkitty28 commented 1 year ago

"python -m mrqy.QC --help" seems to look for the module in ".local/share/virtualenvs/MRQy-yxYQvYdT/lib/python3.8/site-packages" But neither mrqy.QC or QC seems to be there. Another user had a similar problem (https://github.com/ccipd/MRQy/issues/3) which is probably why you had me comment out line11 and uncomment line12. But, this is not fixing the problem for me. Where are the modules stored?

Amir-Reza-Sadri commented 1 year ago

Could you please share some of your data? ars329@case.edu

drkitty28 commented 1 year ago

I've tried different data sets with no luck. But, the wiki suggested the TCIA data which I tried. How would I share that as it's locally downloaded and probably too big to attach here. What's the minimum data needed for the MRQy to work?

Amir-Reza-Sadri commented 1 year ago

6 patients of your dataset share via email or google drive. What were the last error and the approach you tried?

drkitty28 commented 1 year ago

Here are screenshots of the TCIA directory, the QCpy_Script, the directory structure, the pipenv install, and the code testing. Is there some particular structure that the data directory should have? the QC.py script appears in several locations (app directory & virturalenv). Which should be modified? There seems to be an issue with the directory structure or the QC.py code usage.

codeTesting MQRy_testing MRQy_dir_structure QCpy_Script TCIA_directory

drkitty28 commented 1 year ago

Here are screenshots of the TCIA directory, the QCpy_Script, the directory structure, the pipenv install, and the code testing. Is there some particular structure that the data directory should have? the QC.py script appears in several locations (app directory & virturalenv). Which should be modified? There seems to be an issue with the directory structure or the QC.py code usage.

codeTesting MQRy_testing MRQy_dir_structure QCpy_Script TCIA_directory

drkitty28 commented 1 year ago

Some progress... I started QC.py from the "MRQy/src/mrqy" directory while in the MRQy shell. I used the "tests//TCIA" directory as the input and "tests" as the output. MRQy started but produced an error about "input arrays having the same shape" - No idea what this means. The TCIA data was in the download from git. What are the constraints on the data MRQy has? How to make the array size the same? The array size of what exactly? QCpy_test

drkitty28 commented 1 year ago

Got MQRy to run and create a report! This was on a single subject's anatomical. MQRy didn't seem to like the nii.gz format for the functional data. Is the compressed .nii format acceptable for MQRy or must it be uncompressed - .nii only?
MRQy_RunReport

drkitty28 commented 1 year ago

Having a problem with functional (BOLD) images. I use a known 4D BOLD image as input (tried a couple different ones), but get the error below. What's meant by "third dimension must be 3 or 4"?

image

rongjiewang commented 1 year ago

Some progress... I started QC.py from the "MRQy/src/mrqy" directory while in the MRQy shell. I used the "tests//TCIA" directory as the input and "tests" as the output. MRQy started but produced an error about "input arrays having the same shape" - No idea what this means. The TCIA data was in the download from git. What are the constraints on the data MRQy has? How to make the array size the same? The array size of what exactly? QCpy_test

I have the same problem.

Amir-Reza-Sadri commented 1 year ago

Can you share some of your data?

rongjiewang commented 1 year ago

My test data is TCGA-GBM/TCGA-02-0003. Download link is https://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=1966258. I only tested the first patient's data ,and there was a bug. Thank you very much for help.

bests, Rj Wang

Amir Reza Sadri @.***> 于2023年1月12日周四 22:51写道:

Can you share some of your data?

— Reply to this email directly, view it on GitHub https://github.com/ccipd/MRQy/issues/22#issuecomment-1380484977, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACIDCT3B56WB7SNZ2N3N4NDWSALABANCNFSM6AAAAAAR6OOXYE . You are receiving this because you commented.Message ID: @.***>

Amir-Reza-Sadri commented 1 year ago

Please add -r "True" flag at the end of your synax when you run the code.