[MARKER]: ReHo #36
No reviewers
Labels
No labels
CRITICAL
Stale
WIP
bug
concept
coordinate
dataset
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
maintenance
maps
marker
mask
on hold
parcellation
preprocess
question
ready
storage
template-space
triage
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
juaml/junifer!36
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/reho"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Which marker do you want to include?
ReHo
Inputs:
List of 3D MNI coordinates and sphere size OR a mask file
A GM brain mask
Output:
An array with one value per coordinate/voxel
Notes:
With coordinates and sphere size, there are two ways to calculate this:
The resulting values are then averaged to get a single value for each coordinate.
Is there any publication or available code?
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5021216/
Do you have a sample code that implements this outside of junifer?
Anything else to say?
No response
There is some code here to compute_reho that may or may not be useful for this marker: https://github.com/FCP-INDI/C-PAC/blob/main/CPAC/reho/utils.py#L70
@fraimondo @synchon @kaurao @omidvarnia I did some research on previous implementations of reho and found that afni has an implementation for this in C code. Afni is also used for reho calculation in xcpengine and it is supposed to be quite efficient which is a plus, as voxelwise reho calculation can be quite time consuming. There is an interface for this using Nipype also, so using this in python/junifer should be reasonably straightforward. The only problem I can see, is that this will lead to a dependency that is likely not "straightforward" to install, and puts the burden of installation on the user. So I guess, the question is, do we want to use this, or do you think it is worth it implementing this ourselves? I have also got the afni reho code in C if anyone would like to see it I can send it.
Test bot
I dealt with this in the past.
Option 1: python implementation but maybe inefficient
Option 2: complicated dependency
Option 3: pack a C-based implementation in our toolbox
Best solution I found so far:
Do 1 and 3. If the user does not manage to compile the C-based implementation / install dependency, it will resort to the inefficient way.
I achieved this by adding a parameter to the marker
methodwith two possible values:corpython.I think in that case it makes sense to prioritise a python implementation first, and then think of a C-based implementation afterwards if/when performance becomes an issue.
@kaurao when you write as input 'List of 3D MNI coordinates and sphere size OR a mask file', by mask file, do you mean a binary mask file so that for each voxel with a 1 you get a reho value, or a parcellation mask, so that for every ROI you get a value?
Indeed this are 2 ReHo markers, the parcel based and the coord based
Didn't mean to unassign anyone, just assign myself. Weird GitHub UI.
Codecov Report
100.00% <ø> (ø)93.52% <76.57%> (-1.29%)?Flags with carried forward coverage won't be shown. Click here to find out more.
75.60% <ø> (ø)90.47% <ø> (+28.57%)68.70% <68.70%> (ø)90.00% <90.00%> (ø)92.00% <92.00%> (ø)92.30% <92.30%> (ø)100.00% <100.00%> (ø)100.00% <100.00%> (ø)94.53% <100.00%> (ø)100.00% <0.00%> (ø)I need to add comparison with afni 3dReHo's output but it's another rabbit hole and from what I understand, the implementation follows the publication.
I'll add the comparisons when I have the data ready.
output["data"] = aggregated_values["data"][np.newaxis, :]
I would change
aggregated_valuestooutputand modify in place. Less memory.same comments as before.
How difficult is to do this before merging the PR?
It's the same thing: https://numpy.org/doc/stable/reference/generated/numpy.expand_dims.html
I can change if you like the other one.
I was trying to not modify in-place but not a bad choice either way, will change.
I'm working on it but there's some issue with type conversions in afni which is blocking it. And, not sure if other errors will pop up after that.
There is also a
.niifile there without a name. I think it should not be there.@ -0,0 +1,510 @@"""Provide estimator class for regional homogeneity (ReHo)."""This can be written only once (no need for 125 neigh separately)
Just set:
end then index as
i - st : i + end, with the product asrange(st, n_x - (end - 1)@ -0,0 +26,4 @@use_afni : bool, optionalWhether to use AFNI for computing. If None, will use AFNI onlyif available (default None).reho_params : dict, optionalThis needs to be documented.
What are the valid reho params?
@ -0,0 +31,4 @@use_afni : bool, optionalWhether to use AFNI for computing. If None, will use AFNI onlyif available (default None).reho_params : dict, optionalSame as with parcels
The comparison might not be correct, but we can still test the implementation separately:
Things to check:
@ -0,0 +34,4 @@# Get BOLD outputreho_parcels_output_bold = reho_parcels_output["BOLD"]# Assert BOLD output keysassert "data" in reho_parcels_output_boldThings to check:
I think it's better to leave this module as it is and try to get it tested by having afni in the CI as we had planned.
@fraimondo I believe I have addressed your comments.
There are 75 Mb of NII files. We don't need those ones.
Indeed I was wondering if we can just test afni v python only when we have the afni toolbox available and avoid shipping this binaries just for testing.
I do that for ALFF
I'm working on getting afni into CI, testing some stuff. I can remove the .nii files and get this in if you like. I'll anyway add the gh-actions stuff in separate PR.
That's exactly what I meant! Perfect!
I have removed the
.niifiles and adapted the tests.Waiting for #153 now.