- Create a classification or segmentation model which should represent a mask.
- In the feature configuration (F3) set one or more classes to ‘inclusion’ (important!), no exclusion needed.
- In model explorer: click ‘add’ to put the model to the model explorer.
- Reset the model (Model -> Entire Model), create another one (either classification or segmentation).
- Go to the mask tab and click ‘set as classification mask’ or ‘set as segmentaiton mask’.
- Now your classification/segmentation takes only place in the inclusion classes / segmented objects of the mask model.
Mask can be used to define an active area in which another model is applied to e.g. quantify something. In contrast to an exclusion model a mask is applied to the full resolution image and thus can covers fine-grained structures, such as cells, where an exclusion model should be used to discriminate between e.g. foreground and background.
So far a mask can be defined by a classification model where inclusion classes (to be defined via F4, class setup) define the active area, or a segmentation model where the segmented objects define the active area.
In the following example we will use a segmentation model to define DAPI stained nuclei as active objects and then classify further stainings just inside this active area. We start with – in this case – a multi-channel fluorescence image:
- Let’s create a segmentation model which later will define the mask. Switch to the ‘object segmentation’ tab, click on ‘setup’ to define a foreground and background class. First, we only enable the DAPI channel which defines the nuclei. This has to be done in the feature configuration (F3) and for better visual overview also in the image adjustments (adjustment tab).
- Create a segmentation model as described in the segmentation tutorial. In short: select the background class, use e.g. the polygon tool to mask some background, select the foreground class ans mark some cell area. Click on ‘train’, then ‘classify within a small ROI to check if the foreground/background discrimination works, then click on ‘set as primary segmentation object’ and ‘object segmentation’ within a small ROI to check the segmentation. You should have a result like this:
- Switch to the model explorer on the right side and add the model. With this we store the model for later usage.
- Now we create a new classification model to quantify the other stainings (Fitc, Cy3.5 and Cy5.5) like described in the quantification tutorial.
Hint: It might be that you still see the segmentation shapes which confuse you: This is a bug in the current version which is just a visual problem. To get rid of existing segmentation objects you can either close and re-open the image or execute the following line in the Tools- > Script Editor (or you just ignore it):
First, we reset the current model (Tab Model -> Entire Model), switch the classification tab and click on setup. In addition we activate all channels except DAPI in the feature configuration (F3) and in the image adjustments.
In the class setup we rename the classes to the specific staining names + background. Here this results in four classes which means we had to add one:
We mark training regions for each class, train and classify which should result in something like this:
Here we did the classification within the selected ROI. Now we want to apply it only within the nuclei – which we defined before with the segmentation model.
- Set mask model: Select the tab Mask. Activate the model explorer, select the segmentation model we created before. In the mask tab, click on ‘Set Segmentation Mask’:
The segmentation mask is set now. This means everything we’re doing now is only applied to the active area defined by the mask. Go back to the classification tab and click again on classify. Now the classification should take place only within the nuclei:
(You can also activate the DAPI channel now in the image adjustment settings to see the DAPI stained nuclei under the segmentation objects.)
We finally managed to classify the stainings just in the nuclei using a segmentation mask!
- Hint: As an alternative to the segmentation mask you can also create a classification mask. Then the “main” classification is applied to active parts of the first classification model. For that, you have to define which classes are active. This can be done by defining them as ‘inclusion’ in the class setup (F4), or later of the model is already in the model explorer you can click on ‘configure’ within the model explorer menu. Note that the comment in the current version says ‘only for exclusion model’ but actually it’s for masks as well.