Working with filter libraries

[1]:
import afwizard

AFWizard stores filter pipelines in .json files for later reuse. JSON stands for JavaScript Object Notation and is a widely used format for storing custom data structures. We will see in Creating filter pipelines how these files are created from scratch. Now, we will learn how to use these files. This will enable you to leverage a library of community-contributed filter pipelines and allow you to organize your filter pipelines locally.

Adding filter libraries

Filter libraries are directories that contain a number of .json files that contain filter pipeline definitions. AFwizard internally keeps a per-session list of known filter libraries which by default contains the current working directory and the path to the library of community-contributed filters, which has been installed as a separate Python package. We can manually register directories as filter libraries like this:

[2]:
afwizard.add_filter_library(path="/home/user/somepath", recursive=False)

The recursive parameter specifies whether filter pipelines in subdirectories of the given directory should also be taken into account (defaults to False).

Browsing filters in filter libraries

We can search our filter libraries for filter pipelines matching certain criteria by using the select_pipeline_from_library and select_pipelines_from_library functions. The former will allow you to select exactly one pipeline, where as the latter allows you to select multiple pipelines by holding CTRL pressed while clicking on the filters. Clicking the Finalize button will make the user interface vanish, but you can also use the returned pipeline object before that:

[3]:
pipeline = afwizard.select_pipeline_from_library()

In the left most column, we see filtering criterions we can use to access the filter pipelines in our filtering libraries. The middle column contains a list of filter pipelines that match the given criteria. Clicking one of these will select it and show its metadata in the third column. The returned pipeline object can then be passed to other functions from AFwizard, e.g. to select the best filter pipeline for a given dataset.

Proprietary filtering backends

AFwizard does not implement its own ground point filtering algorithms. Instead, algorithms from existing packages are accessible through a common interface. Currently, the following backends are available:

  • PDAL: The Point Data Abstraction Library is an open source library for point cloud processing.

  • OPALS is a proprietary library for processing Lidar data. It can be tested freely for datasets <1M points.

  • LASTools has a proprietary tool called lasground_new that can be used for ground point filtering.

PDAL is always available when using AFwizard and is used internally for many tasks that are not directly related to ground point filtering. In order to enable the OPALS backend, AFwizard needs to be given the information where your OPALS installation (potentially including your license key) is located. This can either be done by setting the environment variable OPALS_DIR or by setting the path at runtime:

[4]:
?afwizard.set_opals_directory

Similarly, you can set the path to your installation of LASTools either through the environment variable LASTOOLS_DIR or at runtime:

[5]:
?afwizard.set_lastools_directory

Please note that LASTools only ships Windows binaries. Therefore, you will need Wine installed on your system to successfully use the LASTools backend on Linux.

Creating new filter libraries

As filter libraries are just directories on the file system, you are free to organizing them yourself by moving and copying files and then making the respective directories known to AFwizard using add_filter_library as seen above. However, there is also additional functionality available that eases the management process. If you are editing filter pipelines a lot, you might want to set the current library path like this:

[6]:
afwizard.set_current_filter_library(
    "mylibrary", create_dirs=True, name="My testing library"
)

The library defined by set_current_filter_library will be used as the default path to store filter pipelines using save_filter or select_best_pipeline. Here, the name parameter is used to define a display name for the filter library. It is stored in JSON file called library.json in the directory. Such file could also be added manually to filter library directories. If you do not want to generate library.json or do not want to override an existing one, you may set name=None.

Sharing filter pipelines with others

As each filter pipeline is stored as a separate file, filter pipelines can be shared easily by sharing these files via your favorite method. If you want to share your filter pipeline with a wider community, you should consider contributing it to AFwizard’s community contribution library. This will make your filter pipeline accessible to all users of AFwizard. You can find the details of the process on GitHub.

Resetting filter libraries

If, for some reason, you want to reset the currently registered filter libraries to the default ones, you can do so like this:

[7]:
afwizard.reset_filter_libraries()