[vtk-developers] Possible vtkScalarBarActor improvement

Wang, Kevin kevin.wang at rmp.uhn.on.ca
Mon Sep 16 10:34:49 EDT 2013


Hi David,

Thanks for your comments. 

The SetAnnotation method in vtkScalarsToColors is what I need in deed. I guess I did not track the changes happened in VTK 6.0 closely (Slicer is using vtk 5.10). 

The interface is fine. I wonder if it is possible to add a method to control whether values are used for labels in the vtkScalarBarActor or the annotations are used. This way I do not need to keep 2 sets of vtkStringArrays (one is the values and the other is the annotations) around and can just switch between them using vtkScalarBarActor::UseValueAsLabels() and/or ::UseAnnotationAsLabels.

Jc, I am not sure how much effort is needed to backport the new vtkScalarsToColors and vtkScalarBarActor into vtk5.10, I think probably we should just integrate my original topic into Slicer. Then when Slicer migrate to vtk6.0, we can start to use to new functionality in vtkScalarsToColors. 

Thanks,

Kevin

-----Original Message-----
From: David Thompson [mailto:david.thompson at kitware.com] 
Sent: Sunday, September 15, 2013 2:42 PM
To: Wang, Kevin
Cc: 'Jean-Christophe Fillion-Robin'; vtk-developers at vtk.org
Subject: Re: [vtk-developers] Possible vtkScalarBarActor improvement

Hi Kevin,

> Before I contribute a patch, I would like to ask something. What I did for slicer is to create a subclass of vtkScalarBarActor to accommodate the color name changes, but I think it might not be good to create a subclass of vtkScalarBarActor just to add one method and one variable. Do you think maybe directly modify the vtkScalarBarActor would make more sense?

I'm curious how what you did is different than the SetAnnotation method already in vtkScalarsToColors (an instance of which is illustrated by the vtkScalarBarActor). From the code on github, it appears that you override the label text already set on the lookup table using either vtkScalarsToColors::SetAnnotation or vtkScalarsToColors::SetAnnotations. Is it that you want to switch between one set of labels and another (e.g., color names and descriptive text)? In that case, I would recommend keeping multiple vtkStringArrays with the different text and using vtkScalarsToColors::SetAnnotations to switch between them. Or did you have something else in mind?

If the existing interface is cumbersome for your use case, I am open to suggestions but don't want to duplicate functionality that's already there.

	Thanks,
	David 

> From: Jean-Christophe Fillion-Robin [mailto:jchris.fillionr at kitware.com] 
> Sent: Friday, September 13, 2013 1:02 PM
> To: Wang, Kevin
> Cc: vtk-developers at vtk.org
> Subject: Re: [vtk-developers] Possible vtkScalarBarActor improvement
>  
> Hi Kevin, 
>  
> I think it makes sense to contribute this back to VTK. I would suggest to first contribute your improvement as a VTK-6 topic. 
>  
> See http://www.vtk.org/Wiki/VTK/Git/Develop
>  
> In the mean, waiting it his fully reviewed, integrated and then eventually backported to VTK 5.10 release branch, we could integrate it to the SlicerVTK clone. See https://github.com/Slicer/VTK
>  
> Thanks for contributing to VTK, 
> Jc
>  
> 
> On Fri, Sep 13, 2013 at 10:46 AM, Wang, Kevin <kevin.wang at rmp.uhn.on.ca> wrote:
> Hi vtk-developers,
>  
> I am developing modules in Slicer and found one limitation in vtkScalarBarActor.
>  
> Currently vtk scalarbar widget only shows scalar value as labels. It would be useful in some applications to show the color names as labels. For example: when using the Slicer3_2010_label_Colors color table in slicer, instead of showing the scalar values, it would be nice to show the color names as labels in scalarbar widget. Please find more info about this at http://na-mic.org/Mantis/view.php?id=2919
>  
> To enable this feature, I have created a new sub class of vtkScalarBarActor which allows adding color names with a method:  
>  
> int SetColorName(int ind, const char *name);
>  
> It also has a variable to enable/disable using the color as label. Please see the code ashttps://github.com/kevinwangcanada/Slicer/blob/2919-Add-UseColorNameAsLabel-for-scalarbar-widget/Modules/Loadable/Colors/VTKRendering/vtkSlicerScalarBarActor.h
>  
> Before we merge this into the slicer trunk, we would like to know if you think it is relevant and something like this can be merged into VTK. I have also created a ticket for this: http://www.vtk.org/Bug/view.php?id=14272
>  
> Thanks for your consideration.
>  
> Kevin
>  
> 
> This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. 
> Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. 
> If you have received this e-mail in error, please contact the sender and delete all copies. 
> Opinions, conclusions or other information contained in this e-mail may not be that of the organization.
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
> 
> 
> 
> 
>  
> -- 
> +1 919 869 8849
> 
> This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. 
> Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. 
> If you have received this e-mail in error, please contact the sender and delete all copies. 
> Opinions, conclusions or other information contained in this e-mail may not be that of the organization. _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers


This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. 
Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. 
If you have received this e-mail in error, please contact the sender and delete all copies. 
Opinions, conclusions or other information contained in this e-mail may not be that of the organization.




More information about the vtk-developers mailing list