Skip to content

Commit 898a672

Browse files
committed
[bug] cast indices to double to avoid error on older octave, #83
1 parent 1e7a9b4 commit 898a672

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nii2jnii.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
'uint8' 0 % unknown %
178178
'uint8' 0 % binary (1 bit/voxel) %
179179
'uint8' 1 % unsigned char (8 bits/voxel) %
180-
'int16' 1 % signed short (16 bits/voxel) %
180+
'int16' 1 % signed short (16 bits/voxel) %
181181
'int32' 1 % signed int (32 bits/voxel) %
182182
'single' 1 % float (32 bits/voxel) %
183183
'single' 2 % complex (64 bits/voxel) %
@@ -236,7 +236,7 @@
236236
nii.img = fread(fid, imgbytenum, [nii.datatype '=>' nii.datatype]);
237237
fclose(fid);
238238
else
239-
nii.img = typecast(gzdata(nii.hdr.vox_offset + 1:nii.hdr.vox_offset + imgbytenum), nii.datatype);
239+
nii.img = typecast(gzdata(double(nii.hdr.vox_offset + 1):double(nii.hdr.vox_offset + imgbytenum)), nii.datatype);
240240
end
241241
end
242242

0 commit comments

Comments
 (0)