From f2395d6c5f7d4bd71fbe7581bb5a687bb7b52636 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 8 Nov 2023 15:49:55 -0500 Subject: [PATCH] FIX: Set ROI data before writing array, use uint8 --- fmriprep/interfaces/gifti.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fmriprep/interfaces/gifti.py b/fmriprep/interfaces/gifti.py index d26f07455..b759b15ca 100644 --- a/fmriprep/interfaces/gifti.py +++ b/fmriprep/interfaces/gifti.py @@ -46,10 +46,12 @@ def _run_interface(self, runtime): # wb_command -metric-math "abs(var * -1) > 0" roi = np.abs(darray.data) > 0 + # Divergence: Set datatype to uint8, since the values are boolean + # wb_command sets datatype to float32 darray = nb.gifti.GiftiDataArray( roi, intent=darray.intent, - datatype=darray.datatype, + datatype='uint8', encoding=darray.encoding, endian=darray.endian, coordsys=darray.coordsys, @@ -57,6 +59,8 @@ def _run_interface(self, runtime): meta=meta, ) + img.darrays[0] = darray + out_filename = os.path.join(runtime.cwd, f"{subject}.{hemi}.roi.native.shape.gii") img.to_filename(out_filename) self._results["roi_file"] = out_filename