Sign inSign up

lsdtopotools/lsdtt_opencv_docker

By lsdtopotools

Updated over 4 years ago

A container for lsdtopotools that includes a build of opencv

Image
0

967

lsdtopotools/lsdtt_opencv_docker repository overview

The LSDTopoTools OpenCV container

This docker container allows you to run the LSDTopoTools command line tools for valley extraction. It has the OpenCV dependency installed.

Instructions

These instructions tell you how to download the valley extraction tools and run them in a Docker environment.

Installing Docker

These are the bare bones instructions. For a bit more detail and potential bug fixes, scroll down to the section on Docker notes.

  1. Download and install Docker Desktop for Windows (only works with Windows 10 enterprise), Docker Desktop for Mac, or Docker for Ubuntu or Debian.
  • If you are installing Docker Desktop for Windows you should use the WSL 2 Backend. WSL 2 has been supported on Windows since around 2020. More details are on the Docker for Windows documentation.
  • On MacOS we recommend installing docker using brew: brew cask install docker
  • On MacOS and Linux, after you install docker you will need to add permissions: sudo usermod -a -G docker $USER
  1. We will henceforth assume that you actually have a functioning version of Docker on your host machine. If you want more details about how to use Docker, or getting it set up (particularly in Windows, in Linux and MacOS this is more straightforward), see our Docker notes.
Running the container
Part 1: set up an LSDTopoTools directory on your host machine
  1. You will want to be able to see LSDTopoTools output on your host operating system, so we will need to create a directory for hosting your LSDTopoTools data, code, and scripts.
  2. For the purposes of this tutorial, I will assume you are using Windows and that you have made a directory C:\LSDTopoTools.
  • You can put this directory anywhere you want as long as you remember where it is. You don't need to put anything in this directory yet.
Part 2: Build the container

Preamble: Once you have downloaded docker, you can control how much memory you give the docker containers. The default is 3Gb. If you have even moderate sized DEM data, this will not be enough. You can go into the docker settings (varies by operating system, use a search engine to figure out where they are) and increase the memory.

  1. First of all, clone this GitHub repository onto your local machine. Create a new directory on your machine where you want to store the files. Go into a terminal (MacOS or Linux) or Powershell window (Windows), navigate to the directory you just created and run:
git clone https://github.com/LSDtopotools/lsdtt_opencv_docker
  1. Now build the docker container using the Dockerfile. Navigate to the new directory:
cd lsdtt_opencv_docker

and then build the docker file

docker build -t lsdtt_opencv .
  1. Now you need to run the container:
$ docker run -it -v C:\LSDTopoTools:/LSDTopoTools lsdtt_opencv
  1. The -it means "interactive".
  2. The -v stands for "volume" and in practice it links the files in the docker container with files in your host operating system.
  3. After the -v you need to tell docker where the directories are on both the host operating system (in this case C:\LSDTopoTools) and the container (in this case /LSDTopoTools). These are separated by a colon (:).
  4. Once you do this you will get a # symbol showing that you are inside the container. You can now do LSDTopoTools stuff.
Running command line tools
  1. Command line tools are ready for use immediately. Try # lsdtt-valley-metrics

  2. To run the valley extraction methods, you need to have a DEM in ENVI bil format and a suitable parameter file in your C:\LSDTopoTools directory. Let's assume your parameter file is called LSDTT_valleys.param. We would run the valley metrics algorithm by navigating to the LSDTopoTools where the DEM is stored in docker and then run:

lsdtt-valley-metrics LSDTT_valleys.param
  1. You can get a help file for the command line tools with the -h flag, which will print an html and csv file with the various options that you can use in your parameter files:
lsdtt-valley-metrics -h

Docker notes

If you want to know all about Docker, make sure to read the docker documentation. A note of warning: Docker documentation is similar to documentation for the turbo encabulator. Below are some brief notes to help you with the essentials.

Docker quick reference

Here are some shortcuts if you just need a reminder of how docker works.

List all containers

$ docker ps -a

List containers with size

$ docker ps -as

Remove all unused containers

$ docker system prune

Docker on Linux

After you install docker on Linux, you will need to add users to the docker permissions:

$ sudo usermod -a -G docker $USER

Once you have done this you will need to log out and log back in again.

Docker for Windows

This section used to be very complicated, with many tips and tricks and gotchas. But Docker Desktop for Windows is much more streamlined now and you should just follow the instructions on the Docker for Windows installation website

Tag summary

Content type

Image

Digest

Size

1.6 GB

Last updated

over 4 years ago

docker pull lsdtopotools/lsdtt_opencv_docker