# Single slice nifti loaded as 2 slice volume

**URL:** <https://discourse.slicer.org/t/single-slice-nifti-loaded-as-2-slice-volume/3592>\
**Category:** Support\
**Created:** [July 27, 2018, 2:46pm UTC](https://discourse.slicer.org/t/single-slice-nifti-loaded-as-2-slice-volume/3592 "2018-07-27T14:46:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Felix\_Navarro\_Guirad](https://avatars.discourse-cdn.com/v4/letter/f/4491bb/32.png) [@Felix\_Navarro\_Guirad](https://discourse.slicer.org/u/Felix_Navarro_Guirad)\
**Post date:** [July 27, 2018, 2:46pm UTC](https://discourse.slicer.org/t/single-slice-nifti-loaded-as-2-slice-volume/3592/1 "2018-07-27T14:46:30Z")

</div>

Dear all, I’m having a issue while loading a single slice nifti file.

When I load this file ([1.nii](https://drive.google.com/file/d/1B3_lQWOoUnr333--sk5gJuJRA77JOc_n/view?usp=sharing)) into slicer, the volume module informs me about that it is a 2 slice volume but it should be 1 slice only.

I created the file using matlab, when I load it into imageJ or matlab, both show 1 slice volume.

Using the same library from Matlab I created a nifti file containing a mask ([mascaraAlineacion.nii](https://drive.google.com/file/d/1cW43VhbTutUmyPqSE9EYhtlyW0ofqfSt/view?usp=sharing)), which is correctly loaded as 1 slice labelmap.

I’m quite sure that both files only differ in the content of the image and glmin/glmax values contained into the header.

Is this a bug? or should I take care of any special requirement for the nii header?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [July 27, 2018, 2:48pm UTC](https://discourse.slicer.org/t/single-slice-nifti-loaded-as-2-slice-volume/3592/2 "2018-07-27T14:48:51Z")

</div>

I don’t have an answer to your specific question, but why don’t you look at the [MatlabBridge extension](https://www.slicer.org/wiki/Documentation/Nightly/Extensions/MatlabBridge) instead of writing NIfTI file?

---

<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:** [July 27, 2018, 3:02pm UTC](https://discourse.slicer.org/t/single-slice-nifti-loaded-as-2-slice-volume/3592/3 "2018-07-27T15:02:22Z")

</div>

As a quick test, you can use nrrdwrite.m function of MatlabBridge to write a nrrd image file - [https://github.com/PerkLab/SlicerMatlabBridge/tree/master/MatlabCommander/commandserver](https://github.com/PerkLab/SlicerMatlabBridge/tree/master/MatlabCommander/commandserver)

The mascaraAlineacion.nii file that you’ve sent the link to, can be loaded without any warnings in the nightly build. It seems to be a binary image, so you may want to load it as a labelmap volume (in “Add data” dialog, click “Show options”, then click “Labelmap”).

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [July 27, 2018, 7:45pm UTC](https://discourse.slicer.org/t/single-slice-nifti-loaded-as-2-slice-volume/3592/4 "2018-07-27T19:45:10Z")

</div>

> [@Felix\_Navarro\_Guirad](#):
>
> When I load this file ([1.nii](https://drive.google.com/file/d/1B3_lQWOoUnr333--sk5gJuJRA77JOc_n/view?usp=sharing)) into slicer, the volume module informs me about that it is a 2 slice volume but it should be 1 slice only.

I loaded this file in to three different Slicer versions I had running (2018/07-25 & 06-13, and 4.8.1). All of them show dimensions as 512x512x1 mm in the Volumes module.

---

<div class="post-metadata">

**Author:** ![Felix\_Navarro\_Guirad](https://avatars.discourse-cdn.com/v4/letter/f/4491bb/32.png) [@Felix\_Navarro\_Guirad](https://discourse.slicer.org/u/Felix_Navarro_Guirad)\
**Post date:** [July 30, 2018, 9:07am UTC](https://discourse.slicer.org/t/single-slice-nifti-loaded-as-2-slice-volume/3592/5 "2018-07-30T09:07:50Z")

</div>

Dear all, thank you very muh for your replies.

I have tested this on versions 4.5.0-1 and 4.9.0 (18/07/2018). On both versions the problem appears when I do NOT select the “single file” option when I load the volumes.

I intend to use Slicer from Matlab using a system call to send a CLI command. I intend to perform several rigid registrations. May I check if Brainsfit is using the correct volumes?

Thank you in advance.

---

<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:** [July 30, 2018, 10:18am UTC](https://discourse.slicer.org/t/single-slice-nifti-loaded-as-2-slice-volume/3592/6 "2018-07-30T10:18:27Z")

</div>

If you have multiple slices with similar enough names in the same folder then Slicer can load them as a 3D volume. If you prefer to load just a single slice then check single file option, put files in separate folders, or use different file names.

I’m not sure if BRAINS other registration modules support single-slice volume registration, you may need to resample the single-slice volume to have at least 3 slices (for example, using Crop and resample module, as described in other topics in this forum). If you have any problems with registration, please post it in a new topic and give high-level overview, what you would like to do, and any specific problem that you have.
