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

Webilastik is a web application that can be accessed on https://app.ilastik.org. We suggest using it via the Chrome (or Chromium) web browser for now, since most of the testing has been done in this browser and subtle differences between browsers might cause unexpected behavior in the application.

You can find the webilastik application at https://app.ilastik.org/. You can also go directly to the application page.

Webilastik is an overlay on top of other data viewers. In particular, this implementation uses Neuroglancer as an underlying data viewer, so if you're familiar with its controls you can still use them when using webilastik.

Moving the controls window

You can move the webilastik controls around the screen by clicking and dragging on the header:

webilastik_click_and_drag.png

Opening a Dataset

Like in vanilla Neuroglancer, you add datasets to the viewer by clicking the "+" button at the top of the viewer:

webilastik_click_plus_sign_in_neuroglancer.png

You should be presented with a popup prompt where you can type in the URL of a dataset you want to view, in the format typically used by Neuroglancer. There are a few sample datasets hosted in webilastik:

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

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

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

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

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

After you type or paste the URL into the "Source" field, neuroglancer should recognize the shape and number of channels in the image. You can the click "Add Layer" to open the dataset in the viewer.

image-20220125164204-2.png

Opening a Dataset from the data-proxy

You can also load Neuroglancer Precomputed Chunks data from the data-proxy (e.g. the ana-workshop-event bucket); The URLs for this kind of data follow the following scheme:

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

where path/inside/your/bucket  should be the path to the folder containing the dataset "info" file.

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

    

webilastik_bucket_paths.png

you would type a URL like this:

precomputed://https://data-proxy.ebrains.eu/api/v1/buckets/ana-workshop-event/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 a single, 2D viewport:

image-20220125164416-3.png

which will change the view to something like this:

image-20220125164557-4.png

A Note on Neuroglancer and 2D data

Neuroglancer interprets all data as 3D, and visualizing a 2D image is interpreted as a single flat slice of data in 3D space. Scrolling in Neuroglancer can make the viewer go past this single slice of data, effectively hiding it from view. You can see the current viewer position in the top-left corner of the viewport, and you can edit those coordinates to reset the viewer to a position where your data is present and therefore visible (usually z=0 for 2D data):

image-20220222161022-1.png

Alternatively, once you have a compute session running you can also click the "Reset" button in the lower-right corner of the viewer to move the viewer back to the center of your datasets:

webilastik_click_recenter_button.png

Allocating a Compute Session

Normal ilastik operation can be computationally intensive, requiring dedicated compute resources to be allocated to every user working with it.

The "Session Management" widget allows you to request a compute session where webilastik will run; Select a session duration and click 'Create' to create a new compute session. Eventually the compute session will be allocated, opening up the other workflow widgets.

Don't forget to close your compute session by clicking the "Close Session" button once you're done to prevent wasting your quota in the HPC. If you have a long running job, though, you can just leave the session and rejoin it later by pasting its session ID in the "Session Id" field of the "Session Management" widget and clicking "rejoin Session".

Training the Pixel Classifier

Selecting Image Features

Pixel Classification uses different characteristics ("features") of each pixel from your image to determine which class that 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. The higher the sigma, the bigger the vicinity considered when computing values for each pixel, and the bigger its influence over the final value of that feature. Higher sigmas also require more computations to be done and can increase the time required to do predictions.

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 examples of each class.

Picking an Image Resolution (for multi-resolution images only)

If your data has multiple resolutions (not the case in any of the sample datasets), you'll have to pick one of them in the "Training" widget. Neuroglancer interpolates between multiple scales of the dataset, but ilastik operates on a single resolution:

image-20220911155827-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-20220222151117-1.png

Painting Labels

The status display in the "Training" applet will show "training on [datasource url]" when it's ready to start painting.

Now you can start adding brush strokes. By default, webilastik will create two kinds of labels: "Background" and "Foreground". You can rename them to your liking or change their colors to something more suitable for you or your dataset. You can also add more labels if you'd like ilastik to classify the pixels of your image into more than two categories.

Select one of the labels from the "Current Label" dropdown or by using the "Select Label" button, check the "Enable Brushing" checkbox to enable brushing mode (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: magenta, representing the "foreground" and green, representing the "background" class.

image-20220911162555-3.png

Once you have some image features selected and some brush annotation of at least 2 colors, you can check "Live Update" and 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-20220911163127-4.png

You can keep adding or removing brush strokes to improve your predictions.

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.88 using the steps described above:

image-20220911163504-5.png

You can keep adding or removing features to your model, as well as adding and removing annotations, which will automatically refresh 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. You can export your results in two ways:

1. As a "Predictions Map", which is a float32 image with as many channels as the number of Label colors you've used, or;

2. As a "Simple Segmentation", which is one 3-channel uint8 image for each of the Label colors you've used. The imag will be red where that pixel is more likely to belong to the respective Label and black everywhere else.

To do so, select a data source by typing in the URL of the data source in the "Url" field of the "Input" fieldset and select a scale from the data source as they appear beneath the URL field. You can also click the "Suggestions..." button to select one of the annotated datasources.

Then, configure the Output, i.e., the destination that will receive the results of the pixel classification. For now, webilastik will only export to ebrains' data-proxy buckets:

  1. Fill in the name of the data-proxy bucket where the results in Neuroglancer's precomputed chunks format should be written to;
  2. Fill in the directory path inside the bucket where the results should be saved to. This path will also contain the "info" file of the precomputed chunks format.

image-20220911170735-7.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/info/directory/path

image-20220125191847-3.png

Tags:
    
EBRAINS logo