Open joaovduarte opened 2 years ago
Hello @joaovduarte and @alfnie ,
Allow me to add two more hints regarding this topic:
conn_importvol2bids.m
, line 120:newfilename=regexprep(newfilename,'\.gz$','');
Hope this helps to track down the issue.
Best,
Thanks @joaovduarte and @alexsayal for the detailed info!. The issue occurred when importing multiple compressed fmap files into CONN using the 'copy to derivatives folder and import' or 'copy to project BIDS folder and import' options, where CONN was attempting to merge these multiple 3D files into a single 4D file (and that merge operation was failing when the original files were compressed). I have uploaded a fix for this issue in commit 0135d0cb81c27086c7e7dd5a94811453fe0dd488. If you have a chance please give that a try and let me know if you still run into any issues. Thanks again!
Hello @alfnie , thank you for the quick reply.
I have now tested your fix and I am afraid it still does fully not solve the problem.
The EchoTime1
and EchoTime2
parameters are placed in the .json file associated with the phasediff image. However, as only one file is copied (with the suffix _magnitude1
), the phasediff image and its corresponding .json file are not copied. This results in an error when automatically detecting the echo times.
Sidenote: I now re-checked that the BIDS format allows for having .json files associated with each magnitude image as well (and I will attempt a fix in the converter) but I guess the error would still persist, since EchoTime2
would only be present on the magnitude2
.json.
Best,
Just to add, that since what is mandatory (and has been like this since the first versions of the BIDS standard) is (link):
In this particular case, the sidecar JSON file sub-<label>[_ses-<label>][_acq-<label>][_run-<index>]_phasediff.json MUST define the time of two echos used to map the phase and finally calculate the phase-difference map
I suggest to fetch these parameters first from the _phasediff.json
file. What do you think?
@alexsayal thanks for following this up, and yes, definitely, I agree regarding the _phasediff.json file. Could you please try the latest commit 5e816c32cdadc24d4ab976498b19a71a0aadfe09 in your data to see if that would now read the .json information from the correct file?
(note: I should also change the output file names after merging in the 'copy to derivatives folder and import' option, since naming those new 4D files _magnitude1 or _phasediff is misleading at best; I will check the BIDS convention and update the code and this thread accordingly)
Thank you, it seems to be working now as expected - the information from the .json file is read correctly.
Dear Alfonso,
I am using conn21a to create a new project by importing data from BIDS dataset. The dataset has successfully been validated with BIDS validator, and it contains "anat" (T1w scan), "fmap" (magnitude1, magnitude2, and phasediff), and "func" (rest-bold), all files in compressed *nii.gz format.
During import, conn stops and throws the error below. It seems it happens when dealing with field map files. I tried using the development version and also conn20b with the same data. The import was done "without errors", however the derivatives/fmap ends up with only one file: magnitude1.nii
Do you have any idea why this might be happening?
Looking forward to hearing from you. Thank you in advance. Best, João
ERROR DESCRIPTION:
Error using file2mat Cant open file.
Error in file_array/subsref>multifile2mat (line 179) val(cc(i)+1:cc(i+1)) = file2mat(obj,int64(1),int64(x(y==i)));
Error in file_array/subsref>subfun (line 99) t = multifile2mat(sobj,varargin{:});
Error in file_array/subsref (line 65) t = subfun(sobj,args{:});
Error in nifti/subsref>rec (line 221) t = subsref(t,subs(2:end));
Error in nifti/subsref>rec (line 234) ti = rec(ti,subs(2:end));
Error in nifti/subsref (line 45) varargout = rec(opt,subs);
Error in spm_file_merge (line 148) ni.dat(:,:,:,i) = N(i).dat(:,:,:,ind(i,1),ind(i,2));
Error in conn_fileutils (line 386) else spm_file_merge(varargin{:});
Error in conn_importvol2bids (line 183) conn_fileutils('spm_file_merge',a,out);
Error in conn_importbids (line 119) [nill,nill,nV]=conn_importvol2bids(char(fnames),nsub,nses,'fmap','fmap',[],[],[],[],true);
Error in conn (line 6106) if bids_dofunc, [ok,err]=conn_importbids(info.dataset_select.func.data.file,'type','functional','subjects',nsubs,'subjects_id',bids_subj_id,'nset',nset,'localcopy',localcopy,'copytoderiv',copytoderiv); ERR=[ERR err]; end CONN21.a SPM12 Matlab v.2019b project: CONN21.a storage: 14108.2Gb available
spm @ /SCRATCH/software/toolboxes/spm12 conn @ /SCRATCH/software/toolboxes/conn21a