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

fix(independentComponents): Require explicit RGB or RGBA pixelType #371

Merged

Conversation

thewtex
Copy link
Member

@thewtex thewtex commented Feb 16, 2021

Do not make an implicit assumption so independentComponents can be
enabled via pixelType.

Do not make an implicit assumption so independentComponents can be
enabled via pixelType.
@oeway
Copy link
Collaborator

oeway commented Feb 16, 2021

When passing ndarray from the ImJoy interface, since there is no way to explicitly set the pixelType, maybe we should support additional options for the setImage function?

@thewtex
Copy link
Member Author

thewtex commented Feb 16, 2021

When passing ndarray from the ImJoy interface, since there is no way to explicitly set the pixelType, maybe we should support additional options for the setImage function?

To prevent option creep/explosion on the viewer interface, can the object be converted, then the pixelType set?:

export { ndarrayToItkImage }

@oeway
Copy link
Collaborator

oeway commented Feb 16, 2021

Hi, I don't fully get, how would you do it?

@thewtex
Copy link
Member Author

thewtex commented Feb 16, 2021

E.g.

itkImage = ndarrayToItkImage(ndarray)
itkImage.imageType.pixelType = 14
viewer.setImage(itkImage)

@oeway
Copy link
Collaborator

oeway commented Feb 16, 2021

Aha, well, yes and no, for js plugins we can potentially do that, but it will be hard for Python plugins where we just want to call viewer.setImage(numpy_array). We may not want to always import itk module, or have the ndarray2ItkImage() function defined in the caller plugin.

Since we are supporting layers in the viewer, I guess allowing an extra config object will be useful anyway, for example setting the name, colormap, contrast for the image.

@thewtex
Copy link
Member Author

thewtex commented Feb 16, 2021

Let's keep pushing forward Python plugins that provide the desired functionality.

Eventually in the config object, we will support an entire image configuration (data + complete config).

@thewtex thewtex merged commit d936307 into Kitware:master Feb 17, 2021
@thewtex thewtex deleted the use-pixelType-for-independentComponents branch February 17, 2021 19:45
@github-actions
Copy link

🎉 This PR is included in version 11.1.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants