4. How to use Webilastik

Version 31.1 by tomazvieira on 2022/02/22 15:36

What is Webilastik?

Classic ilastik is a simple, user-friendly desktop tool for interactive image classification, segmentation and analysis. It is built as a modular software framework, which currently has workflows for automated (supervised) pixel- and object-level classification, automated and semi-automated object tracking, semi-automated segmentation and object counting without detection. Most analysis operations are performed lazily, which enables targeted interactive processing of data subvolumes, followed by complete volume analysis in offline batch mode. Using it requires no experience in image processing.

webilastik is a web version of ilastik's Pixel Classification Workflow, integrated with the ebrains ecosystem. It can access the data-proxy buckets for reading and writing (though reading is still suffering from latency issues). It uses Neuroglancer as a 3D viewer as well as compute sessions allocated from the CSCS infrastructure.

How to use Webilastik

Opening a sample Dataset

Go to https://app.ilastik.org/ and load a Neuroglancer Precomputed Chunks dataset. You can e.g. use a sample data set that is already in the server by pasting the following URL into Neuroglancer's prompt:

precomputed://https://app.ilastik.org/public/images/c_cells_2.precomputed

image-20220125164204-2.png

Opening a Dataset from the data-proxy

You can also load Neuroglancer Precomputed Chunks data from the data-proxy; The URLs for this kind of data follow the following scheme:

precomputed://https://data-proxy.ebrains.eu/api/buckets/my-bucket-name/path/inside/your/bucket

So, for example, to load the sample data inside the quint-demo bucket, under the path tg-ArcSwe_mice_precomputed/hbp-00138_122_381_423_s001.precomputed  like in the example below:

image-20220128142757-1.png

you would type a URL like this:

precomputed://https://data-proxy.ebrains.eu/api/buckets/quint-demo/tg-ArcSwe_mice_precomputed/hbp-00138_122_381_423_s001.precomputed

this scheme is the same whether you're loading data into the Neuroglancer viewer or specifying an input URL in the export applet.

Viewing 2D Data

If your dataset is 2D like in the example, you can click the "switch to xy layout" button at the top-right corner of the top-left quadrant of the viewport to use  asingle, 2D viewport:

image-20220125164416-3.png

which will change the view to something like this:

image-20220125164557-4.png

Training the Pixel Classifier

Selecting Image Features

Pixel Classification uses different characteristics ("features") of your image to determine which class each pixel should belong to. These take into account, for example, color and texture of each pixel as well as that of the neighboring pixels. Each one of this characteristics requires some computational power, which is why you can select only the ones that are sensible for your particular dataset.

Use the checkboxes in the applet "Select Image Features" applet to select some image features and their corresponding sigma (which determines the radius around the pixel that will be considered when computing that feature).

You can read more about image features in ilastik's documentation.

The following is an arbitrary selection of image features. Notice that the checkboxes marked in orange haven't been commited yet; Click Ok to send your feature selections (or deselections) to the server.

image-20220125171850-7.png

Labeling the image

In order to classify the pixels of an image into different classes (e.g.: 'foreground' and 'background') ilastik needs you to provide it with samples of each class.

To do so, first select a particular resolution of your dataset (your viewer might interpolate between multiple scales of the dataset, but ilastik operates on a single resolution):

image-20220125165642-1.png

Once you've selected a resolution to train on, you should see a new "training" tab at the top of the viewer:

image-20220125165832-2.png

You must have the "training" tab as the frontmost visible tab in order to start adding brush strokes (in neuroglancer you can click the name of the raw data tab to hide it, for example):

image-20220125170609-3.png

The status display in this applet will show "training on [datasource url]" when you're in training mode.

Now you can start adding brush strokes. Select a color from the color picker, check the "Enable Brushing" checkbox to enable brushing (and disable navigation), and click and drag over the image to add brush strokes. Ilastik will map each used color to a "class", and will try to figure out a class for every pixel in the image based on the examples provided by the brush strokes. By painting, you provide ilastik with samples of what a pixel in that particular class should look like. The following image shows an example with 2 classes: teal, representing the "foreground" or the "cell class", and magenta, representing the "background" class.

image-20220125171324-4.png

Once you have some image features selected and at least one brush annotation, ilastik will automatically use your examples to predict what classes the rest of your dataset should be, displaying the results in a "predictions" tab.

image-20220125171715-5.png

You can adjust the display settings of the overlay predictions layer as you would in vanilla neuroglancer:

  1. right-click the predictions Neuroglancer tab to reveal the "rendering" options
  2. Adjust the layer opacity to better view the predictions or underlying raw data;
  3. Advanced users: edit the shader to render the predictions in any arbitrary way;

The image below shows the "predictions" tab with an opacity set to 0.68 using the steps described above:

image-20220125172238-8.png

You can keep adding or removing features to your model, as well as adding and removing annotations, which will automatically update the predictions tab.

Exporting Results and Running Jobs

Once you trained your pixel classifier with the previous applets, you can apply it to other datasets or even the same dataset that was used to do the training on.

To do so, select a data source by typing in the URL of the data source in the Data Source Url field and select a scale from the data source as they appear beneath the URL field.

Then, configure a Data Sink, i.e., a destination that will receive the results of the pixel classification. For now, webilastik will only export to ebrains' data-proxy buckets; Fill in the name of the bucket and then the prefix (i.e.: path within the bucket) where the results in Neuroglancer's precomputed chunks format should be written to.

image-20220125190311-2.png

Finally, click export button and eventually a new job shall be created if all the parameters were filled in correctly.

You'll be able to find your results in the data-proxy GUI, in a url that looks something like this:

https://data-proxy.ebrains.eu/your-bucket-name?prefix=your/selected/prefix

image-20220125191847-3.png