for quantile in [50, 75]: thresholds = [] if quantile == 25: thresholds = [0.8, 0.825, 0.85, 0.875, 0.9] elif quantile == 50: thresholds = [0.75, 0.8, 0.85, 0.9] elif quantile == 75: thresholds = [0.65, 0.7, 0.75, 0.8] for threshold in thresholds: #[0.8, 0.85, 0.9, 0.95, 0.975, 0.99]:#[0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]: array_in = daisy.open_ds(input_file, dataset) voxel_size = array_in.voxel_size context_nm = (50*voxel_size[0],50*voxel_size[1],50*voxel_size[2]) #50 pixel overlap chunks = array_in.data.chunks block_size_nm = [chunks[0]*voxel_size[0], chunks[1]*voxel_size[1], chunks[2]*voxel_size[2]] array_out = daisy.prepare_ds(output_file, f'{quantile}_{threshold}_smoothed', array_in.roi, voxel_size = voxel_size, write_size= block_size_nm, dtype = np.uint64) fsa.segment_blockwise(array_in, array_out, block_size = block_size_nm, context = context_nm, num_workers = num_processors, segment_function = lambda array_in,roi: blockwise_segmentation_function(array_in, roi, threshold, quantile))
from blockwise_segmentation_function import * import funlib.segment.arrays as fsa import argparse input_file = '/nrs/cosem/cosem/training/v0003.2/setup35/Jurkat_Cell1_4x4x4nm/Jurkat_Cell1_FS96-Area1_4x4x4nm_it600000.n5' output_file = '/groups/cosem/cosem/ackermand/Jurkat_Cell1_4x4x4nm_setup35_it600000_results.n5' dataset = 'nucleus' if __name__ == '__main__': array_in = daisy.open_ds(input_file, dataset) array_out = daisy.prepare_ds(output_file, f'{dataset}_smoothed_fragments', array_in.roi, voxel_size=array_in.voxel_size, write_size=[180 * 4, 180 * 4, 180 * 4], dtype=np.uint64) fsa.segment_blockwise( array_in, array_out, block_size=[180 * 4, 180 * 4, 180 * 4], context=(200, 200, 200), num_workers=48, segment_function=lambda array_in, roi: blockwise_save_watershed_fragments_function(array_in, roi))