OMERO.RuleTagger (Previously Known as OMERO.Autotagger)
A Python package for automated tagging of OMERO objects based on customizable rules and regex.
It works by walking the omero model as described by the omero-py wrappers and the underlying ObjectI classes. After the walk it compares a given reference value against the value it walked to, then tags if the condition passes.
Known Limitations
- Currently impossible to add arguments to the model walk
- For example a you can't filter a condition to only check annotations in a certain namespace
- This example could be fixed by comparing the 'ns' property against the desired value, but it still won't filter
- Cannot specify objects to operate on within the rules file.
- Planned addition in schemav2 but wanted to get this out and get some feedback for schemav2
- Doesn't handle Annotations very well.
- This is because the omero-py package doesn't have getters for specific annotation types
- This causes AttributeErrors
- Map and Table Annotations especially need extra thought to be able to meaningfully rule against
- This is because the omero-py package doesn't have getters for specific annotation types
- Also doesn't handle properties
- Due to the compilation process, we need getters to access properties
- Could be possible to add with some lambda
- Decided to leave as is for now because most properties have a getter (thanks java!)
- Pretty slow and inefficient
- Makes more requests than it needs to
- Causes it to take longer than it needs to
- Decided to leave as is for readability sake
- We run it once a night, could probably do it once a week
- Both walking and recursion can get complex, tried my best to stay legible (unlike my first implementation)
Documentation
For a proper in-depth explanation of the tool use the documentation.
Installation
Install using pip:
pip install omero-ruletagger
Dependencies
- Python ≥3.8
- PyYAML
- inflect
- omero-py
Usage
Command Line Interface
The package provides three main commands:
- Validate rules:
omero-ruletagger validate rules.yml
- Apply tags:
omero-ruletagger run rules.yml -O "Image:123" -O "Dataset:456"
- Dry run:
omero-ruletagger dry-run rules.yml -O "Image:789" -o results.csv
Connection Options
-s,--server: OMERO server hostname-p,--port: OMERO server port-u,--user: OMERO username-w,--password: OMERO password-k,--key: Existing session key-S,--secure: Use secure connection--sudo: Connect as administrator-v,--verbose: Enable verbose logging
Rule Configuration
Create a YAML file defining your tagging rules. Example:
# test_rules.yml
- capture: "([^-.]+)"
blacklist:
- 1
- name: "FALSE"
rules:
- attribute_path: ["image", "roicount"]
operation: lt
value: 1
- name: "TRUE"
rules:
- attribute_path: ["image", "roi", "count"]
operation: gt
value: 0
- name: "Subtractive"
absolute: false
type: subtractive
rules:
- attribute_path: ["image", "roi","count"]
operation: gt
value: 0
- name: "UselessAND_TRUE"
rules:
- attribute_path: ["image", "roi", "shape", "strokecolor"]
operation: eq
value: 255
- attribute_path: ["image", "roi", "shape", "count"]
operation: eq
value: 1
- name: "InherentlyFalseAND"
rules:
- attribute_path: ["image", "roi", "shape", "strokecolor"]
operation: eq
value: 255
- attribute_path: ["image", "roi", "shape", "strokecolor"]
operation: eq
value: 254
- name: "DescriptionTest"
rules:
- attribute_path: ["image", "descriptions"]
operation: match
value: ".*test.*"
- name: "PhysicalSizeTest"
rules:
- attribute_path: ["image", "primarypixel", "physicalsizex"]
operation: eq
value: 1000
- attribute_path: ["image", "primarypixel", "physicalsizey"]
operation: eq
value: 1000
- attribute_path: ["image", "primarypixel", "physicalsizex", "unit", "name"]
operation: eq
value: "MICROMETER"
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE.txt file for details.
Links
Metadata
Release files for omero-ruletagger 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| omero_ruletagger-1.1.0.tar.gz | 26.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| omero_ruletagger-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.1 kB
Release files / omero_ruletagger-1.1.0.tar.gz
| Download URL | omero_ruletagger-1.1.0.tar.gz |
|---|---|
| Size | 26.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16052d5e3072af726a231d0e5ee2cac3eb601dd1d251fd58fab8859c349e5571
|
|
BLAKE2b-256 checksum How to use checksums |
1f0d610f265bc86a3aba5155f6619523642f26c2b99e34e505cdb9ef1c0170d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logRelease files / omero_ruletagger-1.1.0-py3-none-any.whl
| Download URL | omero_ruletagger-1.1.0-py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9f0904ef1e7699452e521c7417faffab7db1a80301aee92765fb684da00753b
|
|
BLAKE2b-256 checksum How to use checksums |
730b61d02a758349ffc5993713459d29c8ebb245da111e36e391659a7eb6f7a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency log