Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populate metadata Image dtype #184

Merged
merged 6 commits into from
Jun 25, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert previous commit. Test for ImageWrapper if needed
will-moore committed Jun 16, 2021
commit 1d54b11573e072e90b5bfd96bac526a6d0f8e999
25 changes: 12 additions & 13 deletions omero/import_scripts/Populate_Metadata.py
Original file line number Diff line number Diff line change
@@ -36,35 +36,28 @@
# Hopefully this will import
# https://github.com/ome/omero-metadata/blob/v0.3.1/src/populate_metadata.py
from omero_metadata.populate import ParsingContext
OBJECT_TYPES = [
OBJECT_TYPES = (
'Plate',
'Screen',
'Dataset',
'Project'
]
'Project',
'Image',
)
DEPRECATED = ""

except ImportError:
from omero.util.populate_metadata import ParsingContext
OBJECT_TYPES = [
OBJECT_TYPES = (
'Plate',
'Screen',
]
)
DEPRECATED = """
Warning: This script is using an outdated metadata plugin.
Ask your administrator to install the omero-metadata plugin
for additional features: https://pypi.org/project/omero-metadata/
"""

try:
# If we have omero-metadata v0.6.0 or later, can support 'Image' input
from omero_metadata.populate import ImageWrapper
OBJECT_TYPES.append('Image')
except ImportError:
pass

OBJECT_TYPES = tuple(OBJECT_TYPES)

def link_file_ann(conn, object_type, object_id, file_ann_id):
"""Link File Annotation to the Object, if not already linked."""
@@ -114,6 +107,12 @@ def populate_metadata(client, conn, script_params):
object_ids = script_params["IDs"]
object_id = object_ids[0]
data_type = script_params["Data_Type"]

if data_type == "Image":
try:
from omero_metadata.populate import ImageWrapper
except ImportError:
return "Please update omero-metadata to support Image type"
file_ann_id = None
if "File_Annotation" in script_params:
file_ann_id = int(script_params["File_Annotation"])