Repository: mne-tools/mne-python

Issue:
axes reversed on coreg
The MNE I'm running is the latest development version as of this afternoon, running in the conda environment as specified here: https://raw.githubusercontent.com/mne-tools/mne-python/master/environment.yml

The axes in mne.gui_coregistration() are reversed (left is right, top is bottom).


Discussion:
Are you using a transparent head? They might just appear reversed because you are seeing the inside of the opposite side of the head, which is shown opaque (to hide markers behind it).

Can you post an image?
I believe it's opaque. The fiducials are also invisible from most angles, and changing them by click doesn't seem to work with any reliability. MNE 15 seems to have none of these problems on the same data/environment.

![image](https://user-images.githubusercontent.com/22842307/39133460-83618834-4714-11e8-8c32-a09bd1952c30.png)


Also, altering the viewpoint with the mouse is reversed, i.e. dragging right rotates in the opposite direction.
Can you do "display options" and ensure that the head is set to `opacity=1.`. Does it change when tweaking the opacity in the range between 0 and 1?

All of the behaviors you describe are consistent with the head having opacity `0.`, as the inside surface always has opacity `1.`.
It was set to 1, but something interesting happened when tweaking it: it
does indeed return to normal at values very near 1, but 1 itself breaks it.

On 23 April 2018 at 16:52, Eric Larson <notifications@github.com> wrote:

> Can you do "display options" and ensure that the head is set to opacity=1..
> Does it change when tweaking the opacity in the range between 0 and 1?
>
> All of the behaviors you describe are consistent with the head having
> opacity 0., as the inside surface always has opacity 1..
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/mne-tools/mne-python/issues/5152#issuecomment-383603644>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AVyLw-EFr1KA8YVxvDFqocKIhOELTNRsks5treqkgaJpZM4Te_kQ>
> .
>

Ahh okay. I have seen this sort of bug with Mayavi before. I'll see if I can make a PR to fix it

Resolving patch:
diff --git a/mne/gui/_viewer.py b/mne/gui/_viewer.py
--- a/mne/gui/_viewer.py
+++ b/mne/gui/_viewer.py
@@ -506,14 +506,8 @@ def plot(self):
         normals = _create_mesh_surf(surf, fig=fig)
         self.src = normals.parent
         rep = 'wireframe' if self.rep == 'Wireframe' else 'surface'
-        surf = pipeline.surface(
-            normals, figure=fig, color=self.color, representation=rep,
-            line_width=1)
-        surf.actor.property.backface_culling = True
-        self.surf = surf
-        self.sync_trait('visible', self.surf, 'visible')
-        self.sync_trait('color', self.surf.actor.property, mutual=False)
-        self.sync_trait('opacity', self.surf.actor.property)
+        # Add the opaque "inside" first to avoid the translucent "outside"
+        # from being occluded (gh-5152)
         if self._block_behind:
             surf_rear = pipeline.surface(
                 normals, figure=fig, color=self.color, representation=rep,
@@ -524,6 +518,14 @@ def plot(self):
                             mutual=False)
             self.sync_trait('visible', self.surf_rear, 'visible')
             self.surf_rear.actor.property.opacity = 1.
+        surf = pipeline.surface(
+            normals, figure=fig, color=self.color, representation=rep,
+            line_width=1)
+        surf.actor.property.backface_culling = True
+        self.surf = surf
+        self.sync_trait('visible', self.surf, 'visible')
+        self.sync_trait('color', self.surf.actor.property, mutual=False)
+        self.sync_trait('opacity', self.surf.actor.property)
 
         self.scene.camera.parallel_scale = _scale
 


Test patch: