# itksnap txt file saved after manual registration

**URL:** <https://discourse.itk.org/t/itksnap-txt-file-saved-after-manual-registration/5983>\
**Category:** Uncategorized\
**Created:** [June 7, 2023, 8:36am UTC](https://discourse.itk.org/t/itksnap-txt-file-saved-after-manual-registration/5983 "2023-06-07T08:36:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ljjiayou](https://discourse.itk.org/user_avatar/discourse.itk.org/ljjiayou/32/3211_2.png) [@ljjiayou](https://discourse.itk.org/u/ljjiayou)\
**Post date:** [June 7, 2023, 8:36am UTC](https://discourse.itk.org/t/itksnap-txt-file-saved-after-manual-registration/5983/1 "2023-06-07T08:36:30Z")

</div>

This is the txt file that I saved after manually registering itksnap：  
#Insight Transform File V1.0  
#Transform 0  
Transform: MatrixOffsetTransformBase\_double\_3\_3  
Parameters: 0.9999932831934126 -0.00005697241326605847 -0.003664740400452174 0.0000153526386869449 0.999935520256914 -0.011355839591630987 0.0036651510685188405 0.011355707053217666 0.9999288047581026 50.82752907152394 -19.93882591957195 -20.086759849693525  
FixedParameters: 0 0 0

I just rotated and translated the image. What is the information in the Txt file and how can I use it to convert the image to get a new image?

---

<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:** [June 7, 2023, 1:20pm UTC](https://discourse.itk.org/t/itksnap-txt-file-saved-after-manual-registration/5983/2 "2023-06-07T13:20:24Z")

</div>

Hello @ljjiayou,

This is a 3D affine transformation (even if you just did a rigid alignment).

Code for resampling the moving image onto the fixed image grid using SimpleITK below (ITK code would look very similar):

```auto
import SimpleITK as sitk

fixed_image_file_name = 
moving_image_file_name =
resampled_moving_image_file_name = 
transform_file_name = 

fixed_image = sitk.ReadImage(fixed_image_file_name)
moving_image = sitk.ReadImage(moving_image_file_name)
tx = sitk.ReadTransform(transform_file_name)

resampled_moving_image = sitk.Resample(moving_image, fixed_image, tx)
sitk.WriteImage(resampled_moving_image, resampled_moving_image_file_name)

```

---

<div class="post-metadata">

**Author:** ![ljjiayou](https://discourse.itk.org/user_avatar/discourse.itk.org/ljjiayou/32/3211_2.png) [@ljjiayou](https://discourse.itk.org/u/ljjiayou)\
**Post date:** [June 8, 2023, 2:52am UTC](https://discourse.itk.org/t/itksnap-txt-file-saved-after-manual-registration/5983/3 "2023-06-08T02:52:52Z")

</div>

Thank you very much. I have one more question for you. After I have calculated the rigid transformation parameters (rotation and shift) between the two images using the marked key pairs, I want to use sitk.Euler3DTransform() to transform the image. But I’m not sure about the ‘center’ parameter in Euler3DTransform(). Does the ‘center’ parameter usually use the center of the image or is there some other rule? I hope you can help me.

---

<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:** [June 8, 2023, 2:00pm UTC](https://discourse.itk.org/t/itksnap-txt-file-saved-after-manual-registration/5983/4 "2023-06-08T14:00:37Z")

</div>

Hello @ljjiayou,

I don’t think you need to modify anything, likely you can ignore the usage of the center point as it is taken care of by the algorithm you used.

Having said that, based on your description and without seeing code, you are using paired point registration (`LandmarkBasedTransformInitializer`)? Something along the lines of the “manual initialization” section in [this notebook](https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Python/63_Registration_Initialization.ipynb).

If yes, the center of rotation may vary based on what is used in the algorithm. If the point coordinates are with respect to the coordinate system origin (0,0,0) then that is the rotation center. If not, then often it is the center of the image and the coordinates are modified relative to it before the computation.

For more details about ITK/SimpleITK transforms and the usage of a center point see [this notebook](https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Python/22_Transforms.ipynb), likely the relevant section is **Modify transform center without changing the transformation effect**.
