Open
Conversation
oesteban
reviewed
Aug 29, 2022
oesteban
left a comment
There was a problem hiding this comment.
This is good. Some comments:
- You want to give more details in your PR comment. It is good to mention what the problem was and how you went about it.
- Similarly, if you had several commits (you only have one), those individual commits should also have descriptive messages for the reviewer to follow your tracks
- Left a couple of comments
| #- Calculate the SPM global value for each volume. | ||
| spm_vals = [] | ||
| for i in range(data.shape[-1]): | ||
| volume = data[:, :, :, i] |
There was a problem hiding this comment.
I would suggest using ellipsis here:
Suggested change
| volume = data[:, :, :, i] | |
| volume = data[..., i] |
| for i in range(data.shape[-1]): | ||
| volume = data[:, :, :, i] | ||
| spm_vals.append(spm_global(volume)) | ||
| return spm_vals # Return the result. |
There was a problem hiding this comment.
What is the type of spm_vals?
If you read the docstring (line 54 above) it says array, which is very unclear but seems to refer to a numpy.array, however, you return a basic list here. Consider converting it to array before returning or else downstream methods could fail. For instance, with the current implementation you would not be able to do:
average_spm = get_spm_globals(nifti_file).mean()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated spm_funcs.py script.