# Set identity transform on vtkOrientedGridTransform

**URL:** <https://discourse.slicer.org/t/set-identity-transform-on-vtkorientedgridtransform/16012>\
**Category:** Development\
**Tags:** transforms\
**Created:** [February 16, 2021, 3:55pm UTC](https://discourse.slicer.org/t/set-identity-transform-on-vtkorientedgridtransform/16012 "2021-02-16T15:55:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![riep](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/riep/32/9933_2.png) [@riep](https://discourse.slicer.org/u/riep)\
**Post date:** [February 16, 2021, 3:55pm UTC](https://discourse.slicer.org/t/set-identity-transform-on-vtkorientedgridtransform/16012/1 "2021-02-16T15:55:05Z")

</div>

Hi everyone,  
I would like to know if there was a direct API to reset a vtkOrientedGridTransform to identity.  
Is there any workaround to do it?  
If not I was planning to set zeros in the displacement fields manually.

Thanks in advance for any feedback!  
Cheers,  
Pierre

---

<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:** [February 16, 2021, 4:09pm UTC](https://discourse.slicer.org/t/set-identity-transform-on-vtkorientedgridtransform/16012/2 "2021-02-16T16:09:20Z")

</div>

Yes, you can set displacements to 0 in the coefficient image as it is done in [Documentation/Nightly/ScriptRepository - Slicer Wiki](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Create_a_new_volume) by calling:

```
imageData.GetPointData().GetScalars().Fill(0)
```

---

<div class="post-metadata">

**Author:** ![riep](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/riep/32/9933_2.png) [@riep](https://discourse.slicer.org/u/riep)\
**Post date:** [February 16, 2021, 4:27pm UTC](https://discourse.slicer.org/t/set-identity-transform-on-vtkorientedgridtransform/16012/3 "2021-02-16T16:27:40Z")

</div>

Sorry I try and let you know

---

<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:** [February 16, 2021, 4:56pm UTC](https://discourse.slicer.org/t/set-identity-transform-on-vtkorientedgridtransform/16012/4 "2021-02-16T16:56:27Z")

</div>

Since displacement field has 3 components, maybe you need to use `FillComponent(component, 0)` for component 0, 1, 2 (instead of just `Fill(0)`).

---

<div class="post-metadata">

**Author:** ![riep](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/riep/32/9933_2.png) [@riep](https://discourse.slicer.org/u/riep)\
**Post date:** [February 17, 2021, 7:45am UTC](https://discourse.slicer.org/t/set-identity-transform-on-vtkorientedgridtransform/16012/5 "2021-02-17T07:45:29Z")

</div>

Your solution was correct and did the job.

> transform.GetTransformToParent().GetDisplacementGrid().GetPointData().GetScalars().Fill(0)

thanks
