Class Utils
java.lang.Object
qupath.ext.biop.servers.omero.raw.utils.Utils
Utils class regrouping tools that are not restricted to OMERO.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static File
buildCSVFileFromListsOfStrings
(LinkedHashMap<String, List<String>> parentTable, String name) Convert a map into a CSV fileprotected static File
buildCSVFileFromMeasurementTable
(Collection<qupath.lib.objects.PathObject> pathObjects, qupath.lib.gui.measure.ObservableMeasurementTableData ob, long imageId, String name) Convert a QuPath measurement table into a CSV file, including the OMERO image ID on which the measurements are referring to.protected static void
buildListsOfStringsFromMeasurementTable
(LinkedHashMap<String, List<String>> parentTable, qupath.lib.gui.measure.ObservableMeasurementTableData ob, Collection<qupath.lib.objects.PathObject> pathObjects, long imageId) Populate a map with new measurements coming from a measurement table of new pathObjects.protected static omero.gateway.model.TableData
buildOmeroTableFromListsOfStrings
(LinkedHashMap<String, List<String>> parentTable, OmeroRawClient client) Convert a map into an OMERO.tableprotected static omero.gateway.model.TableData
buildOmeroTableFromMeasurementTable
(Collection<qupath.lib.objects.PathObject> pathObjects, qupath.lib.gui.measure.ObservableMeasurementTableData ob, fr.igred.omero.repository.ImageWrapper imageWrapper) Convert a QuPath measurement table to an OMERO tableprotected static boolean
checkUniqueKeyInAnnotationMap
(List<omero.model.NamedValue> keyValues) Try to solve an error in OMERO regarding the keys creation.convertMapAnnotationWrapperToMap
(fr.igred.omero.annotations.MapAnnotationWrapper mapAnnotationWrapper) Utils to convert the MapAnnotationWrapper object into a map of the OMERO key-valuesprotected static File
createAndSaveFile
(String path, String content) Create a file in the given path, with the given content, and save itstatic void
Error Logger to inform in QuPath GUI and / or in the logger windowstatic void
Error Logger to inform in QuPath GUI and / or in the logger windowprotected static fr.igred.omero.annotations.MapAnnotationWrapper
flattenMapAnnotationWrapperList
(List<fr.igred.omero.annotations.MapAnnotationWrapper> mapAnnotationWrappers) Create one single MapAnnotationWrapper object from a list of themstatic String
static String
static void
Info Logger to inform in QuPath GUI and / or in the logger windowstatic void
Info Logger to inform in QuPath GUI and / or in the logger windowSplits the "target" map into two parts : one part containing key/values that are referenced in the "reference" map and the other containing remaining key/values that are not referenced in the "reference".static void
Warning Logger to inform in QuPath GUI and / or in the logger windowstatic void
Warning Logger to inform in QuPath GUI and / or in the logger window
-
Field Details
-
ALL_USERS
- See Also:
-
TAG_KEY
- See Also:
-
KVP_KEY
- See Also:
-
NEW_KVP
- See Also:
-
EXISTING_KVP
- See Also:
-
NO_IMAGE_THUMBNAIL
- See Also:
-
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
getCurrentDateAndHour
- Returns:
- formatted date
-
getErrorStackTraceAsString
- Parameters:
e
- the exception- Returns:
- the exception stack trace as a formatted string
-
infoLog
Info Logger to inform in QuPath GUI and / or in the logger window- Parameters:
title
- notification titlemessage
- notification messageqpNotif
- true to display a QuPath notification
-
infoLog
public static void infoLog(org.slf4j.Logger logger, String title, String message, Exception e, boolean qpNotif) Info Logger to inform in QuPath GUI and / or in the logger window- Parameters:
title
- notification titlemessage
- notification messagee
- the exceptionqpNotif
- true to display a QuPath notification
-
errorLog
Error Logger to inform in QuPath GUI and / or in the logger window- Parameters:
title
- notification titlemessage
- notification messageqpNotif
- true to display a QuPath notification
-
errorLog
public static void errorLog(org.slf4j.Logger logger, String title, String message, Exception e, boolean qpNotif) Error Logger to inform in QuPath GUI and / or in the logger window- Parameters:
title
- notification titlemessage
- notification messagee
- the exceptionqpNotif
- true to display a QuPath notification
-
warnLog
Warning Logger to inform in QuPath GUI and / or in the logger window- Parameters:
title
- notification titlemessage
- notification messageqpNotif
- true to display a QuPath notification
-
warnLog
public static void warnLog(org.slf4j.Logger logger, String title, String message, Exception e, boolean qpNotif) Warning Logger to inform in QuPath GUI and / or in the logger window- Parameters:
title
- notification titlemessage
- notification messagee
- the exceptionqpNotif
- true to display a QuPath notification
-
splitNewAndExistingKeyValues
public static Map<String,Map<String, splitNewAndExistingKeyValuesString>> (Map<String, String> reference, Map<String, String> target) Splits the "target" map into two parts : one part containing key/values that are referenced in the "reference" map and the other containing remaining key/values that are not referenced in the "reference".- The new key values can be accessed with
NEW_KVP
key - The existing key values can be accessed with
EXISTING_KVP
key
- Parameters:
reference
- map of referenced key-value pairstarget
- map of new key-value pairs that should be checked against the referenced ones- Returns:
- Map of new kvp and existing kvp maps
- The new key values can be accessed with
-
checkUniqueKeyInAnnotationMap
Try to solve an error in OMERO regarding the keys creation. On OMERO, it is possible to have two identical keys with a different value. This should normally never append. This method checks if all keys are unique and output false if there is at least two identical keys.- Parameters:
keyValues
- to check- Returns:
- true if all keys unique ; false otherwise
-
convertMapAnnotationWrapperToMap
protected static Map<String,String> convertMapAnnotationWrapperToMap(fr.igred.omero.annotations.MapAnnotationWrapper mapAnnotationWrapper) Utils to convert the MapAnnotationWrapper object into a map of the OMERO key-values- Parameters:
mapAnnotationWrapper
-- Returns:
-
flattenMapAnnotationWrapperList
protected static fr.igred.omero.annotations.MapAnnotationWrapper flattenMapAnnotationWrapperList(List<fr.igred.omero.annotations.MapAnnotationWrapper> mapAnnotationWrappers) Create one single MapAnnotationWrapper object from a list of them- Parameters:
mapAnnotationWrappers
-- Returns:
-
buildCSVFileFromListsOfStrings
protected static File buildCSVFileFromListsOfStrings(LinkedHashMap<String, List<String>> parentTable, String name) Convert a map into a CSV file- Parameters:
parentTable
- the map containing headers and valuesname
- file name without the extension.- Returns:
- the saved CSV file
-
buildOmeroTableFromListsOfStrings
protected static omero.gateway.model.TableData buildOmeroTableFromListsOfStrings(LinkedHashMap<String, List<String>> parentTable, OmeroRawClient client) Convert a map into an OMERO.table- Parameters:
parentTable
- the map containing headers and valuesclient
- the client that handles the OMERO connection- Returns:
- the OMERO table
-
buildCSVFileFromMeasurementTable
protected static File buildCSVFileFromMeasurementTable(Collection<qupath.lib.objects.PathObject> pathObjects, qupath.lib.gui.measure.ObservableMeasurementTableData ob, long imageId, String name) Convert a QuPath measurement table into a CSV file, including the OMERO image ID on which the measurements are referring to.- Parameters:
pathObjects
- QuPath annotations or detections objectsob
- QuPath Measurements table for the current imageimageId
- the id of the current imagename
- file name- Returns:
- CSV file of measurement table.
-
buildOmeroTableFromMeasurementTable
protected static omero.gateway.model.TableData buildOmeroTableFromMeasurementTable(Collection<qupath.lib.objects.PathObject> pathObjects, qupath.lib.gui.measure.ObservableMeasurementTableData ob, fr.igred.omero.repository.ImageWrapper imageWrapper) Convert a QuPath measurement table to an OMERO table- Parameters:
pathObjects
- QuPath annotations or detections objectsob
- QuPath Measurements table for the current imageimageWrapper
- current OMERO image object- Returns:
- The corresponding OMERO.Table
-
buildListsOfStringsFromMeasurementTable
protected static void buildListsOfStringsFromMeasurementTable(LinkedHashMap<String, List<String>> parentTable, qupath.lib.gui.measure.ObservableMeasurementTableData ob, Collection<qupath.lib.objects.PathObject> pathObjects, long imageId) Populate a map with new measurements coming from a measurement table of new pathObjects.- Parameters:
parentTable
- LinkedHashMap to populate. Other type of maps will not workob
- QuPath Measurements table for the current imagepathObjects
- QuPath annotations or detections objectsimageId
- OMERO ID of the current image
-
createAndSaveFile
Create a file in the given path, with the given content, and save it- Parameters:
path
- location + filename of the pathcontent
- file content- Returns:
- the saved file
-