Skip to content

Commit

Permalink
Update fillsinks.m
Browse files Browse the repository at this point in the history
Removed bug when calling fillsinks with an additional sink raster.
  • Loading branch information
wschwanghart committed Nov 8, 2015
1 parent 41ec27f commit e1c2f82
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions @GRIDobj/fillsinks.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@
I = (imdilate(Inan,ones(3)) & ~Inan) | I;
end

SINKS = SINKS | I;

% Refine markers by identifying the lowest value in each sink
STATS = regionprops(SINKS,dem,'MinIntensity','PixelIdxList');
SINKS = false(size(SINKS));
Expand All @@ -145,10 +143,13 @@

marker = -inf(size(dem),class(dem));
marker(SINKS) = -dem(SINKS);
marker(I) = -dem(I);
demfs = -imreconstruct(marker,-dem);

end

% nans in the dem are set to nan again
demfs(Inan) = nan;
try
demfs(Inan) = nan;
end
DEM.Z = demfs;

0 comments on commit e1c2f82

Please sign in to comment.