Skip to content

Commit

Permalink
Be more careful about bounds-checking. Fixes #45.
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Sep 18, 2014
1 parent 5acd32d commit 4f86054
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,10 @@ parentdims(A::SubArray) = Base.parentdims(A)
function _reslice!(img2::ImageSlice2d)
newindexes = copy(img2.indexes)
bb = img2.zoombb
newindexes[img2.xdim] = newindexes[img2.xdim][ifloor(bb.xmin)+1:iceil(bb.xmax)]
newindexes[img2.ydim] = newindexes[img2.ydim][ifloor(bb.ymin)+1:iceil(bb.ymax)]
xindx = newindexes[img2.xdim]
yindx = newindexes[img2.ydim]
newindexes[img2.xdim] = xindx[max(1,ifloor(bb.xmin)+1):min(length(xindx),iceil(bb.xmax))]
newindexes[img2.ydim] = yindx[max(1,ifloor(bb.ymin)+1):min(length(yindx),iceil(bb.ymax))]
if img2.zdim > 0
newindexes[img2.zdim] = newindexes[img2.zdim][img2.zindex]
end
Expand Down

0 comments on commit 4f86054

Please sign in to comment.