NIRALUser / DTIPlayground

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

Error in QC Report Module #41

Closed fiona2996 closed 1 year ago

fiona2996 commented 2 years ago

Hello,

When I run dmriprep the QC report module errors on any subject were gradients have been excluded. It cannot calculate the indices for the excluded gradients for these subjects and dmriprep errors and performs no further processing after the error occurs.

Here is the error in the log file:

Source Image (Previous output) loaded from memory (object id): 140168519171376 [2022-10-27-03-13-47] [DTIPlaygroundModule.initialize] Processed time : 0.42s [2022-10-27-03-13-47] [DTIPlaygroundModule.run] begins ... [2022-10-27-03-14-44] Exception occurred in runPipeline Exception thrown in SimpleITK ExtractImageFilter_Execute: /tmp/SimpleITK/Code/Common/include/sitkTemplateFunctions.h:96: [2022-10-27-03-14-44] sitk::ERROR: Unable to convert vector to ITK type [2022-10-27-03-14-44] Expected vector of length 4 but only got 3 elements. [2022-10-27-03-14-44] Traceback (most recent call last): [2022-10-27-03-14-44] File "/proj/NIRAL/tools/Anaconda/anaconda3_DTIPlayground/lib/python3.9/site-packages/dtiplayground/dmri/common/pipeline.py", line 411, in runPipeline [2022-10-27-03-14-44] outres=m.run(opts,global_vars=self.global_variables) [2022-10-27-03-14-44] File "/proj/NIRAL/tools/Anaconda/anaconda3_DTIPlayground/lib/python3.9/site-packages/dtiplayground/dmri/common/init.py", line 80, in wrapper [2022-10-27-03-14-44] res=func(*args,*kwargs) [2022-10-27-03-14-44] File "/proj/NIRAL/tools/Anaconda/anaconda3_DTIPlayground/lib/python3.9/site-packages/dtiplayground/dmri/common/module.py", line 395, in run [2022-10-27-03-14-44] res=self.process(args,**kwargs) ## main computation for user implementation [2022-10-27-03-14-44] File "/proj/NIRAL/tools/Anaconda/anaconda3_DTIPlayground/lib/python3.9/site-packages/dtiplayground/dmri/preprocessing/modules/QC_Report/QC_Report.py", line 38, in process [2022-10-27-03-14-44] global_report = self.AddExcludedGradientsImagesToReport(global_report, excluded_gradients) [2022-10-27-03-14-44] File "/proj/NIRAL/tools/Anaconda/anaconda3_DTIPlayground/lib/python3.9/site-packages/dtiplayground/dmri/preprocessing/modules/QC_Report/QC_Report.py", line 133, in AddExcludedGradientsImagesToReport [2022-10-27-03-14-44] images = self.CreateImagesOfExcludedGradients(image_path[image_index], excluded_gradients[image_index]) [2022-10-27-03-14-44] File "/proj/NIRAL/tools/Anaconda/anaconda3_DTIPlayground/lib/python3.9/site-packages/dtiplayground/dmri/preprocessing/modules/QC_Report/QC_Report.py", line 235, in CreateImagesOfExcludedGradients [2022-10-27-03-14-44] axial_image = self.AxialView(iter_gradients, input_size, input_image) [2022-10-27-03-14-44] File "/proj/NIRAL/tools/Anaconda/anaconda3_DTIPlayground/lib/python3.9/site-packages/dtiplayground/dmri/preprocessing/modules/QC_Report/QC_Report.py", line 282, in AxialView [2022-10-27-03-14-44] extracted_slice = slice_extractor.Execute(input_image) [2022-10-27-03-14-44] File "/proj/NIRAL/tools/Anaconda/anaconda3_DTIPlayground/lib/python3.9/site-packages/SimpleITK/SimpleITK.py", line 9508, in Execute [2022-10-27-03-14-44] return _SimpleITK.ExtractImageFilter_Execute(self, image1) [2022-10-27-03-14-44] RuntimeError: Exception thrown in SimpleITK ExtractImageFilter_Execute: /tmp/SimpleITK/Code/Common/include/sitkTemplateFunctions.h:96: [2022-10-27-03-14-44] sitk::ERROR: Unable to convert vector to ITK type [2022-10-27-03-14-44] Expected vector of length 4 but only got 3 elements. [2022-10-27-03-14-44]
[2022-10-27-03-14-44] [Pipeline.runPipeline] Processed time : 64331.66s

scalphunters commented 2 years ago

Currently python 3.9 is not stable due to ITK and VTK version issue. Can you try with python 3.8.6

liukang18 commented 1 year ago

Hello @scalphunters,

Sorry to open this up again, but following your conda install instructions, which installed Python 3.8.16, I am also receiving the same "sitk::ERROR: Unable to convert vector to ITK type"; "Expected vector of length 4 but only got 3 elements." errors.

I have attached the full log.txt file. Error excerpt posted below. Please let me know if you need any additional information. Thank you.

UPDATE: Note that even when explicitly setting the python version in the dtiplayground/dmriprep environment to 3.8.6, I get the same error.

log.txt

[2023-03-22-12-22-09] Source Image (Previous output) loaded from memory (object id): 140383974799392 [2023-03-22-12-22-09] [DTIPlaygroundModule.initialize] Processed time : 0.13s [2023-03-22-12-22-09] [DTIPlaygroundModule.run] begins ... [2023-03-22-12-22-11] Exception occurred in runPipeline Exception thrown in SimpleITK ExtractImageFilter_Execute: /tmp/SimpleITK/Code/Common/include/sitkTemplateFunctions.h:94: [2023-03-22-12-22-11] sitk::ERROR: Unable to convert vector to ITK type [2023-03-22-12-22-11] Expected vector of length 4 but only got 3 elements. [2023-03-22-12-22-11] Traceback (most recent call last): [2023-03-22-12-22-11] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/dtiplayground/dmri/common/pipeline.py", line 428, in runPipeline [2023-03-22-12-22-11] outres=m.run(opts,global_vars=self.global_variables) [2023-03-22-12-22-11] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/dtiplayground/dmri/common/init.py", line 83, in wrapper [2023-03-22-12-22-11] res=func(*args,*kwargs) [2023-03-22-12-22-11] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/dtiplayground/dmri/common/module.py", line 400, in run [2023-03-22-12-22-11] res=self.process(args,**kwargs) ## main computation for user implementation [2023-03-22-12-22-11] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/dtiplayground/dmri/preprocessing/modules/QC_Report/QC_Report.py", line 36, in process [2023-03-22-12-22-11] global_report = self.AddExcludedGradientsImagesToReport(global_report, excluded_gradients) [2023-03-22-12-22-11] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/dtiplayground/dmri/preprocessing/modules/QC_Report/QC_Report.py", line 132, in AddExcludedGradientsImagesToReport [2023-03-22-12-22-11] images = self.CreateImagesOfExcludedGradients(image_path[image_index], excluded_gradients[image_index]) [2023-03-22-12-22-11] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/dtiplayground/dmri/preprocessing/modules/QC_Report/QC_Report.py", line 234, in CreateImagesOfExcludedGradients [2023-03-22-12-22-11] axial_image = self.AxialView(iter_gradients, input_size, input_image) [2023-03-22-12-22-11] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/dtiplayground/dmri/preprocessing/modules/QC_Report/QC_Report.py", line 281, in AxialView [2023-03-22-12-22-11] extracted_slice = slice_extractor.Execute(input_image) [2023-03-22-12-22-11] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/SimpleITK/SimpleITK.py", line 9947, in Execute [2023-03-22-12-22-11] return _SimpleITK.ExtractImageFilter_Execute(self, image1) [2023-03-22-12-22-11] RuntimeError: Exception thrown in SimpleITK ExtractImageFilter_Execute: /tmp/SimpleITK/Code/Common/include/sitkTemplateFunctions.h:94: [2023-03-22-12-22-11] sitk::ERROR: Unable to convert vector to ITK type [2023-03-22-12-22-11] Expected vector of length 4 but only got 3 elements. [2023-03-22-12-22-11]

scalphunters commented 1 year ago

no worries. thanks for reporting. can you try with new version?

$ pip install dtiplayground==0.5.7b10

liukang18 commented 1 year ago

Hi @scalphunters,

Apologies in the delay for getting to this.

I followed your update instructions, reinitialized dmriprep using the 0.5.7b10 version, recreated default/template protocol, and ran the same images using this default protocol.

Unfortunately, receiving the same error. Log file attached. Specific error excerpt pasted below. If you require any additional materials or information for troubleshooting, let me know. Thank you.

log.txt

[2023-03-28-12-34-17]
[2023-03-28-12-34-17] Source Image (Previous output) loaded from memory (object id): 140354911011312 [2023-03-28-12-34-17] [DTIPlaygroundModule.initialize] Processed time : 0.09s [2023-03-28-12-34-17] [DTIPlaygroundModule.run] begins ... [2023-03-28-12-34-19] Exception occurred in runPipeline Exception thrown in SimpleITK ExtractImageFilter_Execute: /tmp/SimpleITK/Code/Common/include/sitkTemplateFunctions.h:94: [2023-03-28-12-34-19] sitk::ERROR: Unable to convert vector to ITK type [2023-03-28-12-34-19] Expected vector of length 4 but only got 3 elements. [2023-03-28-12-34-19] Traceback (most recent call last): [2023-03-28-12-34-19] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/dtiplayground/dmri/common/pipeline.py", line 450, in runPipeline [2023-03-28-12-34-19] outres=m.run(opts,global_vars=self.global_variables) [2023-03-28-12-34-19] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/dtiplayground/dmri/common/init.py", line 83, in wrapper [2023-03-28-12-34-19] res=func(*args,*kwargs) [2023-03-28-12-34-19] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/dtiplayground/dmri/common/module.py", line 400, in run [2023-03-28-12-34-19] res=self.process(args,**kwargs) ## main computation for user implementation [2023-03-28-12-34-19] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/dtiplayground/dmri/preprocessing/modules/QC_Report/QC_Report.py", line 36, in process [2023-03-28-12-34-19] global_report = self.AddExcludedGradientsImagesToReport(global_report, excluded_gradients) [2023-03-28-12-34-19] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/dtiplayground/dmri/preprocessing/modules/QC_Report/QC_Report.py", line 132, in AddExcludedGradientsImagesToReport [2023-03-28-12-34-19] images = self.CreateImagesOfExcludedGradients(image_path[image_index], excluded_gradients[image_index]) [2023-03-28-12-34-19] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/dtiplayground/dmri/preprocessing/modules/QC_Report/QC_Report.py", line 234, in CreateImagesOfExcludedGradients [2023-03-28-12-34-19] axial_image = self.AxialView(iter_gradients, input_size, input_image) [2023-03-28-12-34-19] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/dtiplayground/dmri/preprocessing/modules/QC_Report/QC_Report.py", line 281, in AxialView [2023-03-28-12-34-19] extracted_slice = slice_extractor.Execute(input_image) [2023-03-28-12-34-19] File "/export/apps/kkiehl/R_anaconda/anaconda3/envs/dtipg-py38/lib/python3.8/site-packages/SimpleITK/SimpleITK.py", line 9947, in Execute [2023-03-28-12-34-19] return _SimpleITK.ExtractImageFilter_Execute(self, image1) [2023-03-28-12-34-19] RuntimeError: Exception thrown in SimpleITK ExtractImageFilter_Execute: /tmp/SimpleITK/Code/Common/include/sitkTemplateFunctions.h:94: [2023-03-28-12-34-19] sitk::ERROR: Unable to convert vector to ITK type [2023-03-28-12-34-19] Expected vector of length 4 but only got 3 elements. [2023-03-28-12-34-19]

scalphunters commented 1 year ago

Can you share your protocols.yml file?

liukang18 commented 1 year ago

Here is the file for the most recent run

protocols.txt

scalphunters commented 1 year ago

This seems to happen when the input image is nifti in SimpleITK extractor. I need to see more into this.

scalphunters commented 1 year ago

There was some bug in SITK in loading NIFTI. The work-around was applied to new version. Pls try new version

$ pip install dtiplayground==0.5.7b11

Let me know if you have further trouble.

scalphunters commented 1 year ago

Closing this issue. Pls reopen if you have same issue again.