# Export single MPR slice to DICOM

**URL:** <https://discourse.slicer.org/t/export-single-mpr-slice-to-dicom/22853>\
**Category:** Support\
**Tags:** dicom\
**Created:** [April 6, 2022, 9:54pm UTC](https://discourse.slicer.org/t/export-single-mpr-slice-to-dicom/22853 "2022-04-06T21:54:29Z")\
**Posts on this page:** 1\
**Showing post:** 14

<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:** [April 8, 2022, 10:40pm UTC](https://discourse.slicer.org/t/export-single-mpr-slice-to-dicom/22853/14 "2022-04-08T22:40:39Z")

</div>

This comment is too long and complicated and so most people will not understand what you mean. Instead, you could change the loop to:

```python
for row in range(4):
            for col in [0, 1]: # invert second axis
                roiTransformMatrix.SetElement(row, col, -1 * roiTransformMatrix.GetElement(row,col))

```

(If this leads to undesired flip then use `[1, 2]`.)

But even better, if you want simpler, safer code, then you can apply a rotation to the sliceToRas transform (you can replace `RotateX` by `RotateY` or `RotateZ` if you want to rotate along a different axis):

```python
roiTransform = vtk.vtkTransform()
roiTransform.Concatenate(sliceTransformMatrix)
roiTransform.RotateX(180)
roi.SetAndObserveObjectToNodeMatrix(roiTransform.GetMatrix())

```

As a general rule: in medical imaging the “F word” (flip) is taboo. Always rotate instead, except the very special cases when you actually need to mirror one side of the patient to the other (e.g., correct deformity by mirroring healthy side of the patient to the diseased side).

---

_[View the full topic](https://discourse.slicer.org/t/export-single-mpr-slice-to-dicom/22853)._
