itkwidgets
itkwidgets copied to clipboard
Colormap Issues
I'm trying to add a custom colormap for use with a point cloud. I would like each point to have its own color. I have two arrays one containing the X,Y,Z coordinates of each point and the other contains the RGB values. From what I understand the only way I can colorize each point individually is through a colormap, is this correct?
When trying to change the colormap to a custom one I get the following error:
The 'cmap' trait of a Viewer instance must be a list or None, but a value of class 'numpy.ndarray' [....] was specified.
In fact, the example SpecifyAColormap seems to suffer the same error.
I'm using version 0.30.0 on ubuntu 18.04. Any ideas? Thanks.
Hi there,
This feature is not yet available, but we are working towards it. We recently started lookup table support, per the LabelImages example. As a next step, we will add support for custom lookup tables. Then, we will add support for lookup tables to associate with the point data on a point set.
Thanks for the quick response. It's great to hear that this is something that is on your radar. I've currently been using a mesh without any faces as a point cloud. By using the scalar attribute I can color each vertex independently and loosely emulate a point cloud. It works decently well although I cannot control the size of each point and when zooming in they disappear progressively...
As far as the colormap issue, is there something I'm doing wrong? I still get the same error as above even with a clean install. Thanks!
As far as the colormap issue, is there something I'm doing wrong?
No, you are not doing anything wrong, the feature is just not implemented yet.
Hi there,
This feature is not yet available, but we are working towards it. We recently started lookup table support, per the LabelImages example. As a next step, we will add support for custom lookup tables. Then, we will add support for lookup tables to associate with the point data on a point set.
Hi, on a related issue, is it possible to create LUT with opacity assoicated with each color?
Much like the MevisLab Viewer below.
Yes, checkout out the label_image_weights
trait in the LabelImage example.
Yes, checkout out the
label_image_weights
trait in the LabelImage example.
Yes, I saw the example, but it differs from my use-case:
- the example assigns customize opacity to each label map
- I want to assign customize opacity to selected value/color, and have interpolated opacity+color in between -- shown in the top-right diagram, it has value histogram + color (in circle) + opacity (the height of circle) + inbetween interpolation (in straight line) )
PS: itk.prox_tv_image_filter is not avaliable in my environment, which uses ITK5.10 + python3.6, any idea why?
I want to assign customize opacity to selected value/color, and have interpolated opacity+color in between -- shown in the top-right diagram, it has value histogram + color (in circle) + opacity (the height of circle) + inbetween interpolation (in straight line) )
There is an opacity transfer function editor for the color map:
PS: itk.prox_tv_image_filter is not avaliable in my environment, which uses ITK5.10 + python3.6, any idea why?
Install the package:
pip install itk-totalvariation
how to pass in/output such opacity transfer function, rather than manually adjust it each time?
@qianyizhang see https://github.com/InsightSoftwareConsortium/itkwidgets/blob/master/examples/VolumeOpacityTransferFunction.ipynb
thanks! one last question, when adding multiple gaussian opacity curves (with overlapping range), the final transfer function is the summation of ALL and clip to 1.0? Or is there more math into this?
@qianyizhang the result it is maximum of all opacity gaussian's, which are limited to 1.0.