Booritas / slideio

BSD 3-Clause "New" or "Revised" License
57 stars 3 forks source link

All channels are the same read from read_block #36

Open sandman002 opened 5 days ago

sandman002 commented 5 days ago

I’m reading a block from an 8-channel QPTIFF file, but the output shows the first channel repeated across all channels. What could be causing this issue?

slide = slideio.open_slide(qptiff_path, 'QPTIFF')
scene = slide.get_scene(0)
print(scene)
x, y = 10000, 15000
width, height = 256, 256
wsi_region_np = scene.read_block((x, y, width, height))
Name:data.qptiff
Rect: 0,0,32640,31680
Number of Channels: 8
Channel 0 data type: DT_Byte
Channel 1 data type: DT_Byte
Channel 2 data type: DT_Byte
Channel 3 data type: DT_Byte
Channel 4 data type: DT_Byte
Channel 5 data type: DT_Byte
Channel 6 data type: DT_Byte
Channel 7 data type: DT_Byte
Number of Z-Slices: 1
Number of Time Frames: 1
Z-Slice Resolution: 0
Time Frame Resolution: 0
Magnification: 10
Number of Auxiliary Images: 0
Number of Zoom Levels: 5
Booritas commented 5 days ago

Do you mean that you receive a raster with seven identical values for each pixel? Could you try to read the channels separately? Please check if the channels are not empty (all zeros) because sometimes channels of a qptiff can have different dimensions.

wsi_channel_0 = scene.read_block((x, y, width, height), channel_indices=[0])
wsi_channel_6 = scene.read_block((x, y, width, height), channel_indices=[6])
are_identical = np.array_equal(wsi_channel_0, wsi_channel_6)
print(are_identical)
min_value = np.min(wsi_channel_0)
max_value = np.max(wsi_channel_0)
average_value = np.mean(wsi_channel_0)
print(f"Minimum: {min_value}")
print(f"Maximum: {max_value}")
print(f"Average: {average_value}")