MRG: Link cameras in _LinkViewer#7962
Conversation
|
@bloyl can you give it a try? |
|
Sorry for the delay in testing this. This is pretty cool and does what I'd like. A couple of things I noticed.
My suggestion for point 3 would be use the actual time as opposed to the index to do the linking. Additionally I would add a |
The cameras are linked but the event "the camera has been modified" is not captured simply because I don't know how to do that. And since #7517, the plotter is not updated automatically. I see 2 ways to fix this. Either capture the vtk event (interactor, camera...) or allow automatic update again.
Nice catch! I'll take care of this :)
Hm, this is not intended... I have to check the time axes somehow. @larsoner, @agramfort any idea on how to deal with this? |
|
Hm, this is not intended... I have to check the time axes somehow. @larsoner, @agramfort any idea on how to deal with this?
stc.times should match between linked brains
|
|
|
It turns out, the camera Reference: http://vtk.1045678.n5.nabble.com/Vtk-Camera-Postion-Event-td5727757.html |
| # check time infos | ||
| brain_times = [brain._times for brain in brains] | ||
| if not all(len(x) == len(brain_times[0]) for x in brain_times): | ||
| time = False | ||
| if not all(all(np.equal(x, brain_times[0])) for x in brain_times): | ||
| time = False | ||
|
|
There was a problem hiding this comment.
This second check throws ValueError: operands could not be broadcast if the brain_times are of different lengths and more than one.
why not only do the check if you have to (time == True)
if time and not all(len(x) == len(brain_times[0]) for x in brain_times):
time = False
if time and not all(all(np.equal(x, brain_times[0])) for x in brain_times):
time = False
to test just link a plot of an evoked stc with a cropped copy of the same stc
|
Other than my comment above this is working for me. Additional question, how did you make the 4 panel figure on the right? |
I use the following parameters: |
|
Feel free to have a look or even test it @agramfort, @larsoner |
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>

This PR adds parameters to
link_brains()to decide what to link:timecontroller and/orcameracontrols.ToDo
test_3d.pytime_viewerused as reference intoleaderIt's an item of #7162
Related to #7959