Skip to content
This repository has been archived by the owner on Jun 2, 2020. It is now read-only.

Dimension order for multichannel vs RGB images #4

Open
manzt opened this issue Feb 24, 2020 · 0 comments
Open

Dimension order for multichannel vs RGB images #4

manzt opened this issue Feb 24, 2020 · 0 comments

Comments

@manzt
Copy link
Contributor

manzt commented Feb 24, 2020

In #1, I noted that we should prefer the last two dimensions of the tiled arrays to be [y,x] as this is most efficient for accessing individual channels.

However, after looking at some whole slide images, I've found that RGB and RGBA images are mostly commonly stored as [x, y, rgba]. This means that for a 2 x 2 image, the data are stored interleaved like:

[r1, g1, b1, a1, r2, g2, b2, a2, r3, g3, b3, a3, r4, g4, b4, a4] 

rather than

[r1, r2, r3, r4, g1, g2, g3, g4, b1, b2, b3, b4, a1, a2, a3, a4]

This makes sense because generally we will view rgba for a particular [x,y] slice together. napari guesses whether an array is RGB by looking at the shape of the array. If the last dimension is 3 or 4, it guesses RGB/RGBA, otherwise the last two dimensions are decided to be [y,x].

We should tile the last two dimensions preferably, but for RGB/RGBA images we should leave this last dimension as channels since this is most natural for WSI. We can use a rgb attribute in the base array to tell create_pyramid.py which dims to downsample and tile.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant