# Display and interact with a vtkMRMLAnnotationROINode() in the view

**URL:** <https://discourse.slicer.org/t/display-and-interact-with-a-vtkmrmlannotationroinode-in-the-view/17056>\
**Category:** Development\
**Created:** [April 13, 2021, 9:42am UTC](https://discourse.slicer.org/t/display-and-interact-with-a-vtkmrmlannotationroinode-in-the-view/17056 "2021-04-13T09:42:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ond12](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ond12/32/8706_2.png) [@ond12](https://discourse.slicer.org/u/ond12)\
**Post date:** [April 13, 2021, 9:42am UTC](https://discourse.slicer.org/t/display-and-interact-with-a-vtkmrmlannotationroinode-in-the-view/17056/1 "2021-04-13T09:42:44Z")

</div>

Hi Slicer Community,

I apologize in advance if the answer to my question is out there. I’ve seen related threads, but I haven’t manage to get my solution to work.

I’m using slicer 4.11  
I would like to create a vtkMRMLAnnotationROINode() and set it’s position size in the slice view as in the cropvolume module.

I’ve tried this script but the node it’s not showing in the 2D slice view but only in the 3D view

```
roi=slicer.vtkMRMLAnnotationROINode()
slicer.mrmlScene.AddNode(roi)
roi.Initialize(slicer.mrmlScene)
roi.SetDisplayVisibility(1)
roi.SetInteractiveMode(1)

```

If you have a solution please?

Thanks

---

<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:** [April 14, 2021, 4:54am UTC](https://discourse.slicer.org/t/display-and-interact-with-a-vtkmrmlannotationroinode-in-the-view/17056/2 "2021-04-14T04:54:07Z")

</div>

We are working on the Markups module to replace the old Annotation module. I would recommend to use Markups ROI. You can create it like this:

```python
roiNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLMarkupsROINode')
roiNode.SetCenter([20,30,40])
roiNode.SetSize([33,23,45])

```

---

<div class="post-metadata">

**Author:** ![ond12](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ond12/32/8706_2.png) [@ond12](https://discourse.slicer.org/u/ond12)\
**Post date:** [April 14, 2021, 7:23am UTC](https://discourse.slicer.org/t/display-and-interact-with-a-vtkmrmlannotationroinode-in-the-view/17056/3 "2021-04-14T07:23:00Z")

</div>

Thanks you, unfortunately i’m using 4.11 of Slicer it seems the ‘vtkMRMLMarkupsROINode’ was not fully implemented yet.

Also i manage to emulate the good behavior i wanted by a trick: (after my image is loaded )

```
  cropVolumeWidget = slicer.modules.cropvolume.widgetRepresentation()
  cropVolumeWidget.setMRMLScene(slicer.mrmlScene)
  cropVolumeWidget.enter()
  inp = cropVolumeWidget.findChild(slicer.qMRMLNodeComboBox,"InputROIComboBox")
  inp.addNode()

```

This create the Roi node and showing it.  
I would like to do the same but the good way. Do you have any idea how can i emulate the crop module by scripting : step 1 set a define input and output , step 2 create and edit by hand the roi node ?

Thanks
