Beispiel #1
0
def headless(directory, output, processes=-1):
    """
    run the full pipeline on a directory without a gui

    parameters:
        directory: input directory with ps2 data
        output: output directory
        processes: max number of multiprocesses. default: max available
    
    1. convert bins to pngs
    2. do image segmentation (this is where the imagej macro 
        would go, but it has been rewritten)
    3. get ps2 offsets
    4. generate aggregate files
    5. generate fluorescence file 
    """

    print("Converting bins to pngs")
    bin_conversion.convert_dirs(
        directory,
        processes=processes)  # converting all images in a dir from bin to png

    print("segmenting images")
    # imagej_macro(args.macro, args.directory) # old fiji macro
    image_segmentation.process_collection(directory)  # new python macro

    # getting offsets
    with open(
            os.path.join(this_dir, "static", "ps2",
                         "sensor_fixed_metadata.json"), 'r') as f:
        ps2_dict = json.load(f)
        ps2_x = float(ps2_dict[0]['location_in_camera_box_m']['x'])
        ps2_y = float(ps2_dict[0]['location_in_camera_box_m']['y'])

    print("generating aggregates")
    fluorescence_aggregation.generate_aggregate(
        directory, output,
        os.path.join(this_dir, "static", 'S10_Plot_boundaries.csv'),
        os.path.join(this_dir, "static", 'multithresh.json'), ps2_x,
        ps2_y)  # generating aggregates
    fluorescence_aggregation.generate_fluorescence(
        directory, output, True)  # generate fluorescence files

    print("Finished processing", directory)
Beispiel #2
0
def headless(directory):
    """run the full pipeline on a directory without a gui"""

    bin_conversion.convert_dirs(directory) # converting all images in a dir from bin to png
    # imagej_macro(args.macro, args.directory) # old fiji macro
    image_segmentation.process_collection(directory) # new python macro

    # getting offsets
    with open(os.path.join(this_dir, "static", "ps2", "sensor_fixed_metadata.json"), 'r') as f:
        ps2_dict = json.load(f)
        ps2_x = float(ps2_dict[0]['location_in_camera_box_m']['x'])
        ps2_y = float(ps2_dict[0]['location_in_camera_box_m']['y'])

    fluorescence_aggregation.generate_aggregate(
        directory, 
        os.path.join(this_dir, "static", 'Plot boundaries.xlsx'),
        os.path.join(this_dir, "static", 'multithresh.json'),
        ps2_x, 
        ps2_y
    ) # generating aggregates
    fluorescence_aggregation.generate_fluorescence(directory, True) # generate fluorescence files

    print("Finished processing", directory)