Skip to content

Automatic copy of manually created Bval/bvec files

Currently,

the MRI class defines a post copy function that copies the bval/bvec files for DWI along with the nii file to the bidsified directory if the bval/bvec/nii are of the form:

cmrr_noddi_1.4mm_p3_mb2_gz_24.nii.gz
cmrr_noddi_1.4mm_p3_mb2_gz_24.bval
cmrr_noddi_1.4mm_p3_mb2_gz_24.bvec

The issue arises if a user tries to create additional bval/bvec with the function:

SaveBval(fname=rec_path)

with rec_path = recording.currentFile(base=False)

If the file is a ".nii.gz" (as output by dcm2niix for example), then the name of the output bval/bvec is:

cmrr_noddi_1.4mm_p3_mb2_gz_24.nii.bval
cmrr_noddi_1.4mm_p3_mb2_gz_24.nii.bvec

Notice the extra ".nii" in the bval/bvec names. Filename manipulation is always possible but it would be more efficient to use the same logic for the deriving the base name in both MRI:_post_copy_bidsified and SaveBvalfunctions:

out_base = os.path.splitext(fname)[0]
Edited by Grégory Hammad