itkwidgets icon indicating copy to clipboard operation
itkwidgets copied to clipboard

Colormap Issues

Open jungerm2 opened this issue 4 years ago • 11 comments

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.

jungerm2 avatar Jun 25 '20 19:06 jungerm2

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.

thewtex avatar Jun 26 '20 02:06 thewtex

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!

jungerm2 avatar Jun 26 '20 14:06 jungerm2

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.

thewtex avatar Jun 26 '20 14:06 thewtex

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. image

qianyizhang avatar Jun 30 '20 13:06 qianyizhang

Yes, checkout out the label_image_weights trait in the LabelImage example.

thewtex avatar Jul 02 '20 01:07 thewtex

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?

qianyizhang avatar Jul 02 '20 02:07 qianyizhang

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:

3DImage - Jupyter Notebook (1)

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

thewtex avatar Jul 02 '20 15:07 thewtex

how to pass in/output such opacity transfer function, rather than manually adjust it each time?

qianyizhang avatar Jul 02 '20 15:07 qianyizhang

@qianyizhang see https://github.com/InsightSoftwareConsortium/itkwidgets/blob/master/examples/VolumeOpacityTransferFunction.ipynb

thewtex avatar Jul 06 '20 03:07 thewtex

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 avatar Jul 07 '20 04:07 qianyizhang

@qianyizhang the result it is maximum of all opacity gaussian's, which are limited to 1.0.

thewtex avatar Jul 08 '20 14:07 thewtex