Package: napari-nD-annotator
napari-nD-annotatorA toolbox for annotating objects one by one in nD.This plugin contains some tools to make 2D/3D (and technically any dimensional) annotation easier.
Main features:auto-filling labelslabel slice interpolation (geometric mean, RPSV representation)minimal contour segmentationIf thenapari-bboxplugin is also installed (seeInstallation), you can alsolist objects annotated with bounding boxesvisualize selected objects from different projectionsThisnapariplugin was generated withCookiecutterusing@napari'scookiecutter-napari-plugintemplate.InstallationYou can installnapari-nD-annotatorviapip:pip install napari-nD-annotatorThe plugin is also available innapari-hub, to install it directly from napari, please refer toplugin installation instructionsat the officialnapariwebsite.Optional packagesThere are some functionalities which require additional Python packages.Bounding boxesThe bounding box and object list functionality requires thenapari-bboxPython package.
If you want to use these features, installnapari-bboxseparately either usingpipor directly from napari.
You can also install it together with this plugin:pip install napari-nD-annotator[bbox][!WARNING]
Thenapari-bboxplugin currently works only withnapari<=0.4.17. Do not install it with newer versions.Minimal surfaceTo use the minimal surface method, you will need theminimal-surfacePython package as well. Please install it usingpip:Separately:pip install minimal-surfaceOr bundled with the plugin:pip install napari-nD-annotator[ms][!WARNING]
Theminimal-surfacepackage is only available for Windows at the time. We are actively working on bringing it to Linux and Mac systems as well.If you would like to install all optional packages, usepip install napari-nD-annotator[all]If any problems occur during installation or while using the plugin, pleasefile an issue.UsageYou can start napari with the plugin's widgets already opened as:napari -w napari-nD-annotator "Object List" "Annotation Toolbox"Bounding boxesThe main idea is to create bounding boxes around objects we want to annotate, crop them, and annotate them one by one. This has mainly two advantages when visualizing in 3D:We don't have to load the whole data into memoryThe surrounding objects won't occlude the annotated ones, making it easier to check the annotation.Bounding boxes can be created from theObject listwidget. The dimensionality of the bounding box layer will be determined from the image layer. As bounding boxes are created, a small thumbnail will be displayed.The proposed pipeline goes as follows:Create a bounding box layerSelect data parts using the bounding boxesSelect an object from the object listAnnotate the objectRepeat from 3.Slice interpolationTheInterpolationtab contains tools for estimating missing annotation slices from existing ones. There are multiple options:Geometric: the interpolation will be determined by calculating the average of the corresponding contour points.RPSV: A more sophisticated average contour calculation, see the preprinthere.Distance-based: a signed distance transform is applied to the annotations. The missing slices will be filled in using their
weighted sum.Note: Geometric and RPSV interpolation works only when there's a single connected mask on each slice. If you want to
interpolate disjoint objects (e.g.dividing cells), use distance based interpolation instead.Note: Distance-based interpolation might give bad results if some masks are too far away from each other on the same slice
and there's a big offset compared to the other slice used in the interpolation. If you get unsatisfactory results, try
annotating more slices (skip less frames).https://user-images.githubusercontent.com/36735863/188876826-1771acee-93ba-4905-982e-bfb459329659.mp4Minimal contourThis plugin can estimate a minimal contour, which is calculated from a point set on the edges of the object, which are provided by the user. This contour will follow some kind of image feature (pixels with high gradient or high/low intensity).
Features:With a single click a new point can be added to the set. This will also extend the contour with the curve shown in redA double click will close the curve by adding both the red and gray curves to the minimal contourWhen holdingShift, the gray and red highlight will be swapped, so the other curve can be added to the contourWith theCtrlbutton down a straight line can be added instead of the minimal pathIf the anchor points were misplaced, the last point can be removed by right-clicking, or the whole point set can be cleared by pressingEscTheParamvalue at the widget will decide, how strongly should the contour follow edges on the image. Higher value means higher sensitivity to image data, while a lower value will be closer to straight lines.Different features can be used, like image gradient or pixel intensities, and also user-defined features (using Python)the image is accessed as theimagevariable, and the features should be stored in thefeaturesvariable in the small code editor widgetThis functionality can be used by selecting theMinimal Contourtab in theAnnotation Toolboxwidget, which will create a new layer calledAnchors.Warning: Do not remove theAnchorslayer!Warning: Some utility layers appear in the layer list when using the plugin. These are marked with a lock (:lock:) symbol.Do not remove them or modify their data, as this will most probably break the plugin!However, you can change their appearance,e.g.their color settings.Intensity-based:https://user-images.githubusercontent.com/36735863/191023482-0dfafb5c-003a-47f6-a21b-8582a4e3930f.mp4Gradient-based:https://user-images.githubusercontent.com/36735863/191024941-f20f63a0-8281-47d2-be22-d1ec34fe1f5d.mp4Custom feature:https://user-images.githubusercontent.com/36735863/191025028-3f807bd2-1f2e-40d2-800b-48af820a7dbe.mp4ShortcutsActionMouseKeyboardIncrement selected labelShift + Wheel ⬆️EDecrement selected labelShift + Wheel ⬇️QPrevious sliceCtrl + Wheel ⬆️*ANext sliceCtrl + Wheel ⬇️*DIncrease paint brush size of labels layerAlt + Wheel ⬆️WDecrease paint brush size of labels layerAlt + Wheel ⬇️SInterpolate-Ctrl+IChange between 'Anchors' and the labels layer-Ctrl+TabJump to layer#i-Ctrl+'i'***Built-in functionality ofnapari**i: 0-9Note: you can check the list of available shortcuts by clicking the?button in the bottom right corner of the main widget.LicenseDistributed under the terms of theBSD-3license,
"napari-nD-annotator" is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.