[Paraview] Transform Filter Loses Colors

Sven Buijssen sven.buijssen at tu-dortmund.de
Fri Sep 11 12:22:33 EDT 2009


Hi David,

You can use a Programmable Filter to convert the data back to unsigned char to
work around the problem for now:

---
inp = self.GetInput()
out = self.GetOutput()

numCells  = inp.GetNumberOfCells()
data = inp.GetCellData().GetArray("Colors")

newData = vtk.vtkUnsignedCharArray()
newData.SetName('Colors_converted')
newData.SetNumberOfComponents(3)
for i in range(0, 3*numCells, 3):
  val1 = int(data.GetValue(i))
  val2 = int(data.GetValue(i+1))
  val3 = int(data.GetValue(i+2))
  newData.InsertNextValue(val1)
  newData.InsertNextValue(val2)
  newData.InsertNextValue(val3)
out.GetCellData().AddArray(newData)
---


Sven


----- Original Message -----
From: David Doria <daviddoria at gmail.com>
To: ParaView <paraview at paraview.org>
CC: ParaView <paraview at paraview.org>
Sent: 09/11/09 17:46:54
Subject: [Paraview] Transform Filter Loses Colors
> 
> On Fri, Sep 11, 2009 at 11:40 AM, Utkarsh Ayachit
> <utkarsh.ayachit at kitware.com <mailto:utkarsh.ayachit at kitware.com>> wrote:
> 
>     I am not sure why, but the transform filter converts the "Colors"
>     array from unsigned-char to float. And hence, map-scalars is no longer
>     available.
> 
>     Utkarsh
> 
> 
> So this essentially breaks the coloring right? The colors now appear as
> shades between blue and red - there is no way to tell Paraview to use
> float [0,1] RGB coloring? Is the course of action from here to ask the
> VTK developers why this happens and if it can be specified/changed?
> 
> Thanks,
> 
> David
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView
> 
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview



More information about the ParaView mailing list