itk-vtk-viewer icon indicating copy to clipboard operation
itk-vtk-viewer copied to clipboard

feat(Zarr): Identify RGB RGBA pixel types

Open thewtex opened this issue 2 years ago • 3 comments

2D, uint8 pixel and 3 or 4 components -> Assume we want to render like an RGB / RGBA.

thewtex avatar May 19 '22 00:05 thewtex

@PaulHax I did not test this -- are any of the testing datasets we have relevant?

thewtex avatar May 19 '22 00:05 thewtex

The removed logo.zarr matched that signature.

PaulHax avatar May 19 '22 13:05 PaulHax

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: Screenshot from 2022-05-19 09-45-05

Just lines, like I was seeing before this last Zarr effort.

PaulHax avatar May 19 '22 13:05 PaulHax