# Getting more information from mouse pointer in 3D view

**URL:** https://discourse.slicer.org/t/getting-more-information-from-mouse-pointer-in-3d-view/9935
**Category:** Development
**Created:** [January 24, 2020, 10:11am UTC](https://discourse.slicer.org/t/getting-more-information-from-mouse-pointer-in-3d-view/9935 "2020-01-24T10:11:14Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Niels](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@Niels](https://discourse.slicer.org/u/Niels)
#### Post date: [January 24, 2020, 10:11am UTC](https://discourse.slicer.org/t/getting-more-information-from-mouse-pointer-in-3d-view/9935/1 "2020-01-24T10:11:14Z")

</div>

Hello slicer developers,

For my module I need the user to mouse click in the 3D view and see if it hits the 3D model. I found this example:

[https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get\_scalar\_values\_at\_surface\_of\_a\_model](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_scalar_values_at_surface_of_a_model)

and this user that did something similar:

> [@Select cells of a 3D model](https://discourse.slicer.org/t/select-cells-of-a-3d-model/7753):
>
> how to create a mouse event inside the 3d slicer view. Need to pick cells from a mesh object from within the 3d slice view of the slicer. Need help

Is there also a way to read a mouse button event in the 3D view?  
Is there another way to get the 2D or 3D mouse coordinates from the 3D view?

---

<div class="post-metadata">

### Author: ![Niels](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@Niels](https://discourse.slicer.org/u/Niels)
#### Post date: [January 24, 2020, 11:47am UTC](https://discourse.slicer.org/t/getting-more-information-from-mouse-pointer-in-3d-view/9935/2 "2020-01-24T11:47:39Z")

</div>

I think this might solve part of my problem:

> [@Segment Editor and rotate/tumble/orbit function in 3D view](https://discourse.slicer.org/t/segment-editor-and-rotate-tumble-orbit-function-in-3d-view/2726/9):
>
> I’ve made painting/erasing in 3D view optional. It should be available in nightly builds that you download tomorrow or later. I’ve also added “smudge” option to Paint effect: auto-select segment at click position, which should help in minimizing switching between segments when adjusting boundaries between them. I’ve also added option to erase all segments (not just the selected segment) using Erase effect.

This seems to hit the model in the 3D view and identify the slice coordinates? if so i need to capture the mouse click-events en calculate the RAS coords.

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [January 24, 2020, 3:36pm UTC](https://discourse.slicer.org/t/getting-more-information-from-mouse-pointer-in-3d-view/9935/3 "2020-01-24T15:36:20Z")

</div>

You can either use [crosshair node](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_scalar_values_at_surface_of_a_model) or a markups node (in Slicer Preview Releases, when markups is in place mode, you can [get the 3D coordinates](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Manipulating_objects_in_the_slice_viewer) of the mouse cursor from the markups node).

---

<div class="post-metadata">

### Author: ![Niels](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@Niels](https://discourse.slicer.org/u/Niels)
#### Post date: [January 24, 2020, 4:12pm UTC](https://discourse.slicer.org/t/getting-more-information-from-mouse-pointer-in-3d-view/9935/4 "2020-01-24T16:12:31Z")

</div>

Hi Andras,  
Yes using a markup node seems to work as well. For me it would work best if it is placed when a key is pressed or moushe click recorded in the 3D view. So i can remove it when the key or mouse button is released. Is there a way to record that in the 3D view?

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [January 24, 2020, 4:34pm UTC](https://discourse.slicer.org/t/getting-more-information-from-mouse-pointer-in-3d-view/9935/5 "2020-01-24T16:34:29Z")

</div>

When you click with the mouse then the markup is placed, which changes the state of that markup point. You can observe state changes similarly to position changes. If you don’t need to keep displaying the markup then you can delete it right after the point is placed.
