# CoodinateSystem mismatch when applying transform to mesh

**URL:** <https://discourse.slicer.org/t/coodinatesystem-mismatch-when-applying-transform-to-mesh/29117>\
**Category:** Support\
**Tags:** python\
**Created:** [April 25, 2023, 2:09pm UTC](https://discourse.slicer.org/t/coodinatesystem-mismatch-when-applying-transform-to-mesh/29117 "2023-04-25T14:09:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![suranga](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@suranga](https://discourse.slicer.org/u/suranga)\
**Post date:** [April 25, 2023, 2:09pm UTC](https://discourse.slicer.org/t/coodinatesystem-mismatch-when-applying-transform-to-mesh/29117/1 "2023-04-25T14:09:04Z")

</div>

Hi,

I have a trasform file and I want to apply this transform to a volumetric mesh which is in vtk unstructured grid format.

I first load the mesh in RAS format and then apply the transformation and save to the disk using following script.

```auto
ref_mesh_path = './MCR.vtk'
transform_file_path = "./LinearTransform_scan_1.h5"

[success, transform] = slicer.util.loadTransform(transform_file_path, returnNode=True)

ref_mesh = slicer.modules.models.logic().AddModel(ref_mesh_path, slicer.vtkMRMLStorageNode.CoordinateSystemRAS)
ref_mesh.SetAndObserveTransformNodeID(transform.GetID())
slicer.vtkSlicerTransformLogic().hardenTransform(ref_mesh)

slicer.util.saveNode(ref_mesh, './MCR_temp_scan_1.vtk')

```

However, when I compare the saved file with the original mesh coodiantes, I realised that the sign of the first two coordinates are inverted.

How can I save the transformed mesh without having this problem?

After applying the transformation, I believe all I need to do is switch to LPS and save the file again. How do I go about doing this?

I’d appreciate any code or assistance.
