-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.py
More file actions
70 lines (54 loc) · 1.59 KB
/
init.py
File metadata and controls
70 lines (54 loc) · 1.59 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
66
67
68
69
70
import datetime
import os.path
import glob
# Paths and filenames
PATH_DATA = "data"
PATH_RESULTS = "results"
IMAGE_SUM = "0_sum"
IMAGE_ORIGINAL = "1_original"
IMAGE_COUNT = "1_count"
IMAGE_MEDIAN = "2_median"
IMAGE_ROTATED = "3_rotated"
IMAGE_CROPPED = "4_cropped"
IMAGE_CROPPED_DRAW = "4_cropped_draw"
# Extension for all image exports
EXTENSION = ".png"
# Quantile thresholds for removing outliers
QUANTILE_THRESH_LOW = 0.001
QUANTILE_THRESH_HIGH = 0.999
QUANTILE_BLOCK_THRESH_HIGH = 0.99
# Scale constants for images
# - the bigger value the bigger shape of image
WH_SCALE = 7_000
Z_MAX = 65_535
# GUI constants
GUI_STEP_PX = 1
GUI_STEP_ANGLE = 0.2
GUI_CROP_INIT = 5 # fraction
GUI_CROP_STEP = 100
# Estimated parameters for simplifying analysis
FIELD_COUNT = 5
BLOCK_COUNT = 48
FILTER_BLOCKS = [3, 4]
# Split block to parts to calculate deformation
BLOCK_PART = 3 # fraction
# Limits for simplifying guessed parameters above
LIM_INTERVAL = 1.3
LIM_HEIGHT = 10
IMAGE_SUM_DIVIDE = 1
# Create tree if not exists
os.makedirs(PATH_DATA, exist_ok=True)
os.makedirs(PATH_RESULTS, exist_ok=True)
# Load images, files and get dates
files = []
dates = []
for i in sorted(glob.glob(f"{PATH_RESULTS}/*")):
if not os.path.isdir(i) or "block" in i:
continue
filename = os.path.splitext(os.path.split(i)[1])[0]
date, time = os.path.basename(filename).split()[0].split("_")[:2]
files.append(filename)
dates.append(datetime.datetime(
year=int("20" + date[:2]), month=int(date[2:4]), day=int(date[4:6]),
hour=int(time[:2]), minute=int(time[2:4]), second=int(time[4:6]))
)