VisionandCognition / NHP-BIDS

Code for NHP-MRI (e.g., Retinotopy, Curve-tracing, Figure-ground) using NiPype and the BIDS format.
7 stars 1 forks source link

Motion correction: Functional runs with differently sized nifti files #19

Closed pcklink closed 4 years ago

pcklink commented 4 years ago

In the post-surgery (2019) scans from Eddy, epi scans can have slightly different dimensions because we were figuring out the best way to capture. This raises a problem in the motion correction workflow where things are registered to a reference.

Solution: build in a step to rectify the functional run

pcklink commented 4 years ago

Potential solution:

pcklink commented 4 years ago

Turns out there was a version issue with flirt. Flirt 5 works with 4d nifti files by taking the 1st volume, while flirt 6 throws an error and gives no output. This crashes the workflow. Fixed by adding a step that takes the median of a 4d series for flirt.

Remaining error is due to the non-linear slice-by-slice registration with 3dAllineate. This fails if a (masked) functional slice is empty. Under these circumstance, no corrected slice is returned and the resulting 3d volume has a different z-dimension. In next steps fslmaths operations fail because of this.

pcklink commented 4 years ago

The slice-by-slice error is now also solved by resampling the slice-by-slice corrected volume to the reference grid using 3dresample. The preprocessing workflow now finishes without error for the one session I tested. Tests with different datasets are however still needed.

pcklink commented 4 years ago

The workflow also executes and finishes at the LISA cluster. The regular expression substitution that creates the folder-name within derivatives does however not result in the correct filename because of the way the new refsubject id is handled. I think I fixed it. Processing other runs at LISA now...

pcklink commented 4 years ago

All Eddy's 2019 data has now been preprocessed with the new 2019 template. Results look good, with the usual caveats that too large movements cannot be corrected but are marked as motion outlier volumes instead.