Skip to content

Commit

Permalink
make bounding box 1 voxel larger
Browse files Browse the repository at this point in the history
  • Loading branch information
korbinian90 committed Sep 26, 2023
1 parent 615e6c0 commit 800f71a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/tgv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,12 @@ end

# get indices for the smallest box that contains the mask
function mask_box_indices(mask)
function get_range(mask, dims)
function get_range(mask, dim)
dims = [(2, 3), (1, 3), (1, 2)][dim]
mask_projection = dropdims(reduce(max, mask; dims); dims)
return findfirst(mask_projection):findlast(mask_projection)
first = max(findfirst(mask_projection) - 1, 1)
last = min(findlast(mask_projection) + 1, size(mask, dim))
return first:last
end
return [get_range(mask, dims) for dims in [(2, 3), (1, 3), (1, 2)]]
return [get_range(mask, dim) for dim in 1:3]
end

0 comments on commit 800f71a

Please sign in to comment.