@@ -107,7 +107,6 @@ def convert_ROI_table_to_indices(
107
107
indices = [start_z , end_z , start_y , end_y , start_x , end_x ]
108
108
109
109
# Round indices to lower integer
110
- # FIXME: to be checked/tested
111
110
indices = list (map (math .floor , indices ))
112
111
113
112
# Append ROI indices to to list
@@ -116,27 +115,6 @@ def convert_ROI_table_to_indices(
116
115
return list_indices
117
116
118
117
119
- def split_3D_indices_into_z_layers (
120
- list_indices : List [List [int ]],
121
- ) -> List [List [int ]]:
122
-
123
- num_z_layers = None
124
- new_list_indices = []
125
- for indices in list_indices :
126
- if num_z_layers is None :
127
- num_z_layers = indices [1 ]
128
- else :
129
- if indices [1 ] != num_z_layers :
130
- raise Exception (
131
- "Inconsistent num_z_layers in split_indices_into_2D_layers"
132
- )
133
- for ind_z in range (num_z_layers ):
134
- new_indices = [ind_z , ind_z + 1 ] + indices [2 :]
135
- new_list_indices .append (new_indices )
136
-
137
- return new_list_indices
138
-
139
-
140
118
def _inspect_ROI_table (
141
119
path : str = None ,
142
120
level : int = 0 ,
@@ -157,95 +135,9 @@ def _inspect_ROI_table(
157
135
full_res_pxl_sizes_zyx = full_res_pxl_sizes_zyx ,
158
136
)
159
137
160
- list_indices = split_3D_indices_into_z_layers (list_indices )
161
-
162
138
print (f"level: { level } " )
163
139
print (f"coarsening_xy: { coarsening_xy } " )
164
140
print ("list_indices:" )
165
141
for indices in list_indices :
166
142
print (indices )
167
143
print ()
168
-
169
-
170
- def temporary_test ():
171
-
172
- pixel_size_z = 1.0
173
- pixel_size_y = 0.1625
174
- pixel_size_x = 0.1625
175
-
176
- df = pd .DataFrame (np .zeros ((2 , 10 )), dtype = int )
177
- df .index = ["FOV1" , "FOV2" ]
178
- df .columns = [
179
- "x_micrometer" ,
180
- "y_micrometer" ,
181
- "z_micrometer" ,
182
- "x_pixel" ,
183
- "y_pixel" ,
184
- "z_pixel" ,
185
- "pixel_size_x" ,
186
- "pixel_size_y" ,
187
- "pixel_size_z" ,
188
- "bit_depth" ,
189
- ]
190
- df ["x_micrometer" ] = [0.0 , 416.0 ]
191
- df ["y_micrometer" ] = [0.0 , 0.0 ]
192
- df ["z_micrometer" ] = [0.0 , 0.0 ]
193
- df ["x_pixel" ] = [2560 , 2560 ]
194
- df ["y_pixel" ] = [2160 , 2160 ]
195
- df ["z_pixel" ] = [5 , 5 ]
196
- df ["pixel_size_x" ] = [pixel_size_x ] * 2
197
- df ["pixel_size_y" ] = [pixel_size_y ] * 2
198
- df ["pixel_size_z" ] = [pixel_size_z ] * 2
199
- df ["bit_depth" ] = [16.0 , 16.0 ]
200
-
201
- print ("DataFrame" )
202
- print (df )
203
- print ()
204
-
205
- adata = prepare_FOV_ROI_table (df )
206
-
207
- print ("AnnData table" )
208
- print (adata .var_names )
209
- print (adata .obs_names )
210
- print (adata .X )
211
- print ()
212
-
213
- print ("Indices 3D" )
214
- full_res_pxl_sizes_zyx = [pixel_size_z , pixel_size_y , pixel_size_x ]
215
- list_indices = convert_ROI_table_to_indices (
216
- adata ,
217
- level = 0 ,
218
- coarsening_xy = 2 ,
219
- full_res_pxl_sizes_zyx = full_res_pxl_sizes_zyx ,
220
- )
221
- for indices in list_indices :
222
- print (indices )
223
- print ()
224
-
225
- print ("Indices 3D / split" )
226
- list_indices = split_3D_indices_into_z_layers (list_indices )
227
- for indices in list_indices :
228
- print (indices )
229
- print ()
230
-
231
- print ("Indices 2D" )
232
- adata = convert_FOV_ROIs_3D_to_2D (adata , pixel_size_z )
233
- list_indices = convert_ROI_table_to_indices (
234
- adata ,
235
- level = 0 ,
236
- coarsening_xy = 2 ,
237
- full_res_pxl_sizes_zyx = full_res_pxl_sizes_zyx ,
238
- )
239
- for indices in list_indices :
240
- print (indices )
241
- print ()
242
-
243
-
244
- if __name__ == "__main__" :
245
- # import sys
246
- # args = sys.argv[1:]
247
- # types = [str, int, int]
248
- # args = [types[ix](x) for ix, x in enumerate(args)]
249
- # _inspect_ROI_table(*args)
250
-
251
- temporary_test ()
0 commit comments