[vtkusers] Colour map complex scalars

David Gobbi david.gobbi at gmail.com
Thu Apr 7 16:31:02 EDT 2011


Hi John,

I've also been thinking about mapping complex scalars, because I know
it is an issue that I will run into sooner rather than later.  However
it isn't just complex data that I'll have to worry about, but
multi-channel data in general.

My thought was to add multi-channel mapping directly to
vtkScalarsToColors (the base class of vtkLookupTable), by making it
possible to add "child" tables that will be used if the input has
multiple components.  In practice, it would look something like this:

table->SetVectorModeToIndependent(); // map each component independently
table->SetComponentTable(0, table_for_real);
table->SetComponentTable(1, table_for_imag);

Given a single-channel input, the base table would be used, but given
a multi-channel input, the "child" tables would be used.

Putting these features into the vtkScalarsToColors base class would
also effectively force the mappers/painters to play along and provide
similar multi-channel color mapping features.  For example, scalars
with N independent channels can be color-mapped by an NxM texture
where M is greater than or equal to the number of colors per table.

For images I've used an in-house class called vtkImageComposite for
accomplish basically the same thing (it is image-specific) but, as you
say, it would be nice to have multi-channel capability built directly
into vtkLookupTable.

 - David


On Thu, Apr 7, 2011 at 1:54 PM, John Platt <jcplatt at dsl.pipex.com> wrote:
>
> Hi,
>
> I would like to colour map complex scalars. This could be the magnitude or the real part after multiplying the scalars by exp(i theta) for a specified angle theta.
>
> I have written a class vtkLookupTableComplex derived from vtkLookupTable. MapScalarsThroughTable2() does the conversion of the real and imaginary components to a single value which is then mapped through the table.
>
> This appears to work except when InterpolateScalarsBeforeMapping is set on the mapper. In this case, the scalars are mapped by vtkScalarsToColorsPainter::MapScalarsToTexture().
>
> I am beginning to think a vtkDataSetAlgorithm based solution would be easier but I need the performance for animating the scalars by varying the angle theta from 0 - 360.
>
> Should I give up or is there another approach?
>
> Thanks for your time.
>
> John.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list