# Hdf5 to NRRD to SEQ.NRRD

**URL:** <https://discourse.slicer.org/t/hdf5-to-nrrd-to-seq-nrrd/18277>\
**Category:** Support\
**Tags:** nrrd\
**Created:** [June 22, 2021, 6:13pm UTC](https://discourse.slicer.org/t/hdf5-to-nrrd-to-seq-nrrd/18277 "2021-06-22T18:13:28Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [June 25, 2021, 10:23pm UTC](https://discourse.slicer.org/t/hdf5-to-nrrd-to-seq-nrrd/18277/4 "2021-06-25T22:23:02Z")

</div>

You can write a valid seq.nrrd file from an `img` numpy array of size `(26, 102, 102, 61)` (corresponds to number of volumes, colums, rows, slices):

```python
import nrrd
header = {
    'type': 'int',
    'dimension': 4,
    'space': 'right-anterior-superior',
    'space directions': [[float('nan'), float('nan'), float('nan')], [1.953125, 0. , 0.], [0. , 1.953125, 0.], [0. , 0. , 1.953125]],
    'kinds': ['list', 'domain', 'domain', 'domain'],
    'labels': ['frame', '', '', ''], 
    'endian': 'little',
    'encoding': 'raw',
    'space origin': [-137.16099548, -36.80649948, -309.71899414],
    'measurement frame': [[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]],
    'axis 0 index type': 'numeric',
    'axis 0 index values': '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25'
}
nrrd.write("c:/tmp/test.seq.nrrd", img, header)

```

---

_[View the full topic](https://discourse.slicer.org/t/hdf5-to-nrrd-to-seq-nrrd/18277)._
