-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatch_bfconvertJetraw.py
More file actions
65 lines (49 loc) · 1.6 KB
/
batch_bfconvertJetraw.py
File metadata and controls
65 lines (49 loc) · 1.6 KB
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
60
61
62
63
64
65
import os, glob
import shutil
import platform
flag_jetraw = True
flag_omecompanion = True
# for macOS
dldir = '/Users/keisuke/Downloads'
path_bftools = '/Users/keisuke/bftools'
# # for Windows
dldir = 'D:\\JetrawTesting'
path_bftools = 'C:\\Users\\ishihara\\bftools'
stacks = '-S%sC%c'
if platform.system() == 'Windows':
stacks = stacks.replace("%", "%%")
inputdir = os.path.join(dldir, 'M44test')
inputdir = os.path.join(dldir, '230509_JETRAW_M44_TEST')
outdir = os.path.join(dldir, 'out')
# prepare output directory
if os.path.exists(outdir):
shutil.rmtree(outdir)
os.makedirs(outdir)
ext_in = '.vsi'
files = sorted(glob.glob(os.path.join(inputdir, '*' + ext_in)))
# Nfiles = len(files)
# for file in files:
# print(file)
file = files[0]
fnme = os.path.basename(file).replace(ext_in, '') # filename minus extension
# arguments - common for all files
bfconvert = os.path.join(path_bftools, 'bfconvert')
series = '-series 0 '
if flag_jetraw:
jetraw = '-compression Jetraw -jetraw-identifier 000391_standard -tilex 2304 -tiley 2304'
else:
jetraw = ''
# overwr = '-overwrite' # the overwrite parameter is not working in macOS or Windows, file size adds to pre-existing files
# arguments - file specific
if flag_omecompanion:
companion = '-option ometiff.companion ' + os.path.join(dldir, 'out', fnme + '.companion.ome')
ext_out = '.ome.tif'
else:
companion = ''
ext_out = '.tif'
myin = os.path.join(inputdir, fnme + ext_in)
myout = os.path.join(outdir, fnme + stacks + ext_out)
mylist = [bfconvert, series, jetraw, companion, myin, myout]
cmdstr = ' '.join(mylist)
# print(cmdstr)
os.system(cmdstr)