# Image types for ImageFileWriter - only itk.UC?

**URL:** <https://discourse.itk.org/t/image-types-for-imagefilewriter-only-itk-uc/1108>\
**Category:** Community\
**Tags:** python\
**Created:** [July 10, 2018, 6:37pm UTC](https://discourse.itk.org/t/image-types-for-imagefilewriter-only-itk-uc/1108 "2018-07-10T18:37:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fedorov](https://discourse.itk.org/user_avatar/discourse.itk.org/fedorov/32/207_2.png) [@fedorov](https://discourse.itk.org/u/fedorov)\
**Post date:** [July 10, 2018, 6:37pm UTC](https://discourse.itk.org/t/image-types-for-imagefilewriter-only-itk-uc/1108/1 "2018-07-10T18:37:04Z")

</div>

It seems that `ImageFileWriter` from `itk-python` is only available for `itk.UC`. Is this right?

This means I can’t even write out a typical CT volume!

```auto
KeyError: 'itkTemplate : No template (<itkCType unsigned int>, 3) for the itk::Image class'

```

---

<div class="post-metadata">

**Author:** ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)\
**Post date:** [July 13, 2018, 3:22pm UTC](https://discourse.itk.org/t/image-types-for-imagefilewriter-only-itk-uc/1108/2 "2018-07-13T15:22:26Z")

</div>

Hi @fedorov,

The `ImageFileWriter` is wrapped for multiple types – we can find out what types with the `.GetTypes()` method:

```auto
In [1]: import itk

In [2]: itk.ImageFileWriter.GetTypes()
<itkTemplate itk::ImageFileWriter>
Options:
  [<class 'itkImagePython.itkImageCF2'>,]
  [<class 'itkImagePython.itkImageCF3'>,]
  [<class 'itkImagePython.itkImageCVF22'>,]
  [<class 'itkImagePython.itkImageCVF23'>,]
  [<class 'itkImagePython.itkImageCVF32'>,]
  [<class 'itkImagePython.itkImageCVF33'>,]
  [<class 'itkImagePython.itkImageCVF42'>,]
  [<class 'itkImagePython.itkImageCVF43'>,]
  [<class 'itkImagePython.itkImageF2'>,]
  [<class 'itkImagePython.itkImageF3'>,]
  [<class 'itkImagePython.itkImageRGBAUC2'>,]
  [<class 'itkImagePython.itkImageRGBAUC3'>,]
  [<class 'itkImagePython.itkImageRGBUC2'>,]
  [<class 'itkImagePython.itkImageRGBUC3'>,]
  [<class 'itkImagePython.itkImageSS2'>,]
  [<class 'itkImagePython.itkImageSS3'>,]
  [<class 'itkImagePython.itkImageUC2'>,]
  [<class 'itkImagePython.itkImageUC3'>,]
  [<class 'itkImagePython.itkImageUS2'>,]
  [<class 'itkImagePython.itkImageUS3'>,]
  [<class 'itkImagePython.itkImageVF22'>,]
  [<class 'itkImagePython.itkImageVF23'>,]
  [<class 'itkImagePython.itkImageVF32'>,]
  [<class 'itkImagePython.itkImageVF33'>,]
  [<class 'itkImagePython.itkImageVF42'>,]
  [<class 'itkImagePython.itkImageVF43'>,]
  [<class 'itkVectorImagePython.itkVectorImageF2'>,]
  [<class 'itkVectorImagePython.itkVectorImageF3'>,]
  [<class 'itkVectorImagePython.itkVectorImageSS2'>,]
  [<class 'itkVectorImagePython.itkVectorImageSS3'>,]
  [<class 'itkVectorImagePython.itkVectorImageUC2'>,]
  [<class 'itkVectorImagePython.itkVectorImageUC3'>,]
  [<class 'itkVectorImagePython.itkVectorImageUS2'>,]
  [<class 'itkVectorImagePython.itkVectorImageUS3'>,]

In [3]:

```

So, there is support for 3D _signed short_, which should be common for CT volumes. There is not support for _unsigned int_. Generally, we wrap just 64-bit integer pixel types to keep the package size down, instead of 32-bit integer pixel types. We could add _unsigned long long_ wrapping for `ImageFileWriter`. Would this address your use case?

Thanks,  
Matt

---

<div class="post-metadata">

**Author:** ![fedorov](https://discourse.itk.org/user_avatar/discourse.itk.org/fedorov/32/207_2.png) [@fedorov](https://discourse.itk.org/u/fedorov)\
**Post date:** [July 16, 2018, 5:14pm UTC](https://discourse.itk.org/t/image-types-for-imagefilewriter-only-itk-uc/1108/3 "2018-07-16T17:14:27Z")

</div>

Matt, thank you for the explanation. Somehow I missed `signed short`. This should be sufficient, I don’t think any changes are needed, at least not for me!
