Open kbestak opened 2 weeks ago
Test marker sheet without biological significance:
channel_number,cycle_number,marker_name,filter,background,remove,exposure
1,1,PK,Alexa488,,,100
2,1,CD11c,Alexa594,,,100
3,1,PK,Alexa647,,TRUE,100
4,1,CD163,Cy7,PK,,100
5,1,DAPI_1,DAPI,CD11c,,100
6,1,AF_1,AF,,TRUE,100
Command output:
Command error:
2024-09-04 07:38:43.522 | INFO | __main__:write_pyramid:171 - Writing to small_test_backsub.ome.tif
Pixel size overwrite not specified
Channel PK (0) processed, no background subtraction
Channel CD11c (1) processed, no background subtraction
Channel PK (2) processed, no background subtraction
Channel CD163 (3) processed, background subtraction
Channel DAPI_1 (4) processed, background subtraction
Channel AF_1 (5) processed, no background subtraction
[(1024, 1024), (1024, 1024), (1024, 1024)]
Assembling mosaic 1/ 1 (channel 1/ 4): 0%| | 0/8 [00:00<?, ?it/s]
Assembling mosaic 1/ 1 (channel 1/ 4): 100%|##########| 8/8 [00:00<00:00, 439.75it/s]
Assembling mosaic 1/ 1 (channel 2/ 4): 0%| | 0/8 [00:00<?, ?it/s]
Assembling mosaic 1/ 1 (channel 2/ 4): 100%|##########| 8/8 [00:00<00:00, 520.51it/s]
Assembling mosaic 1/ 1 (channel 3/ 4): 0%| | 0/31 [00:00<?, ?it/s]
Assembling mosaic 1/ 1 (channel 3/ 4): 77%|#######7 | 24/31 [00:00<00:00, 1523.42it/s]
Traceback (most recent call last):
File "/background_subtraction/background_sub.py", line 429, in <module>
main(args)
File "/background_subtraction/background_sub.py", line 416, in main
write_pyramid(
File "/background_subtraction/background_sub.py", line 180, in write_pyramid
tif.write(
File "/opt/conda/envs/backsub/lib/python3.9/site-packages/tifffile/tifffile.py", line 3049, in write
iteritem, dataiter = peek_iterator(dataiter)
File "/opt/conda/envs/backsub/lib/python3.9/site-packages/tifffile/tifffile.py", line 21409, in peek_iterator
first = next(iterator)
File "/opt/conda/envs/backsub/lib/python3.9/site-packages/tifffile/tifffile.py", line 21413, in newiter
yield from iterator
File "/opt/conda/envs/backsub/lib/python3.9/site-packages/tifffile/tifffile.py", line 21413, in newiter
yield from iterator
File "/background_subtraction/background_sub.py", line 241, in tile_from_combined_mosaics
c = da_to_zarr(c) if save_RAM else c.compute()
File "/opt/conda/envs/backsub/lib/python3.9/site-packages/dask/base.py", line 342, in compute
(result,) = compute(self, traverse=False, **kwargs)
File "/opt/conda/envs/backsub/lib/python3.9/site-packages/dask/base.py", line 628, in compute
results = schedule(dsk, keys, **kwargs)
File "/background_subtraction/background_sub.py", line 337, in scale_background
background_channel = np.rint(ne.evaluate("background_channel * scalar"))
File "/opt/conda/envs/backsub/lib/python3.9/site-packages/numexpr/necompiler.py", line 827, in evaluate
return compiled_ex(*arguments, **kwargs)
ValueError: operands could not be broadcast together with shapes (2793,1860) (2,)
As an example, if the
background
value in the marker sheet points to multiple channels (pointing is done by matching to themarker_name
value), thescalar
critical for the subtraction calculation would be a list of multiple values (1 per matched row). As denoted in the documentation, it is important that themarker_name
column only contains unique values as it is used for background channel matching and an error should be raised if this happens.