Skip to content

RadQy Dimension Error with Diffusion Weighted Imaging  #45

@kyle-sullivan315

Description

@kyle-sullivan315

Hello, my team and I are attempting to run radqy on our BIDS dataset (nii.gz - compressed nifti files). So far the tool is able to process our anatomical scans, but we are hitting an issue with our diffusion weighted imaging (dwi) scans. For dwi scans with just one volume, there is no issue. But for our dwi scans with more than one volume, we get the following error:

Traceback (most recent call last):
File ".../radqy-0.1.5/bin/radqy", line 8, in
sys.exit(run_cli())
File ".../radqy-0.1.5/lib/python3.10/site-packages/radqy/cli.py", line 44, in run_cli
main(args)
File ".../radqy-0.1.5/lib/python3.10/site-packages/radqy/radqy.py", line 616, in main
s = IQM(v, name, total_participants, participant_index, subject_type, total_tags, fname_outdir, save_masks_flag,functions, sample_size, scan_type)
File ".../radqy-0.1.5/lib/python3.10/site-packages/radqy/radqy.py", line 452, in init
self.save_image(participant, I, j, folder)
File ".../radqy-0.1.5/lib/python3.10/site-packages/radqy/radqy.py", line 482, in save_image
plt.imsave(image_path, I, cmap=cm.Greys_r)
File ".../radqy-0.1.5/lib/python3.10/site-packages/matplotlib/pyplot.py", line 2604, in imsave
matplotlib.image.imsave(fname, arr, **kwargs)
File ".../radqy-0.1.5/lib/python3.10/site-packages/matplotlib/image.py", line 1636, in imsave
rgba = sm.to_rgba(arr, bytes=True)
File ".../radqy-0.1.5/lib/python3.10/site-packages/matplotlib/cm.py", line 399, in to_rgba
raise ValueError("Third dimension must be 3 or 4")
ValueError: Third dimension must be 3 or 4

It appears to be an issue creating the .pngs where the dimensions of the nifti files are not compatible with RGB or RGB-A format, but again, only when the scan has multiple volumes. Investigating the shape of the scans using a python tool called nibabel gives the following:
single volume scan shape: (140, 140, 22)
multiple volume (5) scan shape: (160, 160, 22, 5)

Have you encountered this error before? Do you know of a work around or fix? Thanks.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions