Skip to content

Commit

Permalink
merge master -Dorg -Ssuccess-only: PR 4130 (matlab/bfGetPlane.m: avoi…
Browse files Browse the repository at this point in the history
…d use of makeDataArray2D when Octave (ome/bio-formats-octave-docker#29))
  • Loading branch information
snoopycrimecop committed Nov 22, 2024
2 parents 862723a + 49079c3 commit 0bb5f41
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions components/formats-bsd/matlab/bfGetPlane.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,20 @@
ip.Results.iPlane - 1, ip.Results.x - 1, ip.Results.y - 1, ...
ip.Results.width, ip.Results.height);

% Convert byte array to MATLAB image
I = javaMethod('makeDataArray2D', 'loci.common.DataTools', plane, ...
bpp, fp, little, ip.Results.height);
% Convert byte array into the appropriate primitive type array which
% Octave and Matlab then autobox into their own array type.
if is_octave()
% Octave will not autobox multi-dimensional arrays, so use
% makeDataArray (returns 1D vector) instead of makeDataArray2D
% See https://github.com/ome/bio-formats-octave-docker/issues/29
I = javaMethod('makeDataArray', 'loci.common.DataTools', plane, ...
bpp, fp, little);
I = reshape(I, [ip.Results.width ip.Results.height]).';
else
I = javaMethod('makeDataArray2D', 'loci.common.DataTools', plane, ...
bpp, fp, little, ip.Results.height);
end

if ~sgn
% Java does not have explicitly unsigned data types;
% hence, we must inform MATLAB when the data is unsigned
Expand Down

0 comments on commit 0bb5f41

Please sign in to comment.