def __get_module_files(self): self.__module_files = [ 'File Processing', 'Image Processing', 'Object Processing', 'Measurement', 'Data Tools', 'Other', 'All' ] self.__module_dict = {} for key in self.__module_files: self.__module_dict[key] = {} for mn in cellprofiler.modules.get_module_names(): def loader(module_num, mn=mn): module = cellprofiler.modules.instantiate_module(mn) module.set_module_num(module_num) return module try: module = cellprofiler.modules.get_module_class(mn) if module.is_input_module(): continue categories = ([module.category] if isinstance( module.category, str) else list( module.category)) + ['All'] for category in categories: if category not in self.__module_files: self.__module_files.insert(-2, category) self.__module_dict[category] = {} self.__module_dict[category][module.module_name] = loader except Exception, e: import traceback import logging logging.root.error("Unable to instantiate module %s.\n\n", mn, exc_info=True)
def split_pipeline(self, pipeline): """Split the pipeline into input modules and everything else pipeline - the pipeline to be split returns a two-tuple of input modules and other """ input_modules = [] other_modules = [] for module in pipeline.modules(): if module.is_load_module() or module.is_input_module(): input_modules.append(module) else: other_modules.append(module) return input_modules, other_modules
def __get_module_files(self): self.__module_files = ['File Processing', 'Image Processing', 'Object Processing', 'Measurement', 'Data Tools', 'Other', 'All' ] self.__module_dict = {} for key in self.__module_files: self.__module_dict[key] = {} for mn in cellprofiler.modules.get_module_names(): def loader(module_num, mn=mn): module = cellprofiler.modules.instantiate_module(mn) module.set_module_num(module_num) return module try: module = cellprofiler.modules.get_module_class(mn) if module.is_input_module(): continue categories = ([module.category] if isinstance(module.category, str) else list(module.category)) + ['All'] for category in categories: if category not in self.__module_files: self.__module_files.insert(-2, category) self.__module_dict[category] = {} self.__module_dict[category][module.module_name] = loader except Exception, e: import traceback import logging logging.root.error( "Unable to instantiate module %s.\n\n", mn, exc_info=True)