# Datatype error

**URL:** https://discourse.itk.org/t/datatype-error/3499
**Category:** Beginner Questions
**Created:** [October 1, 2020, 1:22pm UTC](https://discourse.itk.org/t/datatype-error/3499 "2020-10-01T13:22:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Romy\_Meester](https://discourse.itk.org/user_avatar/discourse.itk.org/romy_meester/32/1736_2.png) [@Romy\_Meester](https://discourse.itk.org/u/Romy_Meester)
#### Post date: [October 1, 2020, 1:22pm UTC](https://discourse.itk.org/t/datatype-error/3499/1 "2020-10-01T13:22:56Z")

</div>

Hello,

I try to implement several filters in SITK for 3D images, but I do get an error with the Anisotropic diffusion image filter. (The Gaussian, median and curvature flow are working 🙂 )

```
def calc_anisotropicdiff(img, iterations=5, step=0.125, conductance=3):
""" The Gradient Anisotropic diffusion image filter. """
blurFilter = sitk.GradientAnisotropicDiffusionImageFilter()
blurFilter.SetNumberOfIterations(iterations)
blurFilter.SetTimeStep(step)
blurFilter.SetConductanceParameter(conductance)
imgSmooth = blurFilter.Execute(img)
return imgSmooth

```

The error is:

```
RuntimeError: Exception thrown in SimpleITK GradientAnisotropicDiffusionImageFilter_Execute: d:\a\1\sitk\code\common\include\sitkMemberFunctionFactory.hxx:196:

```

sitk::ERROR: Pixel type: 8-bit unsigned integer is not supported in 3D byclass itk::simple::GradientAnisotropicDiffusionImageFilter

So I tried to change my pixeltypes from uint8 to sitk.sitkFloat64, but now my image is completely black (instead of grayscale image).

Is it possible to change the datatype from unit8 to float64?

---

<div class="post-metadata">

### Author: ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)
#### Post date: [October 1, 2020, 1:52pm UTC](https://discourse.itk.org/t/datatype-error/3499/2 "2020-10-01T13:52:10Z")

</div>

Hello @Romy_Meester,

Not sure how you are changing the pixel type, are you using the Cast filter:

```auto
img = sitk.ReadImage(file_name)
sitk.Show(img)
sitk.Show(sitk.Cast(img,sitk.sitkFloat64))

```

or you can force a type on read:

```auto
img = sitk.ReadImage(file_name, sitk.sitkFloat64)

```

Also, I noticed from [your other post](https://discourse.itk.org/t/wiener-deconvolution-image-filter/3498/2) that you are creating functions and using the object oriented interface inside of them. SimpleITK supports a procedural interface for most, if not all, filters. So you don’t need to do this. For example, the [WienerDeconvolutionImageFilter class](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1WienerDeconvolutionImageFilter.html) and the [WienerDeconvolutionImageFilter function](https://simpleitk.org/doxygen/latest/html/namespaceitk_1_1simple.html#a2904e5729f78134d2ab60f292a81b70a), the [GradientAnisotropicDiffusionImageFilter class](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1GradientAnisotropicDiffusionImageFilter.html) and the [GradientAnisotropicDiffusionImageFilter function](https://simpleitk.org/doxygen/latest/html/namespaceitk_1_1simple.html#a5f6899c622fba84d904ac97ebf69fdd0). The easiest way to find if there is a procedural interface for a class is to go to the class documentation page and search for the word “procedural”.

---

<div class="post-metadata">

### Author: ![Romy\_Meester](https://discourse.itk.org/user_avatar/discourse.itk.org/romy_meester/32/1736_2.png) [@Romy\_Meester](https://discourse.itk.org/u/Romy_Meester)
#### Post date: [October 1, 2020, 3:03pm UTC](https://discourse.itk.org/t/datatype-error/3499/3 "2020-10-01T15:03:38Z")

</div>

Yes,

```
sitk.Cast(img,sitk.sitkFloat64)

```

Solved the problem
