Single slice nifti loaded as 2 slice volume

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

When I load this file (1.nii) 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), 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.

I don’t have an answer to your specific question, but why don’t you look at the MatlabBridge extension instead of writing NIfTI file?

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

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”).

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.

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.

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.

1 Like