# What does this second part of the code mean? Python

**URL:** <https://discourse.slicer.org/t/what-does-this-second-part-of-the-code-mean-python/14878>\
**Category:** Support\
**Created:** [December 4, 2020, 5:35am UTC](https://discourse.slicer.org/t/what-does-this-second-part-of-the-code-mean-python/14878 "2020-12-04T05:35:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoobForSlicer](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/noobforslicer/32/10900_2.png) [@NoobForSlicer](https://discourse.slicer.org/u/NoobForSlicer)\
**Post date:** [December 4, 2020, 5:35am UTC](https://discourse.slicer.org/t/what-does-this-second-part-of-the-code-mean-python/14878/1 "2020-12-04T05:35:51Z")

</div>

# Change spacing

```
    logging.info("change spacing")
    start = time.time()
    ijkToRas = vtk.vtkMatrix4x4()
    imagenode.GetIJKToRASMatrix(ijkToRas)
    for i in range(3):
        ijkToRas.SetElement(i, i, spacing[i])
    imagenode.SetIJKToRASMatrix(ijkToRas)
    end = time.time()
    logging.info(f"change spacing in {human_time(end-start)}")
    slicer.app.processEvents()

```

This part " ijkToRas.SetElement(i, i, spacing[i])"?

---

<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:** [December 4, 2020, 4:33pm UTC](https://discourse.slicer.org/t/what-does-this-second-part-of-the-code-mean-python/14878/2 "2020-12-04T16:33:17Z")

</div>

IJK to RAS transform is the mapping from voxel coordinate system (IJK) to physical space (RAS). If IJKtoRAS is a diagonal matrix then the first 3 values in the diagonal specifies the image spacing (voxel size).
