# vtkvolumemapper help

**URL:** https://discourse.vtk.org/t/vtkvolumemapper-help/6486
**Category:** Support
**Created:** [August 27, 2021, 6:20pm UTC](https://discourse.vtk.org/t/vtkvolumemapper-help/6486 "2021-08-27T18:20:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Hanxin\_Hua](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hanxin_hua/32/3787_2.png) [@Hanxin\_Hua](https://discourse.vtk.org/u/Hanxin_Hua)
#### Post date: [August 27, 2021, 6:20pm UTC](https://discourse.vtk.org/t/vtkvolumemapper-help/6486/1 "2021-08-27T18:20:07Z")

</div>

Hi there, I have an issue with vtkvolumemapper.

```
void updateImage() {

vtkSmartVolumeMapper* mapper = nullptr;
int sampleRate = 1;

if (m_Volume) {
	mapper = vtkSmartVolumeMapper::SafeDownCast(m_Volume->GetMapper());
}
if (mapper) {
	double* bounds = m_ClippingBox->GetBounds();
	vtkSmartPointer<vtkImageData> volumeImageData = ImageUtilities::ComputeSubsampledImage(m_Image, sampleRate);

	// Part 1
	mapper->RemoveAllInputs();
	mapper->SetInputData(volumeImageData);
	mapper->SetCroppingRegionPlanes(bounds);
	mapper->SetCroppingRegionFlagsToSubVolume();
	mapper->CroppingOn();
	mapper->InteractiveAdjustSampleDistancesOff();
	mapper->Update();
	// end of part 1
	
	// Part 2
	vtkSmartPointer<vtkSmartVolumeMapper> volumeMapper = vtkSmartPointer<vtkSmartVolumeMapper>::New();
	volumeMapper->SetInputData(volumeImageData);
	volumeMapper->SetCroppingRegionPlanes(bounds);
	volumeMapper->SetCroppingRegionFlagsToSubVolume();
	volumeMapper->CroppingOn();
	volumeMapper->InteractiveAdjustSampleDistancesOff();

	m_Volume->SetMapper(volumeMapper);
	// end of part 2
}

}

```

So, here, m\_Volume is already hook up with the mapper. Part 1 is using the same mapper of the volume, but update the input data. Part 2 is creating a new mapper and reset it for the volume. And when I run the code, I only use one part and comment the other. The result is, part 2 works but part1 doesn’t.  
Am I missing anything here?  
Thank you!
