-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrainreg_launch.py
executable file
·59 lines (54 loc) · 2.24 KB
/
brainreg_launch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python3
import os
import subprocess
from pathlib import Path
from os.path import basename, dirname
scratch = Path(os.environ["SCRATCH"])
oak = Path(os.environ["OAK"])
dir_data = scratch / "tamachad" / "data"
dir_output = oak / "users" / "croat" / "tamachad" / "output"
atlas_steps_list = [
(100, 4),
(50, 5),
(25, 6),
(10, 7),
]
bending_energy_list = [0.7, 0.85, 0.95, 1]
grid_spacing_list = [-5, -10, -20]
sigma_list = [0, -1, -4]
hist_bins_list = [64, 128, 256]
for at, st in atlas_steps_list:
for tiff in dir_data.glob(f"*/Ex_488_Em_525_stitched.br.{at}um.tif"):
dataset, base = tiff.parts[-2:]
for be in bending_energy_list:
for gs in grid_spacing_list:
for si in sigma_list:
for hb in hist_bins_list:
name = f"at{at}_st{st}_be{be}_gs{gs}_si{si}_hb{hb}"
output = dir_output / dataset / base / name
if output.exists():
continue
output.mkdir(parents=True, exist_ok=True)
command = [
"sbatch",
"brainreg.sh",
tiff,
output,
"-v", str(at), str(at), str(at),
"--orientation", "ial",
"--save-original-orientation",
"--debug",
"--n-free-cpus", "1",
"--atlas", f"allen_mouse_{at}um",
"--affine-n-steps", st,
"--affine-use-n-steps", st,
"--freeform-n-steps", st,
"--freeform-use-n-steps", st,
"--bending-energy-weight", be,
"--grid-spacing", gs,
"--smoothing-sigma-reference", si,
"--smoothing-sigma-floating", si,
"--histogram-n-bins-reference", hb,
"--histogram-n-bins-floating", hb,
]
subprocess.run([str(c) for c in command], check=True)