# Morita .Vol import and nhdr conversion - slices out of order

**URL:** <https://discourse.slicer.org/t/morita-vol-import-and-nhdr-conversion-slices-out-of-order/42975>\
**Category:** Support\
**Created:** [May 17, 2025, 2:09am UTC](https://discourse.slicer.org/t/morita-vol-import-and-nhdr-conversion-slices-out-of-order/42975 "2025-05-17T02:09:27Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Alexander\_Shiryaev](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alexander_shiryaev/32/81512_2.png) [@Alexander\_Shiryaev](https://discourse.slicer.org/u/Alexander_Shiryaev)\
**Post date:** [December 2, 2025, 8:29pm UTC](https://discourse.slicer.org/t/morita-vol-import-and-nhdr-conversion-slices-out-of-order/42975/5 "2025-12-02T20:29:33Z")

</div>

@ChrisMak, see [here](https://discourse.slicer.org/t/load-vol-file-into-3d-slicer-from-morita-machine/4815/15).

It’s possible the “byte skip” parameter is incorrect.

Also, I can see your data rotated 45° around vertical (I→S) axis.

```xml
<tfAntiAliasAngleInDegree value="45"/>

```

You can use the following Python script to apply transform to align axes:

```py
import numpy as np
from scipy.ndimage import rotate

import read_vol import load_data

path_input = "CT_0.vol"
path_output = "CT_0_rotated.raw"

def main () -> None:
    d = load_data(path_input)

    print("shape before rotation:", d.shape, d.dtype)

    # rotate around last axis (2), relative to center
    d_rot = rotate(d, angle=45, axes=(0, 1), reshape=False, order=1, cval=-32768)
    # flip very first (0) axis
    d_rot = d_rot[::-1, :, :]

    print("shape after rotation:", d_rot.shape)

    with open(path_output, "wb") as f:
        f.write(d_rot.tobytes())

if __name__ == ' __main__':
    main()

```

Then use the following `CT_0_rotated.nhdr` file:

```auto
NRRD0004
# Complete NRRD file format specification at:
# http://teem.sourceforge.net/nrrd/format.html
type: signed short
dimension: 3
space: left-posterior-superior
sizes: Z Y X
space directions: (0,0,S) (0,S,0) (S,0,0)
kinds: domain domain domain
endian: little
encoding: raw
space origin: (0,0,0)
byte skip: 0
data file: CT_0_rotated.raw

```

Fill `X`, `Y` and `Z` values from “shape after rotation” script output, `S` is voxel size.  
In your case:

- `X` = `Y` = 240 - (-240) + 1 = 481, `Z` = 241 - (-242) + 1 = 484
- `S` = 0.125

---

_[View the full topic](https://discourse.slicer.org/t/morita-vol-import-and-nhdr-conversion-slices-out-of-order/42975)._
