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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177 | def __init__(self, wt_img:np.ndarray, mut_img:np.ndarray,
proc_mask:np.ndarray, narrow_proc_mask:np.ndarray,
**kwargs):
""" Class is designed to create differential images and insertion masks
for two separate image time series (for instance, wild-type NCS and mutant NCS,
or two distinct NCSs). The up_mask_calc method is responsible for detecting
insertion regions.
Suitable for image series with __single__ application/stimulation only.
The class attributes contain various types of insertion masks
and corresponding profiles for these masks (raw intensity and ΔF/F profiles).
__Requires wf_x2_m2 instance type as input!__
__NB: Optimized for long stimuli/applications with strong translocation
and analysis of colocalization of the insertion sites.
Methods of this class may not work with image series with weak translocation range.__
Parameters
----------
wt_img: ndarray [t,x,y]
wild type images time series
mut_img: ndarray [t,x,u]
mutant images time series
proc_mask: ndarray [x,y]
cell processes boolean mask, extended
narrow_proc_mask: ndarray [x,y]
cell processes boolean mask, unextended
Attributes
----------
wt_img: ndarray [t,x,y]
wild type images time series
mut_img: ndarray [t,x,y]
mutant images time series
proc_mask: ndarray [x,y]
cell processes boolean mask, extended
narrow_proc_mask: ndarray [x,y]
cell processes boolean mask, unextended
wt_up_mask: ndarray [x,y]
boolean mask of intensity increase regions for wild-type channel,
created with `red_green.wt_ws_mut.up_mask_calc()`
wt_up_label: ndarray [x,y]
label image of intensity increase regions for wild-type channel,
created with `red_green.wt_ws_mut.up_mask_calc()`
wt_diff_img: ndarray [x,y]
differential image of intensity changes after stimulation for wild-type channel,
created with `red_green.wt_ws_mut.up_mask_calc()`
mut_up_mask: ndarray [x,y]
boolean mask of intensity increase regions for mutant/2nd NCS channel,
created with `red_green.wt_ws_mut.up_mask_calc()`
mut_up_label: ndarray [x,y]
label image of intensity increase regions for mutant/2nd NCS channel,
created with `red_green.wt_ws_mut.up_mask_calc()`
mut_diff_img: ndarray [x,y]
differential image of intensity changes after stimulation for mutant/2nd NCS channel,
created with `red_green.wt_ws_mut.up_mask_calc()`
connected_up_mask: ndarray [x,y]
regions of `wt_up_mask` which overlay with `mut_up_mask`,
created with `utils.masking.mask_connection()`
halo_up_mask: ndarray [x,y]
`connecter_up_mask` without mutant intensity increase regions
init_up_mask: ndarray [x,y]
`connected_up_mask` without `halo_up_mask`
(only regions of `mut_up_mask` which overlay with `wt_up_mask`)
wt_conn_arr: ndarray [int, t]
intensity profiles of wild-type channel for each label element of `connected_up_mask`,
created with `utils.masking.label_prof_arr()`
wt_conn_df_arr: ndarray [ΔF/F, t]
ΔF/F profiles of wild-type channel for each label element of `connected_up_mask`,
created with `utils.masking.label_prof_arr()`
wt_halo_arr: ndarray [int, t]
intensity profiles of wild-type channel for each label element of `halo_up_mask`,
created with `utils.masking.label_prof_arr()`
wt_halo_df_arr: ndarray [ΔF/F, t]
ΔF/F profiles of wild-type channel for each label element of `halo_up_mask`,
created with `utils.masking.label_prof_arr()`
wt_init_arr: ndarray [int, t]
intensity profiles of wild-type channel for each label element of `init_up_mask`,
created with `utils.masking.label_prof_arr()`
wt_init_df_arr: ndarray [ΔF/F, t]
ΔF/F profiles of wild-type channel for each label element of `init_up_mask`,
created with `utils.masking.label_prof_arr()`
mut_conn_arr: ndarray [int, t]
intensity profiles of mutant/2nd NCS channel for each label element of `connected_up_mask`,
created with `utils.masking.label_prof_arr()`
mut_conn_df_arr: ndarray [ΔF/F, t]
ΔF/F profiles of mutant/2nd NCS channel for each label element of `connected_up_mask`,
created with `utils.masking.label_prof_arr()`
mut_halo_arr: ndarray [int, t]
intensity profiles of mutant/2nd NCS channel for each label element of `halo_up_mask`,
created with `utils.masking.label_prof_arr()`
mut_halo_df_arr: ndarray [ΔF/F, t]
ΔF/F profiles of mutant/2nd NCS channel for each label element of `halo_up_mask`,
created with `utils.masking.label_prof_arr()`
mut_init_arr: ndarray [int, t]
intensity profiles of mutant/2nd NCS channel for each label element of `init_up_mask`,
created with `utils.masking.label_prof_arr()`
mut_init_df_arr: ndarray [ΔF/F, t]
ΔF/F profiles of mutant/2nd NCS channel for each label element of `init_up_mask`,
created with `utils.masking.label_prof_arr()`
"""
self.wt_img = wt_img
self.mut_img = mut_img
self.proc_mask = proc_mask
self.narrow_proc_mask = narrow_proc_mask
# WT masking
self.wt_up_mask, self.wt_up_label, self.wt_diff_img = self.up_mask_calc(self.wt_img,
self.proc_mask,
**kwargs)
# mutant masking
self.mut_up_mask, self.mut_up_label, self.mut_diff_img = self.up_mask_calc(self.mut_img,
self.proc_mask,
**kwargs)
# masks modification
self.connected_up_mask, self.connected_up_label = masking.mask_connection(input_master_mask=self.wt_up_mask,
input_minor_mask=self.mut_up_mask)
self.halo_up_mask = np.copy(self.connected_up_mask)
self.halo_up_mask[self.mut_up_mask] = 0
self.halo_up_label = np.copy(self.connected_up_label)
self.halo_up_label[self.mut_up_mask] = 0
self.init_up_mask = np.copy(self.connected_up_mask)
self.init_up_mask[self.halo_up_mask] = 0
self.init_up_label = np.copy(self.connected_up_label)
self.init_up_label[self.halo_up_mask] = 0
# WT ins profiles calc
self.wt_conn_df_arr, self.wt_conn_arr = masking.label_prof_arr(input_label=self.connected_up_label,
input_img_series=self.wt_img)
self.wt_halo_df_arr, self.wt_halo_arr = masking.label_prof_arr(input_label=self.halo_up_label,
input_img_series=self.wt_img)
self.wt_init_df_arr, self.wt_init_arr = masking.label_prof_arr(input_label=self.init_up_label,
input_img_series=self.wt_img)
# # WT trans profiles calc
# self.wt_conn_rois_trans_arr, self.wt_conn_tot_trans_arr = masking.trans_prof_arr(input_total_mask=self.narrow_proc_mask,
# input_labels=self.connected_up_label,
# input_img_series=self.wt_img)
# self.wt_halo_rois_trans_arr, self.wt_halo_tot_trans_arr = masking.trans_prof_arr(input_total_mask=self.narrow_proc_mask,
# input_labels=self.halo_up_label,
# input_img_series=self.wt_img)
# self.wt_init_rois_trans_arr, self.wt_init_tot_trans_arr = masking.trans_prof_arr(input_total_mask=self.narrow_proc_mask,
# input_labels=self.init_up_label,
# input_img_series=self.wt_img)
# mut profiles calc
self.mut_conn_df_arr, self.mut_conn_arr = masking.label_prof_arr(input_label=self.connected_up_label,
input_img_series=self.mut_img)
self.mut_halo_df_arr, self.mut_halo_arr = masking.label_prof_arr(input_label=self.halo_up_label,
input_img_series=self.mut_img)
self.mut_init_df_arr, self.mut_init_arr = masking.label_prof_arr(input_label=self.init_up_label,
input_img_series=self.mut_img)
|