omero.util package¶
Submodules¶
- omero.util.OmeroPopo module
DataObjectEllipseDataImageDataMaskDataPolygonDataPolygonData.Angle2D()PolygonData.containsPoints()PolygonData.fromPoints()PolygonData.getBoundingRectangle()PolygonData.getContents()PolygonData.getMaskPoints()PolygonData.getPoints()PolygonData.getPoints1()PolygonData.getPoints2()PolygonData.getPointsString()PolygonData.inPolygon()PolygonData.parsePointsToList()PolygonData.parseShapeStringToPoints()PolygonData.setPointsFromList()PolygonData.setPointsString()PolygonData.toCoords()PolygonData.toString()
ROICoordinateROIDataRectDataShapeDataWorkflowDatashapeWrapper()toCSV()toList()
- omero.util.ROIDrawingUtils module
- omero.util.ROI_utils module
EllipseDataLineDataMaskDataPointDataPolygonDataPolylineDataROICoordinateROIDrawingIRectangleDataShapeDataShapeData.acceptVisitor()ShapeData.createBaseType()ShapeData.fromROI()ShapeData.getCoordFromROI()ShapeData.getGeometryFromROI()ShapeData.getROI()ShapeData.getShapeSettingsFromROI()ShapeData.setCoord()ShapeData.setROICoord()ShapeData.setROIGeometry()ShapeData.setROIShapeSettings()ShapeData.setShapeSettings()
ShapeSettingsDataabstract()pointsStringToXYlist()xyListToBbox()
- omero.util.cleanse module
- omero.util.concurrency module
- omero.util.decorators module
- omero.util.figureUtil module
- omero.util.imageUtil module
- omero.util.image_utils module
- omero.util.import_candidates module
- omero.util.importperf module
- omero.util.metadata_mapannotations module
- omero.util.metadata_utils module
BulkAnnotationConfigurationBulkAnnotationConfiguration.GROUPREQUIREDBulkAnnotationConfiguration.OPTIONALBulkAnnotationConfiguration.REQUIREDBulkAnnotationConfiguration.get_column_config()BulkAnnotationConfiguration.get_default_cfg()BulkAnnotationConfiguration.validate_column_config()BulkAnnotationConfiguration.validate_filled_column_config()BulkAnnotationConfiguration.validate_group_config()
GroupConfigKeyValueGroupListKeyValueListPassThroughKeyValueListTransformer
- omero.util.pixelstypetopython module
- omero.util.populate_metadata module
BulkToMapAnnotationContextDatasetWrapperDeleteMapAnnotationContextHeaderResolverHeaderResolver.DEFAULT_COLUMN_SIZEHeaderResolver.columns_sanity_check()HeaderResolver.create_columns()HeaderResolver.create_columns_dataset()HeaderResolver.create_columns_plate()HeaderResolver.create_columns_project()HeaderResolver.create_columns_screen()HeaderResolver.dataset_keysHeaderResolver.get_column_types()HeaderResolver.is_row_column_types()HeaderResolver.plate_keysHeaderResolver.project_keysHeaderResolver.screen_keys
ImageDataMetadataErrorPDIWrapperParsingContextPlateDataPlateWrapperProjectWrapperSPWWrapperScreenWrapperSkipValueResolverValueWrapperWellDataWellSampleDataget_config()parse_column_types()parse_target_object()usage()
- omero.util.populate_roi module
AbstractMeasurementCtxAbstractMeasurementCtx.ROI_UPDATE_LIMITAbstractMeasurementCtx.create_file_annotation()AbstractMeasurementCtx.get_name()AbstractMeasurementCtx.get_well_images()AbstractMeasurementCtx.image_from_original_file()AbstractMeasurementCtx.parse()AbstractMeasurementCtx.parse_and_populate()AbstractMeasurementCtx.parse_and_populate_roi()AbstractMeasurementCtx.populate()AbstractMeasurementCtx.update_rois()AbstractMeasurementCtx.update_table()
AbstractPlateAnalysisCtxAbstractPlateAnalysisCtx.DEFAULT_ORIGINAL_FILE_PROVIDERAbstractPlateAnalysisCtx.colrow_from_wellnumber()AbstractPlateAnalysisCtx.get_measurement_count()AbstractPlateAnalysisCtx.get_measurement_ctx()AbstractPlateAnalysisCtx.get_result_file_count()AbstractPlateAnalysisCtx.guess_geometry()AbstractPlateAnalysisCtx.image_from_wellnumber()AbstractPlateAnalysisCtx.is_this_type()
DownloadingOriginalFileProviderFlexMeasurementCtxFlexPlateAnalysisCtxInCellMeasurementCtxInCellMeasurementCtx.CELLS_CG_EXPECTEDInCellMeasurementCtx.CELLS_SOURCEInCellMeasurementCtx.NUCLEI_CG_EXPECTEDInCellMeasurementCtx.NUCLEI_SOURCEInCellMeasurementCtx.ORGANELLES_SOURCEInCellMeasurementCtx.check_sparse_data()InCellMeasurementCtx.get_name()InCellMeasurementCtx.parse()InCellMeasurementCtx.parse_and_populate_roi()InCellMeasurementCtx.populate()
InCellPlateAnalysisCtxMIASMeasurementCtxMIASMeasurementCtx.IMAGE_COLMIASMeasurementCtx.MNU_EXPECTEDMIASMeasurementCtx.NEO_EXPECTEDMIASMeasurementCtx.ROI_COLMIASMeasurementCtx.get_empty_columns()MIASMeasurementCtx.get_name()MIASMeasurementCtx.image_from_original_file()MIASMeasurementCtx.parse()MIASMeasurementCtx.parse_and_populate_roi()MIASMeasurementCtx.populate()
MIASPlateAnalysisCtxMIASPlateAnalysisCtx.companion_formatMIASPlateAnalysisCtx.datetime_formatMIASPlateAnalysisCtx.detail_regexMIASPlateAnalysisCtx.get_measurement_count()MIASPlateAnalysisCtx.get_measurement_ctx()MIASPlateAnalysisCtx.get_result_file_count()MIASPlateAnalysisCtx.is_this_type()MIASPlateAnalysisCtx.log_regex
MeasurementErrorMeasurementParsingResultPlateAnalysisCtxFactoryThreadPoolWorkerget_thread_pool()usage()
- omero.util.pydict_text_io module
- omero.util.roi_handling_utils module
- omero.util.script_utils module
- omero.util.sessions module
SessionsStoreSessionsStore.add()SessionsStore.attach()SessionsStore.available()SessionsStore.clear()SessionsStore.conflicts()SessionsStore.contents()SessionsStore.count()SessionsStore.create()SessionsStore.exists()SessionsStore.find_name_by_key()SessionsStore.get()SessionsStore.get_current()SessionsStore.host_file()SessionsStore.last_host()SessionsStore.last_port()SessionsStore.non_dot()SessionsStore.port_file()SessionsStore.props()SessionsStore.remove()SessionsStore.report()SessionsStore.sess_file()SessionsStore.set_current()SessionsStore.user_file()SessionsStore.walk()
- omero.util.temp_files module
- omero.util.text module
- omero.util.tiles module
- omero.util.upgrade_check module
Module contents¶
- class util.Dependency(key)[source]¶
Bases:
objectCentralized logic for declaring and logging a service dependency on a non-shipped library. This is called lazily from the run method of the application to give logging time to be initialized.
See #4566
- class util.Environment(*args)[source]¶
Bases:
objectSimple class for creating an executable environment
- class util.Resources(sleeptime=60, stop_event=None)[source]¶
Bases:
objectContainer class for storing resources which should be cleaned up on close and periodically checked. Use stop_event.set() to stop the internal thread.
- add(object, cleanupMethod='cleanup', checkMethod='check')¶
- checkAll(copy)[source]¶
While stop_event is unset, go through the copy of stuff and call the check method on each entry. Any that throws an exception or returns a False value will be returned in the remove list.
- cleanup()¶
- copyStuff()¶
Within a lock, copy the “stuff” list and reverse it. The list is reversed so that entries added later, which may depend on earlier added entries get a chance to be cleaned up first.
- removeAll(remove)¶
Finally, within another lock, call the “cleanup” method on all the entries in remove, and remove them from the official stuff list. (If stop_event is set during execution, we return with the assumption that Resources.cleanup() will take care of them)
- class util.Servant(ctx, needs_session=False)[source]¶
Bases:
SimpleServantAbstract servant which can be used along with a slice2py generated dispatch class as the base type of high-level servants. These provide resource cleanup as per the omero.util.Server class.
By passing “needs_session = True” to this constructor, an internal session will be created and stored in ServerContext as well as registered with self.resources
- class util.Server(*args: Any, **kwargs: Any)[source]¶
Bases:
ApplicationBasic server implementation which can be used for implementing a standalone python server which can be started from icegridnode.
The servant implementation MUST have a constructor which takes a single ServerContext argument AND have a cleanup() method
Logging is configured relative to the current directory to be in var/log by default.
Usage:
if __name__ == "__main__": app=Server( ServicesI, "ServicesAdapter", Ice.Identity("Services","")) sys.exit(app.main(sys.argv))
app.impl now points to an instance of ServicesI
- class util.ServerContext(server_id, communicator, stop_event, on_newsession=None)[source]¶
Bases:
objectContext passed to all servants.
server_id, communicator, and stop_event will be constructed by the top-level Server instance.
A context instance may also be configured to hold on to an internal session (ServiceFactoryPrx) and keep it alive.
This instance obeys the Resources API and calls sf.keepAlive(None) on every check call, but does nothing on cleanup. The sf instance must be manually cleaned as the final operation of a servant.
(Note: cleanup of the server context indicates server shutdown, so should be infrequent)
- add_servant(adapter_or_current, servant, ice_identity=None)¶
- check()[source]¶
Calls getSession() but always returns True. This keeps the context available in the resources for later uses, and tries to re-establish a connection in case Blitz goes down.
- cleanup()[source]¶
Does nothing. Context clean up must happen manually since later activities may want to reuse it. Servants using a server connection should cleanup the instance after Resources is cleaned up
- getSession(recreate=True)¶
Returns the ServiceFactoryPrx configured for the context if available. If the context was not configured for sessions, an ApiUsageException will be thrown: servants should know whether or not they were configured for sessions. See Servant(…, needs_session = True)
Otherwise, if there is no ServiceFactoryPrx, an attempt will be made to create one if recreate == True. If the value is None or non can be recreated, an InternalException will be thrown.
TODO : currently no arguments are provided for re-creating these, but also not in Servant.__init__
- class util.SimpleServant(ctx)[source]¶
Bases:
objectBase servant initialization. Doesn’t create or try to cleanup a top-level Resources thread. This is useful for large numbers of servants. For servers and other singleton-like servants, see “Servant”
- class util.StreamRedirect(logger)[source]¶
Bases:
objectSince all server components should exclusively using the logging module any output to stdout or stderr is caught and logged at “WARN”. This is useful, especially in the case of Windows, where stdout/stderr is eaten.
- util.configure_logging(logdir=None, logfile=None, loglevel=20, format='%(asctime)s %(levelname)-5.5s [%(name)40s] (%(threadName)-10s) %(message)s', filemode='a', maxBytes=500000000, backupCount=9, time_rollover=False)[source]¶
- util.configure_server_logging(props)[source]¶
Takes an Ice.Properties instance and configures logging
- util.get_omero_userdir()[source]¶
Returns the OMERO user directory
In 6.0.0 the default will change to use appdirs.user_data_dir. You can enable this behaviour now by setting OMERO_USERDIR=”” (empty string) instead of unset.
Note that files in the old user directory will not be migrated.
- util.get_user(default=None)[source]¶
Returns the username. For most purposes, this value will be the same as getpass.getuser on Unix and win32api.GetUserName on Windows, but in some situations (when running without a terminal, etc) getuser may throw a KeyError. In which case, or if the username resolves to False, the default value be returned.
Any unexpected exceptions will be thrown.
See ticket:6307
- util.internal_service_factory(communicator, user='root', group=None, retries=6, interval=10, client_uuid=None, stop_event=None)[source]¶
Try to return a ServiceFactory from the grid.
Try a number of times then give up and raise the last exception returned. This method will only work internally to the grid, i.e. behind the Glacier2 firewall. It is intended for internal servers to be able to create sessions for accessing the database.
communicator := Ice.Communicator used to find the registry user := Username which should have a session created group := Group into which the session should be logged retries := Number of session creation retries before throwing interval := Seconds between retries client_uuid := Uuid of the client which should be used
- util.load_dotted_class(dotted_class)[source]¶
Load a Python class of the form “pkg.mod.Class” via __import__ and return it. No ctor or similar is called.
- util.long_to_path(id, root='')[source]¶
Converts a long to a path such that for all directiories only a 1000 files and a 1000 subdirectories will be returned.
This method duplicates the logic in ome.io.nio.AbstractFileSystemService.java:getPath()