# Failed to load .hdr file

**URL:** <https://discourse.slicer.org/t/failed-to-load-hdr-file/25912>\
**Category:** Support\
**Created:** [October 26, 2022, 11:56am UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912 "2022-10-26T11:56:41Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sherry](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Sherry](https://discourse.slicer.org/u/Sherry)\
**Post date:** [October 26, 2022, 11:56am UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/1 "2022-10-26T11:56:41Z")

</div>

Hello everyone, I have a question, I can’t upload data to the 3D slicer, although I’ve searched a lot, but I still don’t understand why it doesn’t work. I am attaching my error and would be very happy if someone could help me.

Operating system:  
Slicer version:  
Expected behavior:  
Actual behavior:

 ![error](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/c/1cd4fc511bfd6d012c2d85d63014eba52991492c.png)

---

<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:** [October 26, 2022, 12:06pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/2 "2022-10-26T12:06:43Z")

</div>

Please check the application log (menu: Help / Report a bug) to see if you find any more hints about what goes wrong.

The `.hdr` extension typically refers to legacy Analyze/Nifti file format, but the extension may also be used for proprietary file formats. Where does this .hdr file comes from? Do you know what file format is used?

---

<div class="post-metadata">

**Author:** ![Sherry](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Sherry](https://discourse.slicer.org/u/Sherry)\
**Post date:** [October 26, 2022, 2:03pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/3 "2022-10-26T14:03:23Z")

</div>

Thanks a lot for your quick reply. To be honest I did not get the report bug properly.  
I downloaded a dataset and this hdr files are CT images that i wanted to load in 3D slicer.  
The file format is zip and when you open the zip file there are image, hdr and cls files.

---

<div class="post-metadata">

**Author:** ![Sherry](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Sherry](https://discourse.slicer.org/u/Sherry)\
**Post date:** [October 26, 2022, 2:30pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/4 "2022-10-26T14:30:38Z")

</div>

![report debug](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/a/caaa4b903b2c931db90526648a7350748a8d8870.png)  
I attach the report debug.

---

<div class="post-metadata">

**Author:** ![Sherry](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Sherry](https://discourse.slicer.org/u/Sherry)\
**Post date:** [October 26, 2022, 2:40pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/5 "2022-10-26T14:40:57Z")

</div>

![bug](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/0/3066b16f87a5a8d9019abbae15061569e4c0841c.png)

---

<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:** [October 26, 2022, 2:43pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/6 "2022-10-26T14:43:39Z")

</div>

I’ve never heard of .cls files, so probably this is a custom format you will need to research in order to figure out what’s in the file and then maybe we can help you load 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:** [October 26, 2022, 2:48pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/7 "2022-10-26T14:48:49Z")

</div>

Where do these images come from? Have you acquired yourself? Using what equipment? If you received it from somewhere, could you ask it in any standard file format, not the equipment-specific custom format?

---

<div class="post-metadata">

**Author:** ![Sherry](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Sherry](https://discourse.slicer.org/u/Sherry)\
**Post date:** [October 26, 2022, 2:51pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/8 "2022-10-26T14:51:15Z")

</div>

LaTeX software installations typically include some CLS files that can be used as document templates.  
Cls included text and hdr files included CT images.

---

<div class="post-metadata">

**Author:** ![Sherry](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Sherry](https://discourse.slicer.org/u/Sherry)\
**Post date:** [October 26, 2022, 2:53pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/9 "2022-10-26T14:53:10Z")

</div>

[A preclinical micro-computed tomography database including 3D whole body organ segmentations (figshare.com)](https://figshare.com/collections/A_preclinical_micro-computed_tomography_database_including_3D_whole_body_organ_segmentations/4224377)

---

<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:** [October 26, 2022, 2:56pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/10 "2022-10-26T14:56:54Z")

</div>

Okay, then yes, the .hdr/.img pairs are probably analyze files and they should load in Slicer if you put them in the same folder and load the .hdr file, but the error log indicates some failure. Maybe they are so old ITK no longer recognizes them.

---

<div class="post-metadata">

**Author:** ![Sherry](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Sherry](https://discourse.slicer.org/u/Sherry)\
**Post date:** [October 26, 2022, 2:58pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/11 "2022-10-26T14:58:23Z")

</div>

My Professor sent me the link and he can open the files in 3d Slicer but i can not. That’s why i am here for asking help, although i searched a lot but i could not find the solution.

---

<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:** [October 26, 2022, 2:59pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/12 "2022-10-26T14:59:42Z")

</div>

Can you report what versions of Slicer you and your professor are using?

---

<div class="post-metadata">

**Author:** ![Sherry](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Sherry](https://discourse.slicer.org/u/Sherry)\
**Post date:** [October 26, 2022, 3:00pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/13 "2022-10-26T15:00:13Z")

</div>

But it works for my professor, for me not. Do you have any suggestion?

---

<div class="post-metadata">

**Author:** ![Sherry](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Sherry](https://discourse.slicer.org/u/Sherry)\
**Post date:** [October 26, 2022, 3:00pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/14 "2022-10-26T15:00:59Z")

</div>

For me 5.0.3, i have to ask him

---

<div class="post-metadata">

**Author:** ![Sherry](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Sherry](https://discourse.slicer.org/u/Sherry)\
**Post date:** [October 26, 2022, 3:14pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/15 "2022-10-26T15:14:32Z")

</div>

> [@pieper](#):
>
> Can you report what versions of Slicer you and your professor are using?

My professor has also 5.0.3

---

<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:** [October 26, 2022, 4:08pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/16 "2022-10-26T16:08:48Z")

</div>

Can you easily share one example (.hdr/img pair) that works for your professor and not for you? (e.g. put it on dropbox or google drive and share the link)

Also please report what OS you are both using.

---

<div class="post-metadata">

**Author:** ![Sherry](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Sherry](https://discourse.slicer.org/u/Sherry)\
**Post date:** [October 26, 2022, 5:26pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/17 "2022-10-26T17:26:11Z")

</div>

Okay I will update you soon.

---

<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:** [October 26, 2022, 6:03pm UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/18 "2022-10-26T18:03:18Z")

</div>

I’ve checked the data set and it indeed contains Analyze images. They are loaded into Slicer without problems.

Make sure to have the entire image (.hdr and .img files) available in the folder and open the .hdr file.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/2/82bf12240ac29704e15572c2b05ac2d93871fdfe.png)

When you load the segmentation (Organ\*.hdr file) then choose `Segmentation` in the `Description` column to indicate that it is a segmented structure (it will make it appear nicely overlaid on the image).

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/3/0356ad63b26cfcdc5dc7364ffe8c480e1667466a.jpeg)

The .cls files describe label names and colors. You can manually edit the file in any text editor to bring it into Slicer’s [.ctbl format](https://slicer.readthedocs.io/en/latest/developer_guide/modules/colors.html#discrete-scale-color-lookup-table). If you save that .ctbl file and load it into Slicer then after that when loading the segmentation file you can choose that .ctbl file in the Options column, which will make the segmentation loaded with correct segment names and colors.

---

<div class="post-metadata">

**Author:** ![Sherry](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Sherry](https://discourse.slicer.org/u/Sherry)\
**Post date:** [October 28, 2022, 11:00am UTC](https://discourse.slicer.org/t/failed-to-load-hdr-file/25912/19 "2022-10-28T11:00:11Z")

</div>

Thank you very much for your time and help.  
Now it works properly. Thanks a lot for your complete explanation.
