# How to speed itk::RescaleIntensityImageFilter ?

**URL:** <https://discourse.itk.org/t/how-to-speed-itk-rescaleintensityimagefilter/3889>\
**Category:** Uncategorized\
**Created:** [February 22, 2021, 7:09am UTC](https://discourse.itk.org/t/how-to-speed-itk-rescaleintensityimagefilter/3889 "2021-02-22T07:09:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wulicheng](https://discourse.itk.org/user_avatar/discourse.itk.org/wulicheng/32/1390_2.png) [@wulicheng](https://discourse.itk.org/u/wulicheng)\
**Post date:** [February 22, 2021, 7:09am UTC](https://discourse.itk.org/t/how-to-speed-itk-rescaleintensityimagefilter/3889/1 "2021-02-22T07:09:15Z")

</div>

```auto
typedef signed short InputPixelType;
typedef unsigned char OutputPixelType;

typedef itk::Image<InputPixelType, 3> InputImageType;
typedef itk::Image<OutputPixelType, 3> OutputImageType;

using RescaleFilterType =
			itk::RescaleIntensityImageFilter<InputImageType, OutputImageType>;
		RescaleFilterType::Pointer rescaler = RescaleFilterType::New();
		rescaler->SetOutputMinimum(0);
		rescaler->SetOutputMaximum(255);
		rescaler->SetInput(filter->GetOutput());
		rescaler->Update();

```

when i convert the 3D data from signed short to unsigned char, it consume too much time and compute, how I can to speed it.?

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [February 24, 2021, 5:19pm UTC](https://discourse.itk.org/t/how-to-speed-itk-rescaleintensityimagefilter/3889/2 "2021-02-24T17:19:42Z")

</div>

If you don’t call `filter->Update();` explicitly, it is called during `rescaler->Update();`. This will cause the appearance of rescaler using a lot of time and memory. For slowness, make sure you are running in release mode, not debug.
