Zain
Zain

Reputation: 436

Read three channels into one single Zarr array

I have a big three channel image data (10000*10000*3 for example) exported as Zarr arrays into three separate folders, fused.zarr\fuused_ch_0, fused.zarr\fuused_ch_1, and fused.zarr\fuused_ch_2, with chunk size of (1000*1000). Is there a way to read these three channels into ones single Zarr array with chunk size of (1000*1000*3)?

I tried to read files by zarr_sample=zarr.open('fused.zarr', mode='r'), which gives me three groups of Zarr arrays as expected. Then I tried to merge them together by

zarr_3 = zarr.open('fused3.zarr', mode='w', shape=(*zarr_sample.fused_ch_0.shape,3),
                   chunks=(*zarr_sample.fused_ch_0.chunks,3), dtype=np.int16)
zarr_3[..., 0]=zarr_sample.fused_ch_0
zarr_3[..., 1]=zarr_sample.fused_ch_1
zarr_3[..., 2]=zarr_sample.fused_ch_2

which either didn't work or takes so much time.

Upvotes: 0

Views: 62

Answers (0)

Related Questions