This article explores some of the ways a manually drawn region can be used in a pipeline
TL;DR
We can use both the Object Mask and Import document objects operations in a pipeline to make use of existing objects in a new pipeline.
Introduction
Document Vs Analysis object
While the pipeline concept in arivis makes it really efficient to create and process multitudes of objects, sometimes manually drawing objects is the fastest to create a region of interest.
To facilitate the creation of multiple pipelines while still maintaining some order the pipeline created objects (Analysis objects) are kept apart from those previously created and saved (Document objects). When we are running a pipeline we can switch between seeing the Document and Analysis objects using the toggle at the top of the Objects table:
Manually drawing objects while a pipeline is running is not supported as the associated tags for the objects are not part of the pipeline. But that is not to say that manually created objects can't be used in a pipeline.
Potential use cases for manually drawn objects
The most common reason we use manually drawn object regions in a pipeline is to limit the analysis to a specific portion of the image. To some extent we can do this using the Input ROI operation which is always first in the pipeline. However, the Input ROI is always a cuboid and we may be interested in measuring objects only within an irregular region of the image. For example, we may want to count cells in only this region of the image:
In the Input ROI operation we can limit what the pipeline has access to to match the bounds of the region we selected:
And we can do this for the planes as well if this is a 3D region. However, as mentioned above, this region will be a cuboid corresponding to the bounding box, not the irregular shape of the region. So in this case if we counted all the cells within the box we would not know specifically how many of those are within the drawn region.
Furthermore, the objects relationship to the region and the region's relationship to the objects might both need to be quantified. We may wish to know the distance of individual cells to the border of the region, or we may want to measure the numerical density (cells / unit volume). We might also want to use several regions simultaneously to compare statistics between the two. In this case having the object in the pipeline allows us to use the Compartments operation to measure such things.
Using an existing objects in the pipeline
First, note that while we are talking about manually drawn regions, this process also applies to any objects that have been previously stored in the documents. We can use the same process if these objects were created in another pipeline or imported from some other segmentation tools.
Masking
One way to use objects in the pipeline is to use the Object Mask operation.
The Object Mask will black out any pixel outside of the region while preserving the intensities inside:
This can be used to limit the analysis to only within the region since we can easily ignore any pixel with a value of 0, but such image processing can get in the way of several other operations we might want to use in a pipeline because of the artificially hard edge that is created.
Importing the document objects
As mentioned above, the pipeline can only use objects that exist in the context of the pipeline. We can use the Import Documents Object operation to impart these regions into the pipeline:
Once added to the pipeline we can select which objects to import. Note that the selection is based on tags. All objects with the selected tag will be imported in the pipeline. If we select no tag it will import every document object. In this case we are using the Manual tag, but any tag can be used. It is also possible to manually add tags to specific objects if we have multiple manual objects but want to be more specific.
When we run this operation the object will appear in the viewer and their tags will be available to other operations downstream of the pipeline.
We can then proceed with the rest of the pipeline.
For example, we can use the Compartments operation to identify which objects are either fully or partially overlapping the region, or even those within a certain proximity.