# NIFTI Problem with Reformatted Segmentations

**URL:** <https://discourse.slicer.org/t/nifti-problem-with-reformatted-segmentations/16035>\
**Category:** Support\
**Created:** [February 17, 2021, 5:11pm UTC](https://discourse.slicer.org/t/nifti-problem-with-reformatted-segmentations/16035 "2021-02-17T17:11:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![e25](https://avatars.discourse-cdn.com/v4/letter/e/f0a364/32.png) [@e25](https://discourse.slicer.org/u/e25)\
**Post date:** [February 17, 2021, 5:11pm UTC](https://discourse.slicer.org/t/nifti-problem-with-reformatted-segmentations/16035/1 "2021-02-17T17:11:54Z")

</div>

I am reformatting segmentations, and I am able to save them without issue as an NRRD fiel. However, when I attempt to save them as a NIFTI file (the utilized form for our research group) and reload the file, they are a few slices off. This is not the situation when reloading the same file saved in an NRRD format . Does anyone have any suggestions on why there may be this issue with the NIFTI file format and how to address it?

---

<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 17, 2021, 5:16pm UTC](https://discourse.slicer.org/t/nifti-problem-with-reformatted-segmentations/16035/2 "2021-02-17T17:16:45Z")

</div>

How did you reformat the segmentation? Can you share an example images in nrrd and nifti format?

Nifti has many issues. One of them is that image axes must be always converted to be orthogonal, which cause slight changes in the image geometry if your image axes were not exactly orthogonal. Unless you work with brain images, I would suggest not to use nifti, but use nrrd instead.

---

<div class="post-metadata">

**Author:** ![e25](https://avatars.discourse-cdn.com/v4/letter/e/f0a364/32.png) [@e25](https://discourse.slicer.org/u/e25)\
**Post date:** [February 17, 2021, 9:40pm UTC](https://discourse.slicer.org/t/nifti-problem-with-reformatted-segmentations/16035/3 "2021-02-17T21:40:03Z")

</div>

Thank you for the reply. This is what the same segmentation looks like when saved and reuploaded as the Nfiti file vs the NRRD file in the same position. With the Nifti file, it appears off by a few slides, and there seem to be gaps. How do you convert it to be orthogonal?

 ![Screen Shot 2021-02-17 at 4.38.22 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/f/7f9e321009bc205d93f2aa75b9058defaabc9e74.jpeg) ![Screen Shot 2021-02-17 at 4.38.48 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/8/6885c2fc7ab17779a3b54da78448b64f36694028.jpeg)

---

<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 17, 2021, 11:38pm UTC](https://discourse.slicer.org/t/nifti-problem-with-reformatted-segmentations/16035/4 "2021-02-17T23:38:34Z")

</div>

How did you reformat the segmentation?

If you did it by applying a matrix that has non-orthogonal axes then make sure the top-left 3x3 submatrix of the transformation matrix is orthogonal.

---

<div class="post-metadata">

**Author:** ![e25](https://avatars.discourse-cdn.com/v4/letter/e/f0a364/32.png) [@e25](https://discourse.slicer.org/u/e25)\
**Post date:** [February 18, 2021, 10:54pm UTC](https://discourse.slicer.org/t/nifti-problem-with-reformatted-segmentations/16035/5 "2021-02-18T22:54:05Z")

</div>

Slicer was used to reformat the segmentation and output the segmentations as NIFTIs. Can you clarify what you mean by non-orthogonal axes?

---

<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 18, 2021, 11:56pm UTC](https://discourse.slicer.org/t/nifti-problem-with-reformatted-segmentations/16035/6 "2021-02-18T23:56:41Z")

</div>

Where did you get the reference image from? Head CTs are often acquired with tilted gantry, which cannot be stored in a nifti image.

Can you share the segmentation in .seg.nrrd format (upload somewhere and post the link here)? If you can also share the complete scene (saved as .mrb) then it is even better.

> [@e25](#):
>
> Can you clarify what you mean by non-orthogonal axes?

Column vectors of the orientation matrix are orthogonal to each other (their dot product is zero).
