# I have the vtkResliceCursorWidget functions are not doing the same thing as before

**URL:** https://discourse.vtk.org/t/i-have-the-vtkreslicecursorwidget-functions-are-not-doing-the-same-thing-as-before/11433
**Category:** Web
**Created:** [May 11, 2023, 9:20am UTC](https://discourse.vtk.org/t/i-have-the-vtkreslicecursorwidget-functions-are-not-doing-the-same-thing-as-before/11433 "2023-05-11T09:20:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![stoune](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/eb8c5e/32.png) [@stoune](https://discourse.vtk.org/u/stoune)
#### Post date: [May 11, 2023, 9:20am UTC](https://discourse.vtk.org/t/i-have-the-vtkreslicecursorwidget-functions-are-not-doing-the-same-thing-as-before/11433/1 "2023-05-11T09:20:23Z")

</div>

In an inferior vtk.js version I used a function from widgetState ( **vtkResliceCursorWidget** ), to hide the sphere in the center I did that:

```auto
const widget = vtkResliceCursorWidget.newInstance();
const widgetState = widget.getWidgetState();

widgetState.setOpacity(1);
widgetState.setSphereRadius(10);
widgetState.setLineThickness(1);
widgetState.setShowCenter(false); // I do that to hide the sphere in the center

```

I was satisfied with the result, as I see the cursor change whenever I hover the mouse over the center even if the we set the showCenter to false, Like below (I have changed the icon of the cursor when we hover):  
 ![[video-to-gif output image]](https://discourse.vtk.org/uploads/default/original/2X/6/6d98539996c648f99253d2cd701422a9554679ab.gif)

Now I have upgraded vtk.js, I changed the functions above to do the same thing, now the equivelent is:

```auto
      widget = vtkResliceCursorWidget.newInstance();
      const widgetState = widget.getWidgetState();
      const t = 1;
      widgetState.getStatesWithLabel('line').forEach((handle) => handle.setScale3(t,t,t));
      widgetState.getStatesWithLabel('handles').forEach((handle) => handle.setOpacity(150));
      widgetState.getStatesWithLabel('rotation').forEach((handle) => handle.setScale1(10));
      widgetState.getCenterHandle().setVisible(false); // to hide the sphere in the center
      widgetState.getCenterHandle().setScale1(20);

```

**Now we don’t see the cursor change when we hover over the center (the showCenter is false) like below:**

![[video-to-gif output image]](https://discourse.vtk.org/uploads/default/original/2X/8/8a85bdfc053749f8f8bca65c97e5b54f681185bb.gif)

**NB** : When I set the `ShowCenter` to **true** I see the cursor hover change, I don’t want to see the center sphere

---

<div class="post-metadata">

### Author: ![finetjul](https://discourse.vtk.org/user_avatar/discourse.vtk.org/finetjul/32/154_2.png) [@finetjul](https://discourse.vtk.org/u/finetjul)
#### Post date: [May 12, 2023, 7:14am UTC](https://discourse.vtk.org/t/i-have-the-vtkreslicecursorwidget-functions-are-not-doing-the-same-thing-as-before/11433/2 "2023-05-12T07:14:43Z")

</div>

The `color3` mixin supports `opacity`. You can make the center handle visible but transparent:  
`widgetState.getCenterHandle().setColor3(1,1,1,0);` or barely translucent `widgetState.getCenterHandle().setColor3(1,1,1,0.01);` (to allow picking).

Please let us know if that fixes your problem/need.

---

<div class="post-metadata">

### Author: ![stoune](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/eb8c5e/32.png) [@stoune](https://discourse.vtk.org/u/stoune)
#### Post date: [May 23, 2023, 8:20am UTC](https://discourse.vtk.org/t/i-have-the-vtkreslicecursorwidget-functions-are-not-doing-the-same-thing-as-before/11433/3 "2023-05-23T08:20:05Z")

</div>

Thank you for your answer,

It seems that `widgetState.getCenterHandle().setColor3()` doesn’t accept more than **3 arguments** , so it doesn’t work with 4 arguments (I tested it)

---

<div class="post-metadata">

### Author: ![finetjul](https://discourse.vtk.org/user_avatar/discourse.vtk.org/finetjul/32/154_2.png) [@finetjul](https://discourse.vtk.org/u/finetjul)
#### Post date: [May 24, 2023, 10:01pm UTC](https://discourse.vtk.org/t/i-have-the-vtkreslicecursorwidget-functions-are-not-doing-the-same-thing-as-before/11433/4 "2023-05-24T22:01:48Z")

</div>

That would be `widgetState.getCenterHandle().setOpacity(0.01)`
