We provide the R package rhizoTrakAddons
to assist in analyzing and processing csv files generated by rhizoTrak.
Specifically the package aims at the analysis of csv files generated by rhizoTraks in ’Detailed Mode’.
Detailed documentation is included in the vignette of the package.
It may be download from this
file or in near future installed from CRAN.
In rhizoTrak you can aid the manual annotation process through an automatic segmentation. This automatic segmentation is performed by a MiToBo operator. MiToBo is a Java toolbox and programming environment for image processing and analysis algorithms deeply linked to ImageJ and Fiji. To learn more about MiToBo’s basic concepts of operators and how to implement your own operators, take a look at MiToBo’s User Guide. In addition, MiToBo’s Javadoc API gives you an overview of its functionality and more details about the programming interface.
For adding segmentation functionality to rhizoTrak an existing segmentation operator can be used or an own operator can be implemented. Every segmentation operator takes an image or several images as an input and returns the segmentation.
To get a good, i.e. useful, segmentation the operator has to fit the data and their specific characteristic. In some applications the existing operators do not perform well. Then it may be a good choice to write an own implementation of a segmentation operator. The following guide explains the parameters of the interface.
The class RootImageSegmentationOperator
(in package de.unihalle.informatik.MiToBo.apps.minirhizotron.segmentation)
is the interface for the operator. Therefore every operator has to extend this RootImageSegmentationOperator
class.
Input images, existing treelines and meta data are hash maps with an integer key corresponding to the layerID and entries are of respective data type. inputImages
are of type ImagePlus
and inputTreelines
are different MTBRootTree
stored in a vector. The type of layerMetadata
is RhizoProjectLayerMetadataContainer
.
The operator configuration defines the interaction with the rhizoTrak GUI.
The class RootImageSegmentationOperator
has three different OpWorkingMode
: SEGMENTATION_CREATE
, SEGMENTATION_UPDATE
and SEGMENTATION_CREATE_AND_UPDATE
. The choosen operator working modus is passed via getOperatorWorkingMode()
to rhizoTrak where the treelines are drawn.
For different working modi different options can be configured:
SEGMENTATION_CREATE
In create modus the result treelines of the operator are added. When adding in rhizoTrak one status can be choosen for all treelines.SEGMENTATION_UPDATE
In this modus the result treelines of the operator modify the existing treelines in rhizoTrak. Treelines can be deleted or transformed. When updating in rhizoTrak the status and/or diameter of the existing treelines can be modified (true
) or preserved (false
). The flag is set in the method isToTransferStatusOnUpdate()
, respectively isToTransferDiameterOnUpdate()
.SEGMENTATION_CREATE_AND_UPDATE
The third modus is a combination of the two previous ones. First, treelines are updated while status and/or diameter can be preserved. Then, remaining treelines are added if there are any.Choosing the layers to analyze, respectively images and treelines, a LayerSubset
is given to select between ACTIVE
, PREVIOUS
, NEXT
, ALL
, FIRST_TO_PREVIOUS
and NEXT_TO_LAST
.
The operator specific EnumSet
of different LayerSubset
is programmed by overriding the methods getLayerSubsetForInputImages()
and getLayerSubsetForInputTreelines()
. The user can choose via this EnumSet
which input images and treelines to analyze.
In addition it can be choosen to get only selected treelines (getOnlySelectedTreelines()
).
The operator configuration will be described in more detail in the section Template project for developing operators.
The operator returns the segmentation results as treelines of type MTBRootTree
. If used within rhizoTrak, the results will be imported.
The output parameter resultTreelines
is of type HashMap<Integer, Vector<MTBRootTree>>
.
Integer
identifies the layerID.Vector<MTBRootTree>
gives all treelines per layer.A treeline consists of nodes of type MTBTreeNode
with the data class MTBRootTreeNodeData
, storing e.g. x and position, as well as radius and status.
For a quick start in operator development we provide a pre-configured Maven project.
It can be downloaded from our Github repository.
To setup the project clone the repository to a folder of your choice.
In the sub-folder src/main/java/rhizoTrak/segmentation
of the project you can find the dummy segmentation operator class
RhizoTrakDummySegmentationDemo.java which you can use as template for your own implementation.
Note that the operator just creates some arbitrary treelines and only uses the width and height of the actual input image - it’s really just a dummy.
Some important notes regarding the demo operator:
RootImageSegmentationOperator
and you need to add the annotation @ALDDerivedClass
to your class definition, otherwise rhizoTrak will not be able to find your new operatoroperate()
method is the method called from rhizoTrak to invoke your operator; at the time of invocation you can assume that the member variable this.inputImages
inherited from the parent class contains the current image to be processedMTBRootTreeNodeData
MTBRootTree
giving the root node of type MTBTreeNode
addChild(MTBTreeNode t)
getUniqueClassIdentifier()
to allow rhizoTrak to index objects of this class; choose a unique and comprehensive string as identifier@Override
the operator methods - will be explained more detailed in the following linesLayerSubset
identifiers are givenLayerSubset
identifier is returned as this operator only creates a treeline and does not operate on existing treelinestrue
only treelines selected by the user are provided, otherwise all treelines are passed to the operatortrue
, diameter, respectively status, of result treelines is modified when updating in rhizoTrak. Otherwise the existing diameters/status labels of treelines are preserved.To install your new operator in rhizoTrak you need to build a jar archive containing the class file of your new operator class.
The easiest way to build such a jar is to run mvn package
on the command line in your project.
Afterwards you can find the jar file in the sub-folder target
of your project. Just copy the jar file to the jars
folder of your local Fiji installation and restart Fiji. When you run rhizoTrak then your new operator should appear in the list of available detection operators in rhizoTrak.