Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] Update pixel and object classification for 1.3.2 #69

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified documentation/objects/figs/pixel_results.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/objects/figs/thresholding_channel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/objects/figs/thresholding_sigmas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions documentation/objects/objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ This is a combined workflow, which lets you start from the raw data, perform pix
in
[Pixel Classification workflow]({{site.baseurl}}/documentation/pixelclassification/pixelclassification.html)
and then thresholding the probability maps to obtain a segmentation.
This workflow is primarily meant for demo purposes.
For serious projects, we recommend to use the two workflows, [Pixel Classification]({{site.baseurl}}/documentation/pixelclassification/pixelclassification.html) and Object Classification separately using the generated output form the former as an additional input in the latter one.

<a href="figs/input_pixel_class.png" data-toggle="lightbox"><img src="figs/input_pixel_class.png" class="img-responsive" /></a>

Expand All @@ -56,21 +58,21 @@ Suppose we have a probability map for a 2-class classification, which looks like

There are two ways to transform a probability map into a segmentation in ilastik and both are covered by the thresholding applet. To see the results of changing the parameter settings in this applet, press the "Apply" button.

First, specify which channel of the probability map you want to threshold (we choose channel 1, as it corresponds to object rather than background probability). The "Selected input channel" layer will show you the channel you selected in the corresponding label color:
First, specify which channel of the probability map you want to threshold (we choose the yellow channel, as it corresponds to object rather than background probability).

<a href="figs/thresholding_channel.png" data-toggle="lightbox"><img src="figs/thresholding_channel.png" class="img-responsive" /></a>

After selecting the channel, choose a sigma to smooth the probability map with a Gaussian. The Gaussian can be anisotropic, i.e. sigmas for all dimensions can be different. If you do not want to smooth, just select a very small sigma (like 0.6). You can check the results of the smoothing operation by first activating the "Show intermediate results" checkbox and then looking at the "Smoothed input" layer:

<a href="figs/thresholding_sigmas.png" data-toggle="lightbox"><img src="figs/thresholding_sigmas.png" class="img-responsive" /></a>

Now, two options are available for the actual thresholding, as shown in the little tab widget "One Threshold/Two Thresholds".
Now, two options are available for the actual thresholding, which can be selected with the **Method** drop-down".

The **"One Threshold"** tab performs regular thresholding, followed by the size filter. For debugging purposes, we also provide a view on the thresholded objects before size filtering. This layer is activated by checking the "Show intermediate results" checkbox.
Selecting **"Simple"** will perform regular thresholding at one level, followed by the size filter. We also provide a view on the thresholded objects before size filtering. This layer is activated by checking the "Show intermediate results" checkbox.

<a href="figs/thresholding_before_size_filter.png" data-toggle="lightbox"><img src="figs/thresholding_before_size_filter.png" class="img-responsive" /></a>

The **"Two Thresholds"** tab performs hysteresis thresholding with two thresholds: high and low. The high threshold is applied first and the resulting objects are filtered by size. For the remaining objects the segmentation is then relaxed to the level of low threshold. The two levels of thresholding allow to separate the criteria for detection and segmentation of objects and select only objects of very high probability while better preserving their shape. As for the single threshold case, we provide a view on the intermediate results after the application of the high threshold, the size filter and the low threshold. The image below shows the results of the high (detection) threshold in multiple colors overlayed with the results of the low (segmentation) threshold in white:
By selecting **Hystersis** in the method drop-down thresholding is performed at two levels: high and low. The high threshold is applied first and the resulting objects are filtered by size. For the remaining objects the segmentation is then relaxed to the level of low threshold. The two levels of thresholding allow to separate the criteria for detection and segmentation of objects and select only objects of very high probability while better preserving their shape. As for the single threshold case, we provide a view on the intermediate results after the application of the high threshold, the size filter and the low threshold. The image below shows the results of the high (detection) threshold in multiple colors overlayed with the results of the low (segmentation) threshold in white:

<a href="figs/thresholding_two_thresholds.png" data-toggle="lightbox"><img src="figs/thresholding_two_thresholds.png" class="img-responsive" /></a>

Expand All @@ -93,6 +95,8 @@ The "Standard Object Features" refer to the built-in ilastik features, computed

Once you have selected the features you like, the applet will proceed to compute them. For large 3D datasets this step can take quite a while. However, keep in mind that most of the time selecting more features at this step is not more expensive computationally. We therefore recommend that you select all features you think you might try for classification and then choose a subset of these features in the next applet.

Note on spacial features: Features that are preceded with the "Coord" prefix produce features with absolute coordinate positions in the image. These are only useful in special cases when the position of the object in the image can be used to infer the object type.

## Prediction for objects - "Object Classification" applet
This applet allows you to label the objects and classify them based on the features, computed in the previous applet. If you want to choose a subset of features, press the "Subset features" button. Adding labels and changing their color is done the same way as in the
[Pixel Classification workflow]({{site.baseurl}}/documentation/pixelclassification/pixelclassification.html).
Expand Down
15 changes: 12 additions & 3 deletions documentation/pixelclassification/pixelclassification.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ Here the user can select from several different feature types and scales.

All of these features can be selected on different scales. The scales correspond to the pixel diameter
that is used to calculate the respective feature. I.e. if a typical textural pattern has a pixel size of 4, this should be selected as the scale.
_New since version 1.3.2:_ In addition to the seven predefined scales, users can specify new scale values (sigmas) in the feature selection dialog by clicking on **add** in the rightmost column.

When using 3D data, the user, furthermore, can choose whether to compute features in 3D (default), or 2D (slice-wise in the x-y plane).
Using 2D features for 3D data is particularly useful when the resolution along the z-axis is a lot lower than the resolution in the x-y plane.
This also speeds up feature computation.
Toggling between 2D and 3D feature computation can be achieved by simply clicking the icon in the **Compute in 2D/3D** row of the feature selection table at the respective resolution.
<a href="snapshots/feature_selection_2d3d.png" data-toggle="lightbox"><img src="snapshots/feature_selection_2d3d.png" class="img-responsive" /></a>

In general we advise to initially select a wide range of feature types and scales. Later on, this selection
can always be refined. The selected features can be inspected in the bottom left after clicking **OK** in the feature selection dialog.
Expand All @@ -67,10 +74,11 @@ eventual mistakes.
To begin with the training of the classifier, we switch to the **Training** applet and add some labels.
<a href="snapshots/training_zoomed.png" data-toggle="lightbox"><img src="snapshots/training_zoomed.png" class="img-responsive" /></a>
Each added label should correspond to a object type that we want to separate.
In the simplest case, we add one label for the object class (in this example the object class would be cell)
and an additional label fore the background class.
In the _simplest case_, we train a classifier that differentiates between two classes.
Accordingly, two labels are added per default (_since version 1.3.2_), e.g. one for the object class (in this example the object class would be cell)
and and the second label fore the background class.
More labels can be added by clicking the **Add label** button.

After adding at least two labels, the user can begin to mark the objects and the background.
To mark an object, the label corresponding to the object class has to be selected, then the user
can draw a scribble over the image.
The background can be annotated in the same way after selecting the background class label on the left.
Expand All @@ -80,6 +88,7 @@ The user can select the size of the brush, and switch between drawing and erasin
To visualize the results of the classification, the **Live update** mode can now be switched on.
The pixel classification result is displayed as an overlay on the image.
Now classification errors can be corrected by giving additional annotations. The updated classification results will be displayed immediately in the main window.
Note, that it is not possible to add and remove labels while in live update mode.
<a href="snapshots/training2_zoomed.png" data-toggle="lightbox"><img src="snapshots/training2_zoomed.png" class="img-responsive" /></a>

To display the hard classification results, i.e. the final class assignment the **Segmentation** overlays
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/pixelclassification/snapshots/training2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/pixelclassification/snapshots/training3_zoomed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/pixelclassification/snapshots/training_zoomed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/pixelclassification/snapshots/window_leveling.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.