Repository navigation
MRG+1: head_to_mni - #4344
MRG+1: head_to_mni#4344
Conversation
delete extract_label_time_course_AP
and overwrite extract_label_time_course, _gen_extract_label_time_course
volume_label could be a list get_volume_labels_from_aseg_AP removed
Codecov Report
@@ Coverage Diff @@
## master #4344 +/- ##
=========================================
+ Coverage 87.97% 88.07% +0.1%
=========================================
Files 356 356
Lines 64997 65322 +325
Branches 11101 11128 +27
=========================================
+ Hits 57181 57533 +352
+ Misses 4982 4960 -22
+ Partials 2834 2829 -5 |
|
Hi @agramfort ! About the travis error, it seems to me that the only error is that I have to add aseg_vertex_to_mni in doc/python_reference.rst. Is it? and if yes where? Thks! |
|
In the "Source Space Data" section, you can put it in as |
|
Actually it's in |
larsoner
left a comment
There was a problem hiding this comment.
Other than a few minor comments, LGTM
|
|
||
| Parameters | ||
| ---------- | ||
| vertices : n_vertices x 3 array of float |
There was a problem hiding this comment.
If these are in the head coordinate system, pos would be a better name. vertices we try to reserve for vertices on a FreeSurfer mesh.
There was a problem hiding this comment.
done!
Since aseg_vertex_to_mni works also for vertices in the cortex surface, do we have to change
the name?
There was a problem hiding this comment.
Well it doesn't work for "vertices" in the sense that we typically mean "vertices" in mne. "vertices" in MNE refer to indices into a subject's Freesurfer surface mesh, not (n, 3) arrays of the coordinates of those points.
This function as far as I can tell will take any point in head coords and convert it to MNI coords. So the name is a bit odd. Maybe it should be head_to_mni? @agramfort WDYT?
There was a problem hiding this comment.
I changed in the function vertices with pos.
There was a problem hiding this comment.
Yes inside the function the name has changed. I'm talking about the name of the function itself aseg_vertex_to_mni actually does something different, it converts (any) points in the head coordinate frame to the MNI coordinate frame, right?
There was a problem hiding this comment.
Yes, also to me now aseg_vertex_to_mni is a weird name.
head_to_mni sounds good.
| subjects_dir = get_subjects_dir(subjects_dir, raise_error=True) | ||
|
|
||
| # before we go from head to MRI (surface RAS) | ||
| head_mri_t = invert_transform(mri_head_t) |
There was a problem hiding this comment.
head_mri_t = _ensure_trans(mri_head_t, 'head', 'mri')
| try: | ||
| ind = all_labels_aseg[0].index(roi_str) | ||
| color = np.array(all_labels_aseg[1][ind]) / 255 | ||
| color = tuple(np.array(all_labels_aseg[1][ind]) / 255.) |
There was a problem hiding this comment.
I did this change a lot of months ago so now I don't remember the reason...
Can I leave tuple?
There was a problem hiding this comment.
It would be better to revert if possible, we try to keep ndarray unless there is a reason not to
There was a problem hiding this comment.
ok, I reverted it!
If I remember the reason I'll update you.
| The coordinates (in m) of the vertices in head coo system | ||
| subject : string | ||
| Name of the subject to load surfaces from. | ||
| mri_head_t: Transform |
There was a problem hiding this comment.
You can just call this trans, we do this in user-facing functions
| subject : string | ||
| Name of the subject to load surfaces from. | ||
| mri_head_t: Transform | ||
| mri head tranformation |
There was a problem hiding this comment.
MRI<->Head coordinate transformation.
| """ | ||
| if not has_freesurfer() and not has_nibabel(): | ||
| raise RuntimeError('NiBabel (Python) or Freesurfer (Unix) must be ' | ||
| 'correctly installed and accessible from Python') |
There was a problem hiding this comment.
Let's let _read_talxfm handle throwing errors. If what is there is not already sufficient, let's improve it there.
| Parameters | ||
| ---------- | ||
| vertices : n_vertices x 3 array of float | ||
| The coordinates (in m) of the vertices in head coo system |
larsoner
left a comment
There was a problem hiding this comment.
Other than a minor gripe, LGTM.
@agramfort feel free to merge if you're happy after my small comment is addressed
| return_several = False | ||
| return_generator = False | ||
| elif isinstance(stcs, MixedSourceEstimate): | ||
| stcs = [stcs] |
There was a problem hiding this comment.
I don't think this should be part of this PR? (Also I think you want return_several = return_generator = False for this when it is eventually part of a PR.)
| return_several = False | ||
| return_generator = False | ||
| elif isinstance(stcs, MixedSourceEstimate): | ||
| stcs = [stcs] |
|
|
||
| Parameters | ||
| ---------- | ||
| pos : n_pos x 3 array of float |
There was a problem hiding this comment.
bad formatting. It should be:
pos : array, shape (n_pos, 3)
|
|
||
| Returns | ||
| ------- | ||
| coordinates : n_pos x 3 array of float |
There was a problem hiding this comment.
coordinates : array, shape (n_pos, 3)
| The coordinates (in m) in head coordinate system | ||
| subject : string | ||
| Name of the subject. | ||
| mri_head_t: trans |
There was a problem hiding this comment.
trans -> instance of Transform
|
you have travis errors due to bad docstring formatting. |
|
Thanks @annapasca ! |
* new functions to hangle mixed src spaces in inverse * example script * add get_volume_labels_from_src delete extract_label_time_course_AP * compute connectivity btw 74 regions in a mixed src space * delete extract_label_time_course_AP, _gen_extract_label_time_course_AP and overwrite extract_label_time_course, _gen_extract_label_time_course * add get_volume_labels_from_src * minor fix * minor fix * minor fix * get_volume_labels_from_aseg_AP removed * added test_read_volume_from_src * _get_lut_AP removed volume_label could be a list get_volume_labels_from_aseg_AP removed * minor fix * only compute the inverse in mixed source space * connectivity on mixed src space * minor fix * minor fix * minor fix * minor fix * new test_source_space_from_label * minor fix * docstyle update * minor fix * change pos value * minor fix * change comment * minor fix * minor fix * add return_colors par to get_volume_labels_from_aseg * minor fix * minor fix * minor fix * minor fix * minor fix * minor fix * minor change * minor change * add plot of some labels * add check on FO and pick_ori to set psd dim * minor fix * add test for compute_source_psd() * minor change * unified test for compute_source_psd * add check MixedSourceestimate * added aseg_vertex_to_mni * fix bug color aseg * delete white spaces * remove xfm as output, add mri_head_t as input * update inputs * added test_aseg_vertex_to_mni * added aseg_vertex_to_mni * changed vertices -> pos * aseg_vertex_to_mni -> head_to_mni * removed check in extract_label_time_course * minor fix * minor fix * removed blank line
fixed bug in color of aseg label
add function to convert to MNI space the coo of aseg labels