# affine transform followed by translation understanding

**URL:** https://discourse.itk.org/t/affine-transform-followed-by-translation-understanding/3643
**Category:** Algorithms
**Tags:** python, simpleitk
**Created:** [November 21, 2020, 11:47am UTC](https://discourse.itk.org/t/affine-transform-followed-by-translation-understanding/3643 "2020-11-21T11:47:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![prms](https://discourse.itk.org/user_avatar/discourse.itk.org/prms/32/1526_2.png) [@prms](https://discourse.itk.org/u/prms)
#### Post date: [November 21, 2020, 11:47am UTC](https://discourse.itk.org/t/affine-transform-followed-by-translation-understanding/3643/1 "2020-11-21T11:47:51Z")

</div>

I’ve been trying affine transform with translation. There are a few things I noticed while using them. It might be due to my limited understanding of the subject matter. Any help is highly appreciated. The notebook with the required transformations is [here](https://github.com/prameshgautam/2d_transforms/blob/master/shear_followed_by_translate.ipynb).

Following transformations have been done:

1. Affine transform and translation
2. Only affine transform
3. Translation of output of step 2

The output of step 1 and 3 are the same although the parameters are different:  
Affine parameters used in step 1 are `(1.0956889234034184, -0.3093362626712529, -0.309336262671253, 1.0)` and translation parameters are `(-59.62704975761403, -211.33296716609343)`.

Same affine parameters have been used in step 2.

In step 3, the resampled image from step 2 is translated using the parameters `(-125.0, -250.0)`. I’m not able to understand why the results are same. According to my understanding, translation using `(-125.0, -250.0)` in step 1 should be same as step 3, but this is not the case. I hope someone can help me on this.

---

<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: [November 23, 2020, 1:08am UTC](https://discourse.itk.org/t/affine-transform-followed-by-translation-understanding/3643/2 "2020-11-23T01:08:34Z")

</div>

Hello @prms,

The issue you are seeing is because what you are doing is not a composition of two transformations. You are resampling with one transformation and then resampling again. When you resample the first time you are transforming the original set of points with a shear, then to get the same translational effect you need to translate by `shear_transform.TransformPoint(translation1)` .
