Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Fix transform for func.gii time series #140

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions neuromaps/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def construct_shape_gii(data, names=None, intent='NIFTI_INTENT_SHAPE',
"""
intent_dtypes = {
'NIFTI_INTENT_SHAPE': 'float32',
'NIFTI_INTENT_TIME_SERIES': 'float32',
'NIFTI_INTENT_LABEL': 'int32'
}
dtype = intent_dtypes.get(intent, 'float32')
Expand Down
13 changes: 12 additions & 1 deletion neuromaps/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,18 @@
)
for fn in (func, MASKSURF):
run(fn.format(**params), quiet=True)
resampled += (construct_shape_gii(load_data(params['out'])),)

if img.read_text().find("NIFTI_INTENT_TIME_SERIES") != -1:
params["out"].write_text(

Check warning on line 365 in neuromaps/transforms.py

View check run for this annotation

Codecov / codecov/patch

neuromaps/transforms.py#L364-L365

Added lines #L364 - L365 were not covered by tests
params["out"].read_text().replace(
"NIFTI_INTENT_NORMAL", "NIFTI_INTENT_TIME_SERIES"
)
)
intent = "NIFTI_INTENT_TIME_SERIES"

Check warning on line 370 in neuromaps/transforms.py

View check run for this annotation

Codecov / codecov/patch

neuromaps/transforms.py#L370

Added line #L370 was not covered by tests
else:
intent = "NIFTI_INTENT_SHAPE"

Check warning on line 372 in neuromaps/transforms.py

View check run for this annotation

Codecov / codecov/patch

neuromaps/transforms.py#L372

Added line #L372 was not covered by tests

resampled += (construct_shape_gii(load_data(params["out"]), intent=intent),)

Check warning on line 374 in neuromaps/transforms.py

View check run for this annotation

Codecov / codecov/patch

neuromaps/transforms.py#L374

Added line #L374 was not covered by tests
params['out'].unlink()
if tmpimg is not None:
tmpimg.unlink()
Expand Down