# Hide node and refresh view

**URL:** <https://discourse.slicer.org/t/hide-node-and-refresh-view/37168>\
**Category:** Development\
**Created:** [July 3, 2024, 9:18am UTC](https://discourse.slicer.org/t/hide-node-and-refresh-view/37168 "2024-07-03T09:18:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fqzhice](https://avatars.discourse-cdn.com/v4/letter/f/7bcc69/32.png) [@fqzhice](https://discourse.slicer.org/u/fqzhice)\
**Post date:** [July 3, 2024, 9:18am UTC](https://discourse.slicer.org/t/hide-node-and-refresh-view/37168/1 "2024-07-03T09:18:52Z")

</div>

Hi，

I just loaded segment file nii.gz by API slicer.util.loadSegmentation, then

i want to hide this node named “post\_result”

```auto
auto vesselNode = vtkMRMLSegmentationNode::SafeDownCast(
    d->scene->GetFirstNodeByName("post_result")); //post_result
if (vesselNode == nullptr)
    return;
vesselNode->SetDisplayVisibility(false);
qSlicerLayoutManager* layoutManager = qSlicerApplication::application()->layoutManager();
if (layoutManager == nullptr)
    return;
for (auto viewName : layoutManager->sliceViewNames())
{
    layoutManager->sliceWidget(viewName)->sliceView()->forceRender();
}

```

the segmentation mask is still displayed on slicer view.  
But in “Data” Model, i can hide by click "eye"icon  
How can i solve it ?  
Thanks for help

---

<div class="post-metadata">

**Author:** ![fqzhice](https://avatars.discourse-cdn.com/v4/letter/f/7bcc69/32.png) [@fqzhice](https://discourse.slicer.org/u/fqzhice)\
**Post date:** [July 4, 2024, 10:33am UTC](https://discourse.slicer.org/t/hide-node-and-refresh-view/37168/2 "2024-07-04T10:33:48Z")

</div>

Fixed!

> [@Segmentation visibility by code](https://discourse.slicer.org/t/segmentation-visibility-by-code/13826/3):
>
> hi this works to hide all segmentation: disp=slicer.util.getNode('Segmentation') disp.SetDisplayVisibility(False) but I can’t make it show only Left-Cerebral-Cortex . try this: slicer.vtkMRMLSegmentationDisplayNode('Segmentation').SetAllSegmentsVisibility(False) but I have the following error: ValueError: could not extract hexadecimal address from argument string
