Skip to content

Commit 2ed5d1b

Browse files
committed
FIX: Set ROI data before writing array, use uint8
1 parent 70a6698 commit 2ed5d1b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fmriprep/interfaces/gifti.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,21 @@ def _run_interface(self, runtime):
4646
# wb_command -metric-math "abs(var * -1) > 0"
4747
roi = np.abs(darray.data) > 0
4848

49+
# Divergence: Set datatype to uint8, since the values are boolean
50+
# wb_command sets datatype to float32
4951
darray = nb.gifti.GiftiDataArray(
5052
roi,
5153
intent=darray.intent,
52-
datatype=darray.datatype,
54+
datatype='uint8',
5355
encoding=darray.encoding,
5456
endian=darray.endian,
5557
coordsys=darray.coordsys,
5658
ordering=darray.ind_ord,
5759
meta=meta,
5860
)
5961

62+
img.darrays[0] = darray
63+
6064
out_filename = os.path.join(runtime.cwd, f"{subject}.{hemi}.roi.native.shape.gii")
6165
img.to_filename(out_filename)
6266
self._results["roi_file"] = out_filename

0 commit comments

Comments
 (0)