Repository navigation
MRG: Add talairach.xfm and MRI scaling to coreg - #5132
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5132 +/- ##
==========================================
+ Coverage 88.14% 88.19% +0.04%
==========================================
Files 356 358 +2
Lines 65774 65974 +200
Branches 11193 11214 +21
==========================================
+ Hits 57978 58184 +206
+ Misses 4959 4957 -2
+ Partials 2837 2833 -4 |
|
Okay transform issue fixed. Ready for review/merge from my end. |
|
... and I did a tiny bit of plotting in |
|
@christianbrodbeck WDYT? |
|
Conceptually it makes sense, for reviewing it will take me a little longer to get to it (sorry)... |
|
@cjayb any experience working with MRIs? If so do you want to take a look? @christianbrodbeck any time to look this week? We're trying to push out a release and it would be good to have this if possible. |
| # test exceeding tolerance | ||
| tgt_pts[0, :] += 20 | ||
| assert_raises(RuntimeError, fit_matched_points, tgt_pts, src_pts, tol=10) | ||
| pytest.raises(RuntimeError, fit_matched_points, tgt_pts, src_pts, tol=10) |
There was a problem hiding this comment.
What are your thoughts about the pytest natural syntax using context manager?
with pytest.raises(RuntimeError):
fit_matched_points(tgt_pts, src_pts, tol=10)I prefer it since the call is more clear.
There was a problem hiding this comment.
I do it for all new code but for older stuff I just swap this in as it's faster (you can do a search/replace very easily, and there are a lot of them).
|
LGTM |
|
Looking into it now. |
christianbrodbeck
left a comment
There was a problem hiding this comment.
The code looks good, but I don't know enough about the MRI file formats to help with the scaled MRI and xfm. I tried plotting with plot_bem and got the image below, would you expect that mismatch?
mne.viz.plot_bem('sample-fsa-small', '.', src='sample-fsa-small-ico-5-src.fif', brain_surfaces='white')
| path = transform_fname.format(subjects_dir=subjects_dir, subject=subject) | ||
| if os.path.exists(path): | ||
| paths['transforms'].append(transform_fname) | ||
| del transform_fname, path |
There was a problem hiding this comment.
Is this del statement left over from debugging?
There was a problem hiding this comment.
No, it's more for code safety to ensure if path is used later it's using the correct one
| _write_fs_xfm(fname_to, T_ras_mni['trans'], kind) | ||
|
|
||
|
|
||
| def _get_sf(subject_to, subject_from, scale, subjects_dir): |
There was a problem hiding this comment.
This kind of duplicates the _scale_params function further up, maybe the two could be unified?
|
That plot looks incorrect. Can you see if |
|
I am not familiar with freeview, how would you plot it?
… On Apr 26, 2018, at 12:03 PM, Eric Larson ***@***.***> wrote:
That plot looks incorrect. Can you see if freeview shows it correctly? It would tell us if there is a bug in plot_bem or in this code
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#5132 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAI5a_FZxE33ZQJcMAGoWCskWILHLQtUks5tse_YgaJpZM4TUAAU>.
|
|
Okay yeah, adding the T1 under Volumes and smoothwm under Surfaces looks like it has the same mismatch. |
|
Here is an example for You'll need to make sure the |
|
Argh yes I think you're right, it doesn't quite look right here after scaling with 80/100/120%: |
|
Okay there was an ordering problem that should now be fixed. This is what I see using 90/110/120 as my And then deforming import mne
surf = mne.read_bem_surfaces(subjects_dir + '/sample_deformed/bem/sample_deformed-inner_skull-bem.fif')[0]
mne.write_surface(subjects_dir + '/sample_deformed/bem/inner_skull.surf',
surf['rr'] * 1000, surf['tris'])
mne.viz.plot_bem('sample_deformed', brain_surfaces='pial',
subjects_dir=subjects_dir)I get: @christianbrodbeck can you see if things are fixed now for you, too? |
It probably assumes that the |
|
Thx ! |
* ENH: Add talairach.xfm and MRI scaling to coreg * FIX: Fix transform * FIX: Bump version * STY: Cleaner * FIX: Fix scale order and unify








This should work once nipy/nibabel#619 is sorted out.@christianbrodbeck does this look good to you assuming I can work out the
nibabelbug and thus get tests to pass?