Skip to content

Commit

Permalink
FIX: Set ROI data before writing array, use uint8
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Nov 8, 2023
1 parent 0d1be7a commit f2395d6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fmriprep/interfaces/gifti.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,21 @@ 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,
ordering=darray.ind_ord,
meta=meta,
)

img.darrays[0] = darray

Check warning on line 62 in fmriprep/interfaces/gifti.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/interfaces/gifti.py#L62

Added line #L62 was not covered by tests

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
Expand Down

0 comments on commit f2395d6

Please sign in to comment.