# Transforming .json markups file

**URL:** <https://discourse.slicer.org/t/transforming-json-markups-file/30610>\
**Category:** Support\
**Created:** [July 14, 2023, 2:53pm UTC](https://discourse.slicer.org/t/transforming-json-markups-file/30610 "2023-07-14T14:53:35Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sophrobs](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@Sophrobs](https://discourse.slicer.org/u/Sophrobs)\
**Post date:** [July 14, 2023, 2:53pm UTC](https://discourse.slicer.org/t/transforming-json-markups-file/30610/1 "2023-07-14T14:53:35Z")

</div>

Operating system: MacOS Ventura 13.4.1  
Slicer version: 5.2.2  
Expected behavior: Save .json file with transform applied  
Actual behavior: Transform is not applied and markups are in the same position as the original file

I’m applying a transform in the ‘transforms’ module. Visually I can see that the markups move to the correct position. However, when I go to save or export the transformed file, the markups do not save in this transformed position. When I try to harden the transform it simply moves the markups back to the original spot.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 14, 2023, 5:40pm UTC](https://discourse.slicer.org/t/transforming-json-markups-file/30610/2 "2023-07-14T17:40:17Z")

</div>

Two options to export markups with transformed coordinates:

- Option A: harden the transform on the markup (maybe you did not press the `harden` button but the green arrow button instead)
- Option B: when you export the markup (by right-clicking on it in Data module) check the `Apply transforms` checkbox

---

<div class="post-metadata">

**Author:** ![Sophrobs](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@Sophrobs](https://discourse.slicer.org/u/Sophrobs)\
**Post date:** [July 16, 2023, 3:15am UTC](https://discourse.slicer.org/t/transforming-json-markups-file/30610/3 "2023-07-16T03:15:45Z")

</div>

Thank you for the prompt response Andras. I have tried both of your options but neither of them appear to work for me.  
Option A - when I click on the harden transform, the markups file moves from the ‘transformed’ section back into the ‘transformable’ section, as if I had clicked on the green arrow button.  
Option B - when I export the markup and select the apply transforms box it still saves in the original position…  
Can I provide you with any further information to help solve this issue?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 16, 2023, 12:12pm UTC](https://discourse.slicer.org/t/transforming-json-markups-file/30610/4 "2023-07-16T12:12:41Z")

</div>

Please try with the latest Slicer Preview Release as well. If the behavior is still the same then share the scene (saved as a single .mrb file) so that we can investigate.

---

<div class="post-metadata">

**Author:** ![Sophrobs](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@Sophrobs](https://discourse.slicer.org/u/Sophrobs)\
**Post date:** [July 16, 2023, 11:10pm UTC](https://discourse.slicer.org/t/transforming-json-markups-file/30610/5 "2023-07-16T23:10:56Z")

</div>

Just tried the latest Slicer Preview Release and the behaviour is still the same.  
I can’t seem to attach the mrb file - what is the best way to send this to you?  
Once the matrix is applied, the markups should move closer to the model in the scene.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [July 17, 2023, 10:34am UTC](https://discourse.slicer.org/t/transforming-json-markups-file/30610/6 "2023-07-17T10:34:52Z")

</div>

> Blockquote

Not sure I understand this. If the points are under the transform and you hard it, you should see no displacement. They are already at the places that they are supposed to be and you are simply making this permanent by hardening the transform.

If you want to see the effect of the transform, take the points out of transform (which will bring them to their original positions they were created under) and the put them back in.

---

<div class="post-metadata">

**Author:** ![Sophrobs](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@Sophrobs](https://discourse.slicer.org/u/Sophrobs)\
**Post date:** [July 17, 2023, 1:57pm UTC](https://discourse.slicer.org/t/transforming-json-markups-file/30610/7 "2023-07-17T13:57:50Z")

</div>

Yes the transform function works correctly, but it seems I cannot harden the transform.  
When I try to harden the transform it does not work.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [July 17, 2023, 4:37pm UTC](https://discourse.slicer.org/t/transforming-json-markups-file/30610/8 "2023-07-17T16:37:18Z")

</div>

Sorry can’t replicate this on the preview on MacOS. See the screenshot, I created two points (red), cloned them (green), put the cloned ones under a transform that moved them some random place and then I hardened the transform. As you can see the points end it up in the modified spots. If the hardening didn’t work, they would have gone back on top of the red points.

So my guess you are either missing a step, or you have somewhat different expectation of what hardening does.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/9/5949d169ae9088c1ad98f4ea01bb6a079299cbf8.png)

---

<div class="post-metadata">

**Author:** ![Sophrobs](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@Sophrobs](https://discourse.slicer.org/u/Sophrobs)\
**Post date:** [July 19, 2023, 1:01pm UTC](https://discourse.slicer.org/t/transforming-json-markups-file/30610/9 "2023-07-19T13:01:40Z")

</div>

Thank you for your assistance.  
I have found a solution using the ‘split’ function on the transforms module.  
My .tfm file would apply the transform to the markups so that I could visualise the markups in the transformed orientation, but not export the .json file with the coordinates.  
After selecting the ‘split’ function and applying a single component of the transform (h5 file), the markups could be transformed, hardened and exported.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 19, 2023, 3:56pm UTC](https://discourse.slicer.org/t/transforming-json-markups-file/30610/10 "2023-07-19T15:56:10Z")

</div>

It seems that something is wrong with the transform. Could you please share at least your transform file (but preferable the whole scene, saved as a single .mrb file)?
