def core_helper(plate, settings_dict, imagecontainer, position, version, redirect=True, debug=False): """Embeds analysis of a positon in a single function""" # see http://stackoverflow.com/questions/3288595/ # multiprocessing-using-pool-map-on-a-function-defined-in-a-class logger = logging.getLogger(str(os.getpid())) import numpy reload(numpy.core._dotblas) try: settings = ConfigSettings() settings.from_dict(settings_dict) settings.set('General', 'constrain_positions', True) settings.set('General', 'positions', position) environ = CecogEnvironment(version, redirect=redirect, debug=debug) if debug: environ.pprint() analyzer = AnalyzerCore(plate, settings, imagecontainer) post_hdf5_link_list = analyzer.processPositions() return plate, position, copy.deepcopy(post_hdf5_link_list) except Exception as e: errortxt = "plate: %s, position: %s\n" % (plate, position) errortxt = "".join([errortxt] + \ traceback.format_exception(*sys.exc_info())) logger.error(errortxt) raise e.__class__(errortxt)
def getListOfExperiments(self): settings = ConfigSettings(SECTION_REGISTRY) settings.read(self.oBatchSettings.settingsFilename) settings.set_section(SECTION_NAME_GENERAL) settings.set2('pathin', self.oBatchSettings.baseInDir) settings.set2('pathout', self.oBatchSettings.baseOutDir) imagecontainer = ImageContainer() imagecontainer.import_from_settings(settings) if self.oBatchSettings.plates is None: plates = imagecontainer.plates else: plates = self.oBatchSettings.plates lstExperiments = [] for plate in plates: meta_data = imagecontainer.get_meta_data(plate) positions = meta_data.positions if self.oBatchSettings.omit_processed_positions: finished_pos = [os.path.splitext(x)[0].split('__')[0] for x in os.listdir(os.path.join(self.oBatchSettings.baseOutDir, plate, 'log', '_finished'))] positions = filter(lambda x: x not in finished_pos, positions) lstExperiments.extend([(x,y) for x,y in zip([plate for i in positions], positions) ]) return lstExperiments
def core_helper(plate_id, settings_str, imagecontainer, position): settings = ConfigSettings(SECTION_REGISTRY) settings.from_string(settings_str) settings.set(SECTION_NAME_GENERAL, 'constrain_positions', True) settings.set(SECTION_NAME_GENERAL, 'positions', position) try: analyzer = AnalyzerCore(plate_id, settings, imagecontainer) result = analyzer.processPositions() except Exception: traceback.print_exc() raise return plate_id, position, copy.deepcopy(result['post_hdf5_link_list'])
def core_helper(plate, settings_dict, imagecontainer, position, version, mode="r+", redirect=True): """Embedds analysis of a positon in a single function""" # see http://stackoverflow.com/questions/3288595/ # multiprocessing-using-pool-map-on-a-function-defined-in-a-class logger = logging.getLogger(str(os.getpid())) try: # FIXME numpy 1.11 does not have ._dotblas import numpy.core._dotblas reload(numpy.core._dotblas) except ImportError as e: pass try: settings = ConfigSettings() settings.from_dict(settings_dict) settings.set('General', 'constrain_positions', True) settings.set('General', 'positions', position) environ = CecogEnvironment(version, redirect=redirect) analyzer = PlateAnalyzer(plate, settings, imagecontainer, mode=mode) analyzer() return plate, position except Exception as e: errortxt = "Plate: %s, Site: %s\n" % (plate, position) errortxt = "".join([errortxt] + \ traceback.format_exception(*sys.exc_info())) logger.error(errortxt) raise type(e)(errortxt)
logger.info("*************************************************" + '*'*len(version)) logger.info("*** CellCognition - Batch Analyzer - Version %s ***" %version) logger.info("*************************************************" + '*'*len(version)) logger.info('argv: %s' % sys.argv) environ = CecogEnvironment(version) if options.settings is None: parser.error('Settings filename required.') environ = CecogEnvironment(version, redirect=False, debug=False) filename_settings = os.path.abspath(options.settings) # read the settings data from file settings = ConfigSettings() settings.read(filename_settings) settings.set_section(SECTION_NAME_GENERAL) index = options.cluster_index batch_size = options.batch_size position_list = options.position_list create_images = options.create_images multiple_plates = options.multiple_plates path_input = options.input path_output = options.output if path_input is not None: settings.set2('pathin', path_input) logger.info('Overwrite input path by %s' % path_input)
def __init__(self, configfile): self.img_height = None self.img_width = None self.settings = ConfigSettings() self.settings.read(configfile)
logger.info("*************************************************" + '*' * len(VERSION)) logger.info("*** CellCognition - Batch Analyzer - Version %s ***" % VERSION) logger.info("*************************************************" + '*' * len(VERSION)) logger.info('argv: %s' % sys.argv) if options.settings is None: parser.error('Settings filename required.') filename_settings = os.path.abspath(options.settings) # read the settings data from file settings = ConfigSettings(SECTION_REGISTRY) settings.read(filename_settings) settings.set_section(SECTION_NAME_GENERAL) index = options.cluster_index batch_size = options.batch_size position_list = options.position_list create_images = options.create_images multiple_plates = options.multiple_plates path_input = options.input path_output = options.output if path_input is not None: settings.set2('pathin', path_input) logger.info('Overwrite input path by %s' % path_input)