# Comparing Label maps: nrrd, nii and .mat

**URL:** <https://discourse.slicer.org/t/comparing-label-maps-nrrd-nii-and-mat/912>\
**Category:** Support\
**Created:** [August 21, 2017, 4:02pm UTC](https://discourse.slicer.org/t/comparing-label-maps-nrrd-nii-and-mat/912 "2017-08-21T16:02:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwelch](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@mwelch](https://discourse.slicer.org/u/mwelch)\
**Post date:** [August 21, 2017, 4:02pm UTC](https://discourse.slicer.org/t/comparing-label-maps-nrrd-nii-and-mat/912/1 "2017-08-21T16:02:51Z")

</div>

Hi!  
I would like to qualitatively compare binary label maps generated from RTStruct files by visualizing them in 3D Slicer. I have three different formats: .nrrd, .nii and .mat. The .nrrd and .nii files were generated in 3D Slicer, and the .mat file was generated in Matlab.

**Is there a way to load a .mat label mask to 3D Slicer without having to re-write it to an .nrrd?**

The Matlab Commander: img = load(’…\mask.mat’) completes and knows that the file is a logical volume, but I can’t figure out how to visualize it.

Thanks for any help or guidance you can give!

---

<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:** [August 21, 2017, 4:07pm UTC](https://discourse.slicer.org/t/comparing-label-maps-nrrd-nii-and-mat/912/2 "2017-08-21T16:07:43Z")

</div>

In Matlab, save the voxel array as a .nrrd file using nrrdwrite.m. You should be able to write a function using a few lines of code that iterates through all the .mat files in a directory structure and saves them as .nrrd.

In general, it is fine to use any file format for temporary storage, but better for archiving, long-term storage, sharing, and analysis it is always better to use standard, open, widely supported file formats (DICOM, NRRD, MetaIO, etc) instead of proprietary/application-specific formats (such as Matlab’s .mat).

---

<div class="post-metadata">

**Author:** ![mwelch](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@mwelch](https://discourse.slicer.org/u/mwelch)\
**Post date:** [August 22, 2017, 8:27pm UTC](https://discourse.slicer.org/t/comparing-label-maps-nrrd-nii-and-mat/912/3 "2017-08-22T20:27:44Z")

</div>

Thank you, Andras!  
Not exactly what I was looking for, but it will do the trick.
