# Read NRRD detached headers that omit blank line

**URL:** <https://discourse.slicer.org/t/read-nrrd-detached-headers-that-omit-blank-line/19393>\
**Category:** Feature requests\
**Tags:** nrrd\
**Created:** [August 28, 2021, 12:52pm UTC](https://discourse.slicer.org/t/read-nrrd-detached-headers-that-omit-blank-line/19393 "2021-08-28T12:52:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Rorden](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chris_rorden/32/4073_2.png) [@Chris\_Rorden](https://discourse.slicer.org/u/Chris_Rorden)\
**Post date:** [August 28, 2021, 12:52pm UTC](https://discourse.slicer.org/t/read-nrrd-detached-headers-that-omit-blank-line/19393/1 "2021-08-28T12:52:48Z")

</div>

I have a feature request to allow Slicer to detect NRRD detached headers where the user omits the trailing blank line. Tested on Slicer 4.13.0-2021-08-24 r30133 / 5af0a09

The [NRRD format specification](http://teem.sourceforge.net/nrrd/format.html) clearly states `After the header, there is a single blank line containing zero characters.` However, this requirement is not obvious to users who create text-only detached headers. Currently, Slicer will fail to load a `.nhdr` file that omits this blank line. Slicer generates a vague error message, and since most text editors do not show white space the issue is not obvious. I would suggest that Slicer either read nhdr files that omit the trailing blank line, or detect this and warn the user that the image is not valid. So while Slicers current behavior is strictly correct, it could be extended to prevent this simple error.

All of these [datasets](https://klacansky.com/open-scivis-datasets/) exhibit this [issue](https://klacansky.com/open-scivis-datasets/metadata/). One can directly download a dataset to see the issue:

```auto
curl -LO https://klacansky.com/open-scivis-datasets/metadata/neghip.nhdr 
curl -LO http://cdn.klacansky.com/open-scivis-datasets/neghip/neghip_64x64x64_uint8.raw

```

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [August 31, 2021, 7:07pm UTC](https://discourse.slicer.org/t/read-nrrd-detached-headers-that-omit-blank-line/19393/2 "2021-08-31T19:07:34Z")

</div>

Hi @Chris_Rorden - thanks for reporting this; supporting this small deviation is probably a friendly thing to do for the reasons you cite. However, when I downloaded the data using the steps you reported it loaded fine for me (on mac with my local build and a binary release). Are you sure these file can be used to replicate? Is there another that are broken? In any case this might be something to be addressed at the ITK or teem level if we think that supporting these files is a good idea in general.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/7/174105360039742709ee9a58e8f4438319f43d99.jpeg)
