# SimpleITK Euler3D transform, problem with output size/resampling

**URL:** <https://discourse.itk.org/t/simpleitk-euler3d-transform-problem-with-output-size-resampling/4387>\
**Category:** Beginner Questions\
**Tags:** simpleitk, python\
**Created:** [August 31, 2021, 7:46am UTC](https://discourse.itk.org/t/simpleitk-euler3d-transform-problem-with-output-size-resampling/4387 "2021-08-31T07:46:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [August 31, 2021, 3:21pm UTC](https://discourse.itk.org/t/simpleitk-euler3d-transform-problem-with-output-size-resampling/4387/2 "2021-08-31T15:21:23Z")

</div>

> [@MMdeB](#):
>
> `output_direction = image.GetDirection()`

You need to apply the transform to the direction, see [this](https://github.com/InsightSoftwareConsortium/ITK/blob/f87c9bdaee8ef0a794847929fbf255c8db0b6299/Modules/Core/Transform/include/itkTransform.hxx#L494-L515).

You are doing resampling twice, first to apply the transform, then to make the image isotropic. This leads to loss of quality. It is better to compound the transform, and do the resampling once. It will have higher quality and it is computationally faster too.

Lastly, you don’t need to write the code to apply the transform to the image yourself. `ResampleInPlaceImageFilter` is already available in `master`, an example to invoke it from Python is [here](https://github.com/InsightSoftwareConsortium/ITK/issues/2703). It should replace all of your custom processing code in updated version of `rotation3d`.

---

_[View the full topic](https://discourse.itk.org/t/simpleitk-euler3d-transform-problem-with-output-size-resampling/4387)._
