Manipulate metadata and annotations#
This section describes how to manipulate metadata and annotations in DataLab.
Image metadata contains various information about the image or its representation, such as view settings, Regions Of Interest (ROIs), processing chain history, analysis results, and any other information that you may have added to the metadata of an image (or that comes from the image file itself).
See also
For more information about Regions Of Interest (ROIs), see the Regions Of Interest (ROI) section.
Screenshot of the “Edit” menu.#
The “Edit” menu allows you to perform classic editing operations on the current image or group of images (create/rename group, move up/down, delete image/group of images, etc.).
As detailed below, it also allows you to:
Navigate and utilize the processing chain history through actions like “Recompute” and “Select source objects”.
Manipulate metadata and annotations associated with the current image, thanks to the “Metadata” and “Annotations” submenus which provide the following features.
Recompute#
The “Recompute” action allows you to recompute the selected image(s) using
their original processing parameters. This is useful when you want to re-execute the
processing chain that was used to create an image, for example after modifying global
settings or dependencies.
It also refreshes analysis results (statistics, FWHM, centroid, peak/contour/blob detection, etc.) using their stored parameters. Analysis results are not recomputed automatically when you modify a region of interest, the data, or object properties: existing results are left untouched until you explicitly trigger this action, giving you full control over when analyses are refreshed.
Note
This action is enabled as soon as an image or a group is selected, but it only applies to images that have stored processing parameters (created through processing operations) or stored analysis parameters (analysis operations previously run on them). When none of the selected images has such parameters, an information message is displayed.
Select source objects#
The “Select source objects” action allows you to select the source
object(s) that were used to create the currently selected image. This helps trace
back the processing history and understand which original images were used as input
for the current result.
Note
This action is enabled when exactly one image is selected. When that image has no source object references, an information message is displayed.
Metadata#
Screenshot of the “Metadata” submenu.#
Copy/paste metadata#
As metadata contains useful information about the image, it can be copied and pasted
from one image to another by selecting the “Copy metadata” and
“Paste metadata”
actions in the “Edit” menu.
This feature allows you to tranfer those information from one image to another:
Regions Of Interest (ROIs): that is a very efficient way to reuse the same ROI on different images and easily compare the results of the analysis on those images
Analyze results, such as a centroid position or a contour detection (the relevance of transferring such information depends on the context and is up to the user to decide)
Any other information that you may have added to the metadata of an image
Note
Copying metadata from an image to another will overwrite the metadata of the destination image (for the metadata keys that are common to both images) or simply add the metadata keys that are not present in the destination image.
When pasting metadata, a dialog box allows you to select which metadata categories to keep from the clipboard. Annotations are copied and pasted separately:
Screenshot of the “Paste metadata” dialog.#
Import/export metadata#
Metadata can also be imported and exported from/to a JSON file using the “Import
metadata” and “Export metadata”
actions in the
“Edit” menu. This is exactly the same as the copy/paste metadata feature (see above
for more details on the use cases of this feature), but it allows you to save the
metadata to a file and then import it back later.
Delete object metadata#
When deleting metadata using the “Delete object metadata” action in the
“Edit” menu, you will be prompted to confirm the deletion of Region of Interests (ROIs)
if they are present in the metadata. After this eventual confirmation, the metadata
will be deleted, meaning that analysis results, ROIs, and any other information
associated with the image will be lost.
Add metadata#
The “Add metadata” action allows you to add custom metadata items to
one or more selected images. This is useful for tagging images with experiment IDs,
sample names, processing steps, or any other custom information.
Add metadata dialog.#
When you select “Add metadata…” from the Edit menu, a dialog appears where you can:
Metadata key: Enter the name of the metadata field to add (letters, digits,
_,.and-, e.g. a plugin key such asplugin.org.example.my-plugin.gain)Known keys: Pick a key already present on the selected images, or a key expected by the methods of the installed application plugins, to copy it into the metadata key
Value pattern: Define a pattern for the metadata value using Python format strings
Extraction pattern: Optionally, extract the value from the formatted text with a Python regular expression: its first group, or the whole match if it has no group, becomes the value
If no match: Leave images without a match unchanged (default), or report an error
Conversion: Choose how to store the value (string, float, integer, or boolean)
Scale factor: Multiply numeric values, e.g.
0.001to convert milliseconds to secondsPreview: See how the metadata will be added to each selected image, and which images are left unchanged
The value pattern supports the following placeholders:
{title}: Image title{index}: 1-based index of the image in the selection{count}: Total number of selected images{xlabel},{xunit},{ylabel},{yunit}: Axis labels and units{metadata[key]}: Access existing metadata values
You can also use format modifiers:
{title:upper}: Convert to uppercase{title:lower}: Convert to lowercase{index:03d}: Format as 3-digit number with leading zeros
Examples:
Add acquisition number: key=``acquisition``, pattern=``ACQ_{index:04d}``, conversion=string → Creates metadata like
acquisition="ACQ_0001"Add exposure time: key=``exposure_ms``, pattern=``{metadata[exposure]}``, conversion=float → Copies exposure from existing metadata and converts to float
Flag calibrated images: key=``is_calibrated``, pattern=``true``, conversion=bool → Sets
is_calibrated=Truefor all selected imagesRead exposure times from titles: key=``exposure_time_s``, pattern=``{title}``, extraction=``([d.]+)s*ms``, conversion=float, scale factor=``0.001`` → Sets
exposure_time_s=0.005on an image titled “Flat 5 ms 01” and leaves “Dark 01” unchanged
Annotations#
Annotations are visual elements that can be added to images to highlight specific features, mark regions of interest, or add explanatory notes. DataLab provides a dedicated submenu in the “Edit” menu for managing annotations.
Screenshot of the “Annotations” submenu.#
Copy/paste annotations#
Annotations can be copied from one image and pasted to one or more other images
using the “Copy annotations” and “Paste annotations”
actions. This is useful when you want to apply the same visual markers across multiple
images.
The “Paste annotations” action is only enabled when there are annotations in the clipboard (i.e., after using “Copy annotations”).
Edit annotations#
The “Edit annotations” action opens a dialog where you can view,
add, modify, or remove annotations from the current image. This provides a visual
way to manage all annotations on an image.
Import/export annotations#
Annotations can be saved to and loaded from JSON files (.dlabann extension) using
the “Import annotations” and “Export annotations”
actions. This allows you to:
Save annotation sets for later reuse
Share annotations with colleagues
Archive annotations separately from image data
Apply the same annotations to different images across sessions
The “Export annotations” action is only available when the selected image has annotations.
Delete annotations#
The “Delete annotations” action removes all annotations from the
selected image(s). This action is only enabled when the selected image(s) have
annotations.
Note
Annotations are stored separately from metadata and analysis results. Deleting annotations does not affect ROIs or other metadata items.
Image titles#
Image titles may be considered as metadata from a user point of view, even if they are not stored in the metadata of the image (but in an attribute of the image object).
The “Edit” menu allows you to:
“Insert object title as annotation label”: this action will add a label on top of the image with its title, which might be useful in combination with the “Distribute on a grid” operation (see Processing Images) to easily identify the images.
“Copy titles to clipboard”
: this action will copy the titles of the selected images to the clipboard, which might be useful to paste them in a text editor or in a spreadsheet.
Example of the content of the clipboard (titles of processed images refer to their sources by the first 8 characters of their unique identifier, prefixed by “g” for groups):
Raw images Gauss(a=10,μ=0,σ=1,x0=0,y0=0) moving_median(9f53944b)|size=5, mode=nearest fft(76e4ce1b) log10(g9f72bd95) log10(9f53944b) log10(76e4ce1b) log10(1462f722)