# How do I iterate through different MaskInputs on vtkGPUVolumeRayCastMapper

**URL:** https://discourse.vtk.org/t/how-do-i-iterate-through-different-maskinputs-on-vtkgpuvolumeraycastmapper/10643
**Category:** Support
**Tags:** code
**Created:** [February 8, 2023, 1:58pm UTC](https://discourse.vtk.org/t/how-do-i-iterate-through-different-maskinputs-on-vtkgpuvolumeraycastmapper/10643 "2023-02-08T13:58:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Oscar](https://discourse.vtk.org/user_avatar/discourse.vtk.org/oscar/32/1498_2.png) [@Oscar](https://discourse.vtk.org/u/Oscar)
#### Post date: [February 8, 2023, 1:58pm UTC](https://discourse.vtk.org/t/how-do-i-iterate-through-different-maskinputs-on-vtkgpuvolumeraycastmapper/10643/1 "2023-02-08T13:58:07Z")

</div>

I am trying to iterate through different masks using vtkGPUVolumeRayCastMapper-\>SetMaskInput() but its only working with the first iteration. The second time I call the function with a different maskImage does not produce any visual effect. I am calling Update() and Modified() but that doesnt seem to work.

```auto
		vtkGPUVolumeRayCastMapper::SafeDownCast(volumeMapper)->SetMaskInput(maskImage.GetPointer());
		vtkGPUVolumeRayCastMapper::SafeDownCast(volumeMapper)->SetMaskTypeToBinary();
		vtkGPUVolumeRayCastMapper::SafeDownCast(volumeMapper)->Update();
		vtkGPUVolumeRayCastMapper::SafeDownCast(volumeMapper)->Modified();

```
