Kitware / itk-vtk-viewer

2D / 3D web image, mesh, and point set viewer using itk-wasm and vtk.js
https://kitware.github.io/itk-vtk-viewer/
BSD 3-Clause "New" or "Revised" License
210 stars 64 forks source link

WIP: fix(Viewer): Make sure 2D images are rendered as before #258

Closed scottwittenburg closed 4 years ago

scottwittenburg commented 4 years ago

Sets independentComponents = false under conditions described in #257.

scottwittenburg commented 4 years ago

@thewtex When showing a 2D RGB image (or more specifically, when we set independentComponents = false), should we still show the component selector?

oeway commented 4 years ago

Would it make sense to still use independent components, but set default color maps for displaying RGB and alpha?

Also, I think it would be nice if we can choose different modes programmatically with publicAPI.

thewtex commented 4 years ago

(or more specifically, when we set independentComponents = false), should we still show the component selector?

The component selector should be hidden in this case.

thewtex commented 4 years ago

Would it make sense to still use independent components, but set default color maps for displaying RGB and alpha?

Also, I think it would be nice if we can choose different modes programmatically with publicAPI.

Selection of independent may be possible -- we would have to constrain it to the cases when it is possible to use both independent or dependent components. Dependent components is likely a better default for the 2D RGB case since that is standard way those images are visualized and the extra complexity may be distracting.

scottwittenburg commented 4 years ago

(or more specifically, when we set independentComponents = false), should we still show the component selector?

The component selector should be hidden in this case.

But we should still show the grayscale colormap editor and that histogram panel?

thewtex commented 4 years ago

But we should still show the grayscale colormap editor and that histogram panel?

Previously, the default piecewise function in this case was set to be effectively all 1's. It would ideally be removed, but the window-level slider bar and histogram are still needed.

scottwittenburg commented 4 years ago

Would it make sense to still use independent components, but set default color maps for displaying RGB and alpha?

@oeway Do you have an image you could share that would let us explore whether using independent components with RGB images might make sense or not?

Also, I think it would be nice if we can choose different modes programmatically with publicAPI.

I'm not sure I understand your intention here. Which modes you want to choose programmatically? What API should expose those options?

scottwittenburg commented 4 years ago

But we should still show the grayscale colormap editor and that histogram panel?

Previously, the default piecewise function in this case was set to be effectively all 1's. It would ideally be removed, but the window-level slider bar and histogram are still needed.

Just checking what you mean here. I understand you want to keep the histogram in 2D mode, that's clear.

Re the default (all 1's) piecewise function: It seems to be used in rendering the image/volume, so we should keep it, but do you want to remove the ability to edit it, delete it, add more pwfs, etc?

Re the window-level slider bar: I don't see this. Am I just looking at a dataset that doesn't result in it getting added to the view?

scottwittenburg commented 4 years ago

Would it make sense to still use independent components, but set default color maps for displaying RGB and alpha?

@oeway Do you have an image you could share that would let us explore whether using independent components with RGB images might make sense or not?

Also, I think it would be nice if we can choose different modes programmatically with publicAPI.

I'm not sure I understand your intention here. Which modes you want to choose programmatically? What API should expose those options?

So I've just noticed the publicAPI methods in the bottom of createViewer.js. Are you embedding the viewer in some other application of your own and using those methods to control it? In that light, maybe I do understand your request. You're probably asking to expose the independentComponents on the volume/image property objects?

oeway commented 4 years ago

Hi, thanks for working on this. Here is one example image I would like to display. On the one hand, I would like to see the image appears in RGB mode and be able to adjust brightness for all components jointly, on the other hand, I would like to adjust each component independently to balance the brightness for each channel.

For the publicAPI, yes, I am using it in other applications and would like to able to access the independentComponents programmatically.

thewtex commented 4 years ago

Re the default (all 1's) piecewise function: It seems to be used in rendering the image/volume, so we should keep it, but do you want to remove the ability to edit it, delete it, add more pwfs, etc?

Since we have the ability to define a piecewise transfer function in the multi-component case :sun_with_face: , we could make it editable only in the case of multiple-components or 3D -- in the case of 2D scalar data it does have an effect. If we can fix it, great, but it is not a big priority.

Re the window-level slider bar: I don't see this.

image

It shows up as blue when mousing over the transfer function editor.

You're probably asking to expose the independentComponents on the volume/image property objects?

:+1:

scottwittenburg commented 4 years ago

@thewtex I think this has everything we talked about for a short-term set of fixes, please take a look when you get a chance.

thewtex commented 4 years ago

:tada: This PR is included in version 9.21.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: