# How can get id slice?

**URL:** <https://discourse.slicer.org/t/how-can-get-id-slice/22521>\
**Category:** Support\
**Tags:** build, segmentation, dicom\
**Created:** [March 15, 2022, 2:08pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521 "2022-03-15T14:08:32Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicdubovic](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nicdubovic/32/10381_2.png) [@nicdubovic](https://discourse.slicer.org/u/nicdubovic)\
**Post date:** [March 15, 2022, 2:08pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/1 "2022-03-15T14:08:32Z")

</div>

I try to get id slices when using tools in the SegmentEditor module. How can I get it?

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [March 15, 2022, 3:22pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/2 "2022-03-15T15:22:00Z")

</div>

I think there are a few different things you might mean. Do you mean segment IDs (a string of characters which uniquely identifies a segment within a segmentation)? Or a slice view ID (a string of characters which uniquely identifies one of the slice view areas, like the Red, Yellow, or Green slices)? Can you share a little more about what you are trying to do?

---

<div class="post-metadata">

**Author:** ![nicdubovic](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nicdubovic/32/10381_2.png) [@nicdubovic](https://discourse.slicer.org/u/nicdubovic)\
**Post date:** [March 15, 2022, 3:40pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/3 "2022-03-15T15:40:08Z")

</div>

I would like to get (if they exist) model slicing identifiers. I need to save the values of identifiers after the interaction of the instrument on the scene. And I need to know that for each slide there is a unique identifier belonging only to it and not changing. I think it can be found in dicome or there is another way. Please explain how to find it. if I’m not right, tell me.  
I guess I mean the second variant, but it’s not exactly

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [March 15, 2022, 4:32pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/4 "2022-03-15T16:32:35Z")

</div>

I am still having trouble understanding exactly what you are looking for. When you say the “interaction of the instrument on the scene”, are you referring to a surgical instrument (like for image-guided surgical interventions), or are you referring to a segment editor tool (like “Threshold” or “Smoothing”)?

> [@nicdubovic](#):
>
> I think it can be found in dicom

There are unique identifiers in DICOM headers, but these don’t refer to Slicer objects, they instead allow cross referencing between DICOM files, so I’m not sure whether that is what you are looking for.

---

<div class="post-metadata">

**Author:** ![nicdubovic](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nicdubovic/32/10381_2.png) [@nicdubovic](https://discourse.slicer.org/u/nicdubovic)\
**Post date:** [March 15, 2022, 4:59pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/5 "2022-03-15T16:59:10Z")

</div>

I mean segment editor tools (like “Draw”, “Scissors”, “Draw”)

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [March 15, 2022, 5:02pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/6 "2022-03-15T17:02:32Z")

</div>

Great, thanks. If we take a step back from the details, what are you trying to accomplish? If you had the identifiers you are looking for, what would you want to do with them?

---

<div class="post-metadata">

**Author:** ![nicdubovic](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nicdubovic/32/10381_2.png) [@nicdubovic](https://discourse.slicer.org/u/nicdubovic)\
**Post date:** [March 15, 2022, 5:08pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/7 "2022-03-15T17:08:46Z")

</div>

I want to log id’s slice after instrument click on scene in red / green / yellow planes  
If I move the slider, the current id of the viewed slice on which the tool draws will change.

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [March 15, 2022, 5:30pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/8 "2022-03-15T17:30:08Z")

</div>

OK, I think I am beginning to understand. You want to capture and log the image volume location where you click when using Segment Editor tools, is that correct?

I’m not sure whether there is an easy way to capture that information (the location of a click) while using Segment Editor effects, because I believe the Segment Editor effects capture the mouse click events and I’m not sure where you would intervene or get a signal from them to do your logging. @lassoan, @pieper, or @mau_igna_06, am I correct here? Is there an event @nicdubovic could respond to to achieve this logging while using Segment Editor effects?

When you are not in Segment Editor, an easy way to record locations (which you can then translate back into voxel array coordinates if desired) is through placing Markups control points.

You might find this discussion helpful: [How to capture right clicked](https://discourse.slicer.org/t/how-to-capture-right-clicked/16668)

---

<div class="post-metadata">

**Author:** ![nicdubovic](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nicdubovic/32/10381_2.png) [@nicdubovic](https://discourse.slicer.org/u/nicdubovic)\
**Post date:** [March 15, 2022, 5:42pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/9 "2022-03-15T17:42:29Z")

</div>

I want to capture and log the image volume location where you click when using Segment Editor tools.

Please take a look at the attached picture. This is the output of the Data Probe. At the bottom of the picture (B 107\_2 (217, 252, 180)), there are what looks like slice numbers displayed in different planes.  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/2/b229b99429d1fcaf8b1a2e6cdfe15977ebefeee7.png)

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [March 15, 2022, 5:49pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/10 "2022-03-15T17:49:00Z")

</div>

Here is another relevant discussion which you might find helpful: [Print dataprobe text with shift key](https://discourse.slicer.org/t/print-dataprobe-text-with-shift-key/21331)

---

<div class="post-metadata">

**Author:** ![nicdubovic](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nicdubovic/32/10381_2.png) [@nicdubovic](https://discourse.slicer.org/u/nicdubovic)\
**Post date:** [March 15, 2022, 5:56pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/11 "2022-03-15T17:56:24Z")

</div>

But I try do it using C++. I have static method of class which can log information

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [March 15, 2022, 5:56pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/12 "2022-03-15T17:56:41Z")

</div>

Generally the way effects manage events is internal to the effect so there’s not a good way to log exactly what the events correspond to, but you could probably detect that events are happening (clicks or keystrokes) in a way that doesn’t interfere with the effect and log those along with the info from the DataProbe module. You can also know what effect was active at the time of the event, so things like paint should be easy enough to figure out.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [March 15, 2022, 5:57pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/13 "2022-03-15T17:57:18Z")

</div>

> [@nicdubovic](#):
>
> But I try do it using C++

The code would be basically the same in C++

---

<div class="post-metadata">

**Author:** ![nicdubovic](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nicdubovic/32/10381_2.png) [@nicdubovic](https://discourse.slicer.org/u/nicdubovic)\
**Post date:** [March 15, 2022, 6:31pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/14 "2022-03-15T18:31:31Z")

</div>

Please tell me, is there a way to find out a slice ID (a string of characters which uniquely identifies one of the slice view areas, like the Red, Yellow, or Green slices)

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [March 15, 2022, 6:52pm UTC](https://discourse.slicer.org/t/how-can-get-id-slice/22521/15 "2022-03-15T18:52:46Z")

</div>

These scripts should help:

[https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html?highlight=sliceView#capture-slice-view-into-png-file-with-white-background](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html?highlight=sliceView#capture-slice-view-into-png-file-with-white-background)
