-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
112 lines (97 loc) · 3.25 KB
/
Copy pathconfig.py
File metadata and controls
112 lines (97 loc) · 3.25 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
"""
Shared pipeline configuration for cell edge movement analysis.
This module centralizes all pipeline configuration parameters.
Individual step scripts can import from here instead of duplicating
configuration dictionaries.
"""
# Default pipeline configuration
PIPELINE_CONFIG = {
# Data paths (for single dataset mode)
'DATA_DIR': 'data',
'RESULTS_DIR': 'results',
# File pattern matching
'IMAGE_PATTERNS': ['*piezo1.tif', '*Piezo1.tif', '*PIEZO1.tif'],
'MASK_PATTERNS': ['*Mask.tif', '*mask.tif', '*MASK.tif'],
# Step 1: Data Loading
'step1': {
'normalize_frames': True,
'normalization_scale': 100.0,
'normalization_method': 'max', # 'max' or 'percentile' (robust to hot pixels)
'normalization_percentile': 99.9, # used when normalization_method='percentile'
'normalization_region': 'frame', # 'frame' (whole image) or 'mask' (in-cell only)
'normalization_scope': 'per_frame', # 'per_frame' or 'global' (one ref for the stack)
'subtract_background': True,
'background_percentile': 10,
'create_verification_figures': True,
},
# Step 2: Edge Detection
'step2': {
'smooth_edges': True,
'smoothing_sigma': 20.0,
'create_verification_figures': True,
},
# Step 3: Displacement Calculation
'step3': {
'min_movement_pixels': 5,
'arrow_scale': 1,
'arrow_head_width': 40,
'arrow_head_length': 15,
'arrow_point_forward': True,
'create_verification_figures': True,
},
# Step 4: Movement Classification
'step4': {
'movement_threshold': 5,
'show_edges': True,
'show_arrows': True,
'arrow_scale': 1,
'arrow_head_width': 20,
'arrow_head_length': 10,
'arrow_point_forward': True,
'create_verification_figures': True,
},
# Step 5: Edge Sampling
'step5': {
'n_points': 12,
'exclude_endpoints': True,
'sampling_method': 'displacement_like',
'target_points_displacement': 20,
'y_selection': 'uppermost',
'create_verification_figures': True,
},
# Step 6: Sampling Rectangles
'step6': {
'depth': 50,
'width': 25,
'create_verification_figures': True,
},
# Step 7: Intensity Extraction
'step7': {
'intensity_statistic': 'mean', # 'mean', 'max' or 'percentile' per sampling rectangle
'intensity_percentile': 95, # used when intensity_statistic='percentile'
'create_verification_figures': True,
},
# Step 8: Movement Assignment
'step8': {
'create_verification_figures': True,
},
# Step 9: Correlation Analysis
'step9': {
'movement_threshold': 5,
'binning_method': 'equal_count',
'n_bins': 10,
'min_bin_count': 5,
'create_verification_figures': True,
},
}
def get_movement_threshold():
"""Get the movement threshold, ensuring step4 and step9 stay synchronized.
Returns
-------
float
The movement threshold in pixels.
"""
threshold = PIPELINE_CONFIG['step4']['movement_threshold']
# Ensure step9 matches step4
PIPELINE_CONFIG['step9']['movement_threshold'] = threshold
return threshold