NIRALUser / DTIPlayground

An integrated framework for DWI Image QC and processing
MIT License
12 stars 2 forks source link

QC protocol error #48

Closed slusna-dominika closed 1 year ago

slusna-dominika commented 1 year ago

Hi!

I have tried to run the QC protocol on a subject's dwi.nii.gz, but I have got the following error:

[2023-05-02-22-25-42]     image_object: 140649850589248
[2023-05-02-22-25-42]     image_path: /Users/dominika/Desktop/RESEARCH/PROJ.BPP/mricq/sub-submPMG/dwi/sub-submPMG_dwi.nii.gz
[2023-05-02-22-25-42]   
[2023-05-02-22-25-42]   Source Image (Previous output) loaded from memory (object id): 140649850589248
[2023-05-02-22-25-42]   [DTIPlaygroundModule.initialize] Processed time : 0.03s
[2023-05-02-22-25-42]   [DTIPlaygroundModule.run] begins ... 
[2023-05-02-22-25-42]   Exception occurred in runPipeline list index out of range
[2023-05-02-22-25-42]   Traceback (most recent call last):
[2023-05-02-22-25-42]     File "/Users/dominika/opt/anaconda3/envs/dtienv-py38/lib/python3.8/site-packages/dtiplayground/dmri/common/pipeline.py", line 428, in runPipeline
[2023-05-02-22-25-42]       outres=m.run(opts,global_vars=self.global_variables)
[2023-05-02-22-25-42]     File "/Users/dominika/opt/anaconda3/envs/dtienv-py38/lib/python3.8/site-packages/dtiplayground/dmri/common/__init__.py", line 83, in wrapper
[2023-05-02-22-25-42]       res=func(*args,**kwargs)
[2023-05-02-22-25-42]     File "/Users/dominika/opt/anaconda3/envs/dtienv-py38/lib/python3.8/site-packages/dtiplayground/dmri/common/module.py", line 400, in run
[2023-05-02-22-25-42]       res=self.process(*args,**kwargs) ## main computation for user implementation
[2023-05-02-22-25-42]     File "/Users/dominika/opt/anaconda3/envs/dtienv-py38/lib/python3.8/site-packages/dtiplayground/dmri/preprocessing/modules/QC_Report/QC_Report.py", line 33, in process
[2023-05-02-22-25-42]       global_report, number_input_gradients, excluded_gradients, number_of_excluded_gradients = self.AddGeneralInfo(global_report)
[2023-05-02-22-25-42]     File "/Users/dominika/opt/anaconda3/envs/dtienv-py38/lib/python3.8/site-packages/dtiplayground/dmri/preprocessing/modules/QC_Report/QC_Report.py", line 86, in AddGeneralInfo
[2023-05-02-22-25-42]       number_input_gradients = self.result_history[1]['report']['csv_data']['original_number_of_gradients']
[2023-05-02-22-25-42]   IndexError: list index out of range

Thank you for any help on this issue, Dominika

scalphunters commented 1 year ago

Can you tell me what version of dtiplayground did you use? (you can check with $ dmriprep --version )

slusna-dominika commented 1 year ago

Hi! Yes, it's the 0.5.6.

scalphunters commented 1 year ago

@slusna-dominika The version 0.5.6 has issue with QC_Report module. Can you try with v0.5.7b12 instead?

$ pip install --upgrade dtiplayground==0.5.7b12

ggkaif commented 1 year ago

@scalphunters Hi!

I have met the same problem with the QC_Report module. I have tried v0.5.7b12 and v0.5.7. My dtiplayground-tools version is 0.0.1 and fsl version is 6.0.7.1.

Thank you for your help. Liu

scalphunters commented 1 year ago

@ggkaif Hi, I couldn't reproduce same error with single input. Can you provide your protocols.yml file in your project directory?

ggkaif commented 1 year ago

@scalphunters Thanks for your reply.

I used data from https://openneuro.org/datasets/ds004632/versions/1.0.1. The content of the protocol.yml file is as follows.

{
    "version": "0.5.7",
    "io": {
        "output_directory": "/home/liu/data/QC/output",
        "input_image_1": "/home/liu/data/QC/input/sub-A1/ses-W5/dwi/sub-A1_ses-W5_dwi.nii.gz",
        "input_image_2": null,
        "num_threads": 1,
        "output_format": null,
        "baseline_threshold": 10,
        "no_output_image": false,
        "output_filename_base": null
    },
    "pipeline": [
        [
            "QC_Report",
            {
                "options": {
                    "overwrite": false,
                    "skip": false,
                    "write_image": false
                },
                "protocol": {
                    "generatePDF": true,
                    "generateCSV": true
                }
            }
        ]
    ]
}

Thank you. Liu

ggkaif commented 1 year ago

Hi!

Perhaps the QC_Report module cannot be used independently. When I integrated it with other modules in the pipeline, it worked successfully.

Thank you. Liu

styner commented 1 year ago

Did you try to run the QC-Report just by itself? But what would you expect it to report?

The QC Report generates a report of the results of the steps previously run in the pipeline. E.g. if you run a slice checking step, it will report how many DWI volumes were exclude for bad/corrupt slices. So it would fail if you would try to run it by itself

scalphunters commented 1 year ago

QC Report module initially loads result history, so if there is no pre-run result, it generates indexing error. This can be handled soon so that QC report cannot be run at the first queue. Thanks for your feedbacks and I'm closing this issue.