itk-vtk-viewer
itk-vtk-viewer copied to clipboard
feat(Zarr): Identify RGB RGBA pixel types
2D, uint8 pixel and 3 or 4 components -> Assume we want to render like an RGB / RGBA.
@PaulHax I did not test this -- are any of the testing datasets we have relevant?
The removed logo.zarr matched that signature.
Swapped in this
const computePixelType = (components, arrayShape, componentType) => {
// is 2D and unsigned 8 bit? (arrayShape.get('z') may be 1)
if ((arrayShape.get('z') ?? 1) === 1 && componentType === IntTypes.UInt8) {
if (components === 3) return PixelTypes.RGB
if (components === 4) return PixelTypes.RGBA
}
return components > 1 ? PixelTypes.VariableLengthVector : PixelTypes.Scalar
}
Here
const componentType = getComponentType(info.pixelArrayMetadata.dtype)
const pixelType = computePixelType(components, info.arrayShape, componentType)
const imageType = {
gets me a logo.zarr like this:
Just lines, like I was seeing before this last Zarr effort.