A good place to start with libtopotoolbox is in toolbox/@FLOWobj/private/createAuxiliaryTopo. We can do most but not all of the steps in that function using libtopotoolbox. Each of the following libtopotoolbox functions need a MEX wrapper and then should be incorporated into the corresponding function of topotoolbox3:
CC = bwconncomp(I);
tweight = 1;
for r = 1:CC.NumObjects
maxdepth = max(D(CC.PixelIdxList{r}));
D(CC.PixelIdxList{r}) = (maxdepth - D(CC.PixelIdxList{r})).^tweight + CarveMinVal;
% D(CC.PixelIdxList{r}) = maxdepth - D(CC.PixelIdxList{r});
% D(CC.PixelIdxList{r}) = (D(CC.PixelIdxList{r})./maxdepth + CarveMinVal).^tweight;
end
clear CC
A good place to start with libtopotoolbox is in toolbox/@FLOWobj/private/createAuxiliaryTopo. We can do most but not all of the steps in that function using libtopotoolbox. Each of the following libtopotoolbox functions need a MEX wrapper and then should be incorporated into the corresponding function of topotoolbox3:
fillsinksMEX #19. Wraps our implementation ofimreconstruct. Does not handle known internal sinks.identifyflatsMEX #20. Similar toidentifyflatsbut has a different return value that requires splitting into the desired outputs.gwdt_computecostsMEX #21. This function implements this part ofcreateAuxiliaryTopogwdtMEX #22. Similar tograydist, but with a different interface