I always try to continue working on updates of TopoToolbox. Updates, however, will mainly comprise tools that I need for my work. If you are developing tools by yourself and you are willing to share them with others, please don’t hesitate to contribute to TopoToolbox. How does it work? Just send me an email with your function, I’ll review it and include it in the next update.

Functions should fulfill following criteria:

  • No scripts! If you have a good script that explains a type of analysis you are doing, we could consider including it in the documentation section.
  • The function should have a proper function name that doesn’t clash with built in functions of Matlab and common toolboxes.
  • H1-line, so that the function can be found by lookfor.
  • A comprehensive documentation structured as other functions in the toolbox.
  • The code should be commented as much as possible.
  • The code should be optimized using vectorization techniques and execute fast and reliably.
  • At best, the code should only depend on the Image Processing Toolbox. If other products are required, please notify.

Do you think TopoToolbox is missing important tools, but you are not willing or cannot programme them by yourself, just send me a request. Either I’ll try to work it out by myself or I’ll post it here hoping someone else will do it.

9 thoughts on “Contribute

    Jonathan Phillips said:
    January 12, 2016 at 11:43 am

    Howdy! I appreciate your including my blog on your Blogroll. Don’t ask me why I clicked on my own blog, but I discovered you’ve got my old URL. The new one is I don’t know why it had to be changed; it is difficult for me to get a straight answer from our IT people.



      wschwanghart responded:
      January 15, 2016 at 8:41 am

      Thanks for the note, Jonathan. Corrected. Cheers, Wolfgang

    Denis said:
    May 8, 2017 at 12:00 pm

    Hi Wolfgang,

    Thank you for this tool.
    After having used the ‘fillsinks’ filling option on my DEM, I got the following error when either trying to crop the filled DEM, or when e.g. subtracting the original DEM from it (I would like to have an idea about the residuals):

    Error using GRIDobj (line 169)
    The resolution in x- and y-direction must be the same

    Error in GRIDobj/crop (line 176)
    DEMc = GRIDobj(x,y,demc);

    My question is: is the ‘fillsinks’ option altering the resolution differently along X and Y?


      wschwanghart responded:
      May 8, 2017 at 12:20 pm

      Hi Denis, thanks for your comment. This is not a problem with the function fillsinks, but with the function crop. The problem has been noted before (see here: ) and is due to very small differences in cell sizes in x and y direction. These differences don’t play a role at first. Yet, after recalculating the georeferencing after cropping these differences blow up due to some numerical issues. I will need to fix this as soon as I have time. Until then, check the work arounds in above link.
      Best, Wolfgang

        wschwanghart responded:
        May 8, 2017 at 2:16 pm

        Note that I have updated the function GRIDobj/crop and the problem should not persist any longer in the latest version available on github (

        Denis said:
        May 9, 2017 at 8:24 am

        Many thanks Wolfgang,
        The ‘crop’ function now works perfectly – no resolution conflicts with the parent matrix anymore.

        Denis said:
        May 9, 2017 at 9:11 am

        I have another question regarding the ‘crop’ function.
        I would like to re-use the mask obtained from the ‘interactive’ option in order to crop several DEMs according to the exactly same extent and location. How can I do this?
        I looped into the ‘crop.m’ script, and it seems that there should be a way using the ‘sub2coord’ subfunction.

    wschwanghart responded:
    May 9, 2017 at 9:28 am

    Hi Denis, in fact crop has some undocumented second output argument, which is the MASK.
    [DEMc,MASK] = crop(DEM,…);
    In case you have different GRIDobjs A, B, C… with exactly the same extent as DEM folllowing code should work
    Ac = crop(A,MASK);
    Bc = crop(B,MASK);

    Hope this works,

      Denis said:
      May 9, 2017 at 9:37 am

      Thanks again!
      This is a very nice tool.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s