type=str, required=False, help='Path to data directory. Overrides what is in param file') namespace = parser.parse_args() # Load the project parameters file mm3.information('Loading experiment parameters.') if namespace.paramfile: param_file_path = namespace.paramfile else: mm3.warning('No param file specified. Using 100X template.') param_file_path = 'yaml_templates/params_SJ110_100X.yaml' if namespace.path: p = mm3.init_mm3_helpers( param_file_path, datapath=namespace.path) # initialized the helper library else: p = mm3.init_mm3_helpers(param_file_path, datapath=None) # define variables here source_dir = p['experiment_directory'] dest_dir = os.path.join(source_dir, 'TIFF') file_prefix = p['experiment_name'] # prefix for output images file_name_filters = p['metamorphToTIFF']['file_name_filters'] if not os.path.exists(dest_dir): os.makedirs(dest_dir) pat = re.compile(r'.+s(\d+)_t(\d+)\.TIF') time_between_frames = p['metamorphToTIFF']['seconds_between_frames']
help='Apply this argument is you are making masks de novo, i.e., if no masks exist yet for your images.') namespace = parser.parse_args() # Load the project parameters file mm3.information('Loading experiment parameters.') training_dir = namespace.traindir if not os.path.exists(training_dir): mm3.warning('Training directory not found, making directory.') os.makedirs(training_dir) if namespace.paramfile: param_file_path = namespace.paramfile else: mm3.warning('No param file specified. Using 100X template.') param_file_path = 'yaml_templates/params_SJ110_100X.yaml' p = mm3.init_mm3_helpers(param_file_path) # initialized the helper library GUI.init_params(param_file_path) if namespace.fov: user_spec_fovs = [int(val) for val in namespace.fov.split(",")] else: user_spec_fovs = [] if not os.path.exists(p['seg_dir']): sys.exit("Exiting: Segmentation directory, {}, not found.".format(p['seg_dir'])) if not os.path.exists(p['chnl_dir']): sys.exit("Exiting: Channel directory, {}, not found.".format(p['chnl_dir'])) specs = mm3.load_specs() # make list of FOVs to process (keys of channel_mask file) fov_id_list = sorted([fov_id for fov_id in specs.keys()])
param_file_path = arg # parameter file path if opt in ['-o', "--fov"]: try: for fov_to_proc in arg.split(","): user_spec_fovs.append(int(fov_to_proc)) except: mm3.warning("Couldn't convert -o argument to an integer:", arg) raise ValueError if opt in ['-p', "--picklefile"]: pklfile = arg # parameter file path # Load the project parameters file if len(param_file_path) == 0: raise ValueError("A parameter file must be specified (-f <filename>).") mm3.information('Loading experiment parameters and cell data.') p = mm3.init_mm3_helpers(param_file_path) # loads and returns # load specs file with open(os.path.join(p['ana_dir'], 'specs.yaml'), 'r') as specs_file: specs = yaml.safe_load(specs_file) # load cell data dict. if pklfile == None: pklfile = os.path.join(p['cell_dir'], 'complete_cells.pkl') with open(pklfile, 'rb') as cell_file: Cells = pickle.load(cell_file) ### Filters you may want to apply if True: # Filter based on birth_label. mother cells : label_num=1 Cells = mm3_plots.find_cells_of_birth_label(Cells, label_num=[1, 2])