Ejemplo n.º 1
0
def graph_example(shebang):
    input_path = '/home/cpape/Work/data/isbi2012/cluster_example/isbi_train.n5'
    input_key = 'volumes/watersheds'
    output_path = '/home/cpape/Work/data/isbi2012/cluster_example/graph.n5'

    tmp_folder = './tmp'
    config_folder = './configs'

    max_jobs = 8
    global_conf = WatershedLocal.default_global_config()
    global_conf.update({'shebang': shebang, 'block_shape': [10, 256, 256]})
    with open('./configs/global.config', 'w') as f:
        json.dump(global_conf, f)

    ret = luigi.build([
        GraphWorkflow(input_path=input_path,
                      input_key=input_key,
                      graph_path=output_path,
                      n_scales=1,
                      config_dir=config_folder,
                      tmp_folder=tmp_folder,
                      target='local',
                      max_jobs=max_jobs)
    ],
                      local_scheduler=True)
Ejemplo n.º 2
0
def ws_example(shebang):
    example_path = '/home/cpape/Work/data/isbi2012/cluster_example/isbi_train.n5'

    input_key = 'volumes/affinities'
    output_key = 'volumes/ws'

    max_jobs = 8

    global_conf = WatershedLocal.default_global_config()
    global_conf.update({'shebang': shebang})
    try:
        os.mkdir('configs')
    except OSError:
        pass

    with open('./configs/global.config', 'w') as f:
        json.dump(global_conf, f)

    ret = luigi.build([
        WatershedWorkflow(input_path=example_path,
                          input_key=input_key,
                          output_path=example_path,
                          output_key=output_key,
                          config_dir='./configs',
                          tmp_folder='./tmp',
                          target='local',
                          max_jobs=max_jobs)
    ],
                      local_scheduler=True)
    if ret:
        from cremi_tools.viewer.volumina import view
        with z5py.File(example_path) as f:
            affs = f[input_key][:3].transpose((1, 2, 3, 0))
            ws = f[output_key][:]
        view([affs, ws])
Ejemplo n.º 3
0
 def setUp(self):
     self._mkdir(self.tmp_folder)
     self._mkdir(self.config_folder)
     global_config = WatershedLocal.default_global_config()
     global_config['shebang'] = '#! /g/kreshuk/pape/Work/software/conda/miniconda3/envs/cluster_env37/bin/python'
     global_config['block_shape'] = [10, 256, 256]
     with open(os.path.join(self.config_folder, 'global.config'), 'w') as f:
         json.dump(global_config, f)
Ejemplo n.º 4
0
 def test_ws_pixel_pitch(self):
     config = WatershedLocal.default_task_config()
     config['apply_presmooth_2d'] = False
     config['apply_dt_2d'] = False
     config['apply_ws_2d'] = False
     config['pixel_pitch'] = (10, 1 , 1)
     with open(os.path.join(self.config_folder, 'watershed.config'), 'w') as f:
         json.dump(config, f)
     ret = self._run_ws(False)
     self.assertTrue(ret)
     self._check_result()
Ejemplo n.º 5
0
 def test_ws_2d(self):
     config = WatershedLocal.default_task_config()
     config['apply_presmooth_2d'] = True
     config['apply_dt_2d'] = True
     config['apply_ws_2d'] = True
     config['threshold'] = 0.25
     config['sigma_weights'] = 0.
     with open(os.path.join(self.config_folder, 'watershed.config'), 'w') as f:
         json.dump(config, f)
     ret = self._run_ws()
     self.assertTrue(ret)
     self._check_result()
Ejemplo n.º 6
0
 def _test_ws_3d(self, two_pass):
     config = WatershedLocal.default_task_config()
     config['apply_presmooth_2d'] = False
     config['apply_dt_2d'] = False
     config['apply_ws_2d'] = False
     config['sigma_seeds'] = (.5, 2., 2.)
     config['sigma_weights'] = (.5, 2., 2.)
     config['halo'] = [2, 32, 32]
     with open(os.path.join(self.config_folder, 'watershed.config'), 'w') as f:
         json.dump(config, f)
     ret = self._run_ws(two_pass)
     self.assertTrue(ret)
     self._check_result()