From 2c4d0ea355c4e5d83fb97b2e0c4b1cb778ed6076 Mon Sep 17 00:00:00 2001 From: William Moore Date: Wed, 24 Feb 2021 15:02:09 +0000 Subject: [PATCH 1/6] Add 'Image' to OBJECT_TYPES --- omero/import_scripts/Populate_Metadata.py | 1 + 1 file changed, 1 insertion(+) diff --git a/omero/import_scripts/Populate_Metadata.py b/omero/import_scripts/Populate_Metadata.py index 874bf9f39..4cf68a405 100644 --- a/omero/import_scripts/Populate_Metadata.py +++ b/omero/import_scripts/Populate_Metadata.py @@ -41,6 +41,7 @@ 'Screen', 'Dataset', 'Project', + 'Image', ) DEPRECATED = "" From 6ffeb46294e6096b3477c85905cd51090e95a2d3 Mon Sep 17 00:00:00 2001 From: William Moore Date: Fri, 19 Mar 2021 16:36:00 +0000 Subject: [PATCH 2/6] Update Populate_Metadata description to mention ROIs --- omero/import_scripts/Populate_Metadata.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/omero/import_scripts/Populate_Metadata.py b/omero/import_scripts/Populate_Metadata.py index 4cf68a405..02d7e5fdc 100644 --- a/omero/import_scripts/Populate_Metadata.py +++ b/omero/import_scripts/Populate_Metadata.py @@ -137,11 +137,11 @@ def run_script(): client = scripts.client( 'Populate_Metadata.py', """ - This script processes a CSV file, attached to a container, - converting it to an OMERO.table, with one row per Image or Well. + This script processes a CSV file, using it to, + 'populate' an OMERO.table, with one row per Image, Well or ROI. The table data can then be displayed in the OMERO clients. For full details of the supported CSV format, see - https://github.com/ome/omero-metadata/ + https://github.com/ome/omero-metadata/#populate """ + DEPRECATED, scripts.String( "Data_Type", optional=False, grouping="1", From ffb5050b3496f33929c2a046208efa614e780223 Mon Sep 17 00:00:00 2001 From: Will Moore Date: Mon, 22 Mar 2021 09:21:15 +0000 Subject: [PATCH 3/6] Update omero/import_scripts/Populate_Metadata.py Co-authored-by: Josh Moore --- omero/import_scripts/Populate_Metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omero/import_scripts/Populate_Metadata.py b/omero/import_scripts/Populate_Metadata.py index 02d7e5fdc..ef062d2e6 100644 --- a/omero/import_scripts/Populate_Metadata.py +++ b/omero/import_scripts/Populate_Metadata.py @@ -137,7 +137,7 @@ def run_script(): client = scripts.client( 'Populate_Metadata.py', """ - This script processes a CSV file, using it to, + This script processes a CSV file, using it to 'populate' an OMERO.table, with one row per Image, Well or ROI. The table data can then be displayed in the OMERO clients. For full details of the supported CSV format, see From 5f955c8e48436be533b4ac7a14b38f7d6ea90c64 Mon Sep 17 00:00:00 2001 From: William Moore Date: Wed, 16 Jun 2021 12:18:47 +0100 Subject: [PATCH 4/6] Test for Image support from omero-metadata --- omero/import_scripts/Populate_Metadata.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/omero/import_scripts/Populate_Metadata.py b/omero/import_scripts/Populate_Metadata.py index ef062d2e6..80b4d9efb 100644 --- a/omero/import_scripts/Populate_Metadata.py +++ b/omero/import_scripts/Populate_Metadata.py @@ -36,21 +36,20 @@ # 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', - 'Image', - ) + 'Project' + ] 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. @@ -58,6 +57,14 @@ 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.""" From 1d54b11573e072e90b5bfd96bac526a6d0f8e999 Mon Sep 17 00:00:00 2001 From: William Moore Date: Wed, 16 Jun 2021 12:32:59 +0100 Subject: [PATCH 5/6] Revert previous commit. Test for ImageWrapper if needed --- omero/import_scripts/Populate_Metadata.py | 25 +++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/omero/import_scripts/Populate_Metadata.py b/omero/import_scripts/Populate_Metadata.py index 80b4d9efb..37f5b0651 100644 --- a/omero/import_scripts/Populate_Metadata.py +++ b/omero/import_scripts/Populate_Metadata.py @@ -36,20 +36,21 @@ # 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. @@ -57,14 +58,6 @@ 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"]) From b30a032a22cc054b90cf30709ed24dfd99662ed8 Mon Sep 17 00:00:00 2001 From: William Moore Date: Wed, 16 Jun 2021 15:39:12 +0100 Subject: [PATCH 6/6] noqa for import ImageWrapper --- omero/import_scripts/Populate_Metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omero/import_scripts/Populate_Metadata.py b/omero/import_scripts/Populate_Metadata.py index 37f5b0651..f6c820c7d 100644 --- a/omero/import_scripts/Populate_Metadata.py +++ b/omero/import_scripts/Populate_Metadata.py @@ -110,7 +110,7 @@ def populate_metadata(client, conn, script_params): if data_type == "Image": try: - from omero_metadata.populate import ImageWrapper + from omero_metadata.populate import ImageWrapper # noqa: F401 except ImportError: return "Please update omero-metadata to support Image type" file_ann_id = None