omero.util.populate_roi module¶
…
- class util.populate_roi.AbstractMeasurementCtx(analysis_ctx, service_factory, original_file_provider, original_file, result_files)[source]¶
Bases:
object
Abstract class which aggregates and represents all the results produced from a given measurement run. It also provides a scaffold for interacting with the OmeroTables infrastructure.
- ROI_UPDATE_LIMIT = 1000¶
- create_file_annotation(set_of_columns)[source]¶
Creates a file annotation to represent a set of columns from our measurment.
- get_well_images(row, col)[source]¶
Takes a row and a col index and returns a tuple of Well and image. Either might be None. Uses the first image found to find the Well and therefore must be loaded (image->wellSample->well)
- image_from_original_file(original_file)[source]¶
Returns the image from which an original file has originated.
- parse_and_populate()[source]¶
Calls parse and populate, updating the OmeroTables instance backing our results and the OMERO database itself.
- parse_and_populate_roi(columns)[source]¶
Parses and populates ROI from column data in the OMERO database.
- class util.populate_roi.AbstractPlateAnalysisCtx(images, original_files, original_file_image_map, plate_id, service_factory)[source]¶
Bases:
object
Abstract class which aggregates and represents all measurement runs made on a given Plate.
- DEFAULT_ORIGINAL_FILE_PROVIDER¶
alias of
DownloadingOriginalFileProvider
- class util.populate_roi.DownloadingOriginalFileProvider(service_factory)[source]¶
Bases:
object
Provides original file data by downloading it from an OMERO raw file store.
- BUFFER_SIZE = 1048576¶
- class util.populate_roi.FlexMeasurementCtx(analysis_ctx, service_factory, original_file_provider, original_file, result_files)[source]¶
Bases:
AbstractMeasurementCtx
Flex measurements are located deep within a “.res” XML file container and contain no ROI.
- AREA_XPATH = './/Areas/Area'¶
- PARAMETER_XPATH = './/Wells/ResultParameters/Parameter'¶
- RESULT_XPATH = './/Result'¶
- WELL_XPATH = './/Wells/Well'¶
- get_empty_columns(headers)[source]¶
Retrieves a set of empty OmeroTables columns for the analysis results prefixed by a WellColumn to handle linked object indexes.
- class util.populate_roi.FlexPlateAnalysisCtx(images, original_files, original_file_image_map, plate_id, service_factory)[source]¶
Bases:
AbstractPlateAnalysisCtx
Flex dataset concrete class implementation of an analysis context. Flex measurements are aggregated in a single “.res” XML file and contain no ROI.
- companion_format = 'Companion/Flex'¶
- class util.populate_roi.InCellMeasurementCtx(analysis_ctx, service_factory, original_file_provider, original_file, result_files)[source]¶
Bases:
AbstractMeasurementCtx
InCell Analyzer measurements are located deep within an XML file container.
- CELLS_CG_EXPECTED = ['Cell: cgX', 'Cell: cgY']¶
- CELLS_SOURCE = 'Cells'¶
- NUCLEI_CG_EXPECTED = ['Nucleus: cgX', 'Nucleus: cgY']¶
- NUCLEI_SOURCE = 'Nuclei'¶
- ORGANELLES_SOURCE = 'Organelles'¶
- check_sparse_data(columns)[source]¶
Checks a set of columns for sparse data (one column shorter than the rest) and adds -1 where appropriate.
- class util.populate_roi.InCellPlateAnalysisCtx(images, original_files, original_file_image_map, plate_id, service_factory)[source]¶
Bases:
AbstractPlateAnalysisCtx
InCell dataset concrete class implementation of an analysis context. InCell measurements are from InCell Analyzer and are aggregated in a single gargantuan (often larger than 100MB per plate) XML file.
- companion_format = 'Companion/InCell'¶
- class util.populate_roi.MIASMeasurementCtx(analysis_ctx, service_factory, original_file_provider, original_file, result_files)[source]¶
Bases:
AbstractMeasurementCtx
MIAS measurements are a set of tab delimited text files per well. Each TSV file’s content is prefixed by the analysis parameters.
- IMAGE_COL = 0¶
- MNU_EXPECTED = ('Image', 'ROI', 'row', 'col', 'type')¶
- NEO_EXPECTED = ('Image', 'ROI', 'Label', 'Row', 'Col', 'Nucleus Area', 'Cell Diam.', 'Cell Type', 'Mean Nucleus Intens.')¶
- ROI_COL = 1¶
- get_empty_columns(n_columns)[source]¶
Retrieves a set of empty OmeroTables columns for the analysis results prefixed by an ImageColumn and RoiColumn to handle these linked object indexes.
- image_from_original_file(original_file)[source]¶
Overriding the abstract implementation since the companion files are no longer attached to the images, but only to the plate for MIAS. Instead, we use the filename itself to find the image.
- parse_and_populate_roi(columns)[source]¶
Parses and populates ROI from column data in the OMERO database.
- populate(columns)[source]¶
Query performed:
first_roi = columns[self.ROI_COL].values[0] first_roi = self.query_service.findByQuery( 'select roi from Roi as roi ' 'join fetch roi.annotationLinks as link ' 'join fetch link.child ' 'where roi.id = %d' % first_roi, None) self.file_annotation = first_roi.copyAnnotationLinks()[0].child
- class util.populate_roi.MIASPlateAnalysisCtx(images, original_files, original_file_image_map, plate_id, service_factory)[source]¶
Bases:
AbstractPlateAnalysisCtx
MIAS dataset concrete class implementation of an analysis context. MIAS measurements are aggregated based on a single “log” file. A result file is present for each stitched (of multiple fields) mosaic and contains the actual measured results and ROI.
- companion_format = 'Companion/MIAS'¶
- datetime_format = '%Y-%m-%d-%Hh%Mm%Ss'¶
- detail_regex = re.compile('^Well(\\d+)_(.*)_detail_(\\d+-\\d+-\\d+-\\d+h\\d+m\\d+s).txt$')¶
- get_result_file_count(measurement_index)[source]¶
Return the number of result files associated with a measurement run.
- classmethod is_this_type(original_files)[source]¶
Concrete implementations are to return True if the class pertinent for the original files associated with the plate.
- log_regex = re.compile('.*log(\\d+-\\d+-\\d+-\\d+h\\d+m\\d+s).txt$')¶
- exception util.populate_roi.MeasurementError[source]¶
Bases:
Exception
Raised by the analysis or measurement context when an error condition is reached.
- class util.populate_roi.MeasurementParsingResult(sets_of_columns=None)[source]¶
Bases:
object
Holds the results of a measurement parsing event.
- class util.populate_roi.PlateAnalysisCtxFactory(service_factory)[source]¶
Bases:
object
The plate analysis context factory is responsible for detecting and returning a plate analysis context instance for a given plate.
- find_images_for_plate(plate_id)[source]¶
Retrieves all the images associated with a given plate. Fetched are the Image’s WellSample, the WellSample’s Well, the annotation stack associated with the Image and each annotation’s linked original file.
- implementations = (<class 'util.populate_roi.FlexPlateAnalysisCtx'>, <class 'util.populate_roi.MIASPlateAnalysisCtx'>, <class 'util.populate_roi.InCellPlateAnalysisCtx'>)¶
- class util.populate_roi.ThreadPool(num_threads)[source]¶
Bases:
object
Pool of threads consuming tasks from a queue
- class util.populate_roi.Worker(tasks)[source]¶
Bases:
Thread
Thread executing tasks from a given tasks queue
- run()[source]¶
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.