FCP-INDI / C-PAC

Configurable Pipeline for the Analysis of Connectomes
https://fcp-indi.github.io/
GNU Lesser General Public License v3.0
64 stars 41 forks source link

🐛 MDMR code #1721

Open diegoaper opened 2 years ago

diegoaper commented 2 years ago

Describe the bug

Hello! I have been looking at the code for running MDMR through cpac's group analysis feature. I however ran into a roadblock that I can't seem to understand or at least figure out. When the cwas.py script loads the 4-D functional images into pandas, it reads each subject into an array of (subject, volumes (time), x, y, z) (line 166; cwas.py) based on a mask of the subject group (if you allow it auto-create a mask or input an ROI mask). This becomes a problem because in the code for computing the distance matrix there is an error on how the voxel information is extracted. In the function calcsubdists (line 48; cwas.py) subjects, voxels, = subjects_data.shape gives this error "ValueError: not enough values to unpack (expected 3, got 1)". The output has (37, ) which is missing the voxel information. Somewhere it deletes it or loses the information. (37 is the number of subjects I have running even though I asked for 33).

To reproduce

Run the command cpac group mdmr [group_config.yml] and let the code run. Input 4D nifti files from CPAC 1.7.2 functional_to_standard_smooth folder. This has to be run under CPAC 1.7.2 to avoid the yaml parsing error that appears.

Expected behavior

For the matrix calculation to occur like the code runs in the R counter part. Then to calculate the correlation and output a z-score image of the voxels associated with the variable of interest accounting for the selected regressors.

Acceptance criteria

Testing the port from R to python to make sure no other bugs appear.

Screenshots

No response

C-PAC version

v1.7.2

Container platform

Docker

Docker and/or Singularity version(s)

No response

Additional context

No response

shnizzedy commented 2 years ago

Links to the referenced lines above

When the cwas.py script loads the 4-D functional images into pandas, it reads each subject into an array of (subject, volumes (time), x, y, z) (https://github.com/FCP-INDI/C-PAC/blob/55ae58c004307294dae41ba4a60120ca444bf465/CPAC/cwas/cwas.py#L166-L169) based on a mask of the subject group (if you allow it auto-create a mask or input an ROI mask).

In the function calc_subdists (https://github.com/FCP-INDI/C-PAC/blob/55ae58c004307294dae41ba4a60120ca444bf465/CPAC/cwas/cwas.py#L48-L61) gives this error "ValueError: not enough values to unpack (expected 3, got 1)".