Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Zarr): Identify RGB RGBA pixel types #489

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thewtex
Copy link
Member

@thewtex thewtex commented May 19, 2022

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

2D, uint8 pixel and 3 or 4 components -> Assume we want to render like
an RGB / RGBA.
@thewtex thewtex requested a review from PaulHax May 19, 2022 00:47
@thewtex
Copy link
Member Author

thewtex commented May 19, 2022

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

@PaulHax
Copy link
Collaborator

PaulHax commented May 19, 2022

The removed logo.zarr matched that signature.

@PaulHax
Copy link
Collaborator

PaulHax commented May 19, 2022

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.

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

Successfully merging this pull request may close these issues.

2 participants