[Paraview] "Rotate" look up table

Sebastien Jourdain sebastien.jourdain at kitware.com
Fri Feb 3 10:10:58 EST 2017


Hi Nicolas,

You can create a programmable filter that will alter the scalars based on a
"fake" time.
I've attached an example on how to create a time based filter.

Good luck,

Seb

PS: I'm not sure, the latest ParaView allow programable filter to be time
aware. If not, I've also attached an XML (plugin) that you can load and use
for that filter.

On Fri, Feb 3, 2017 at 1:47 AM, Nicolas Cedilnik <nicolas.cedilnik at inria.fr>
wrote:

> Hi all,
>
> I'm replying to my own email because I worked out a solution and wanted to
> share but also because I believe what I'm doing is FAR from optimal and
> hope that someone
>
>> Would it be possible with python scripting to create an animation by
>> "rotating" the look up table in a way that would look like this:
>> https://www.youtube.com/watch?v=qA_vInXwdKM#t=3m25s ? It is a
>> pseudo-animation created by changing the "range" of the LUT.
>>
> So I made this python script (see attachment) that generates different
> meshes with scalar values "rotated" (I don't find a better term to describe
> what I'm doing).
> It works and make it easy to play the animation by opening the produced
> vtk files as a sequence in paraview.
>
> However, every vtk file contains both the mesh geometry and the scalar
> values, but only the latter change. What would be the right way to animate
> only the scalar values and not the mesh geometry? What data format should I
> use? How could I import it into an animation in paraview?
>
> Thanks for your guidance
>
> --
> Nicolas
>
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170203/6731ad2a/attachment.html>
-------------- next part --------------
# =============================================================================
# Request Data
# =============================================================================
import vtk

executive = self.GetExecutive()
outInfo = executive.GetOutputInformation(0)

req_timestep = outInfo.Get(executive.UPDATE_TIME_STEP())
print req_timestep

input = self.GetPolyDataInput()
inputCells = input.GetPolys()
newCells = vtk.vtkCellArray()

# Keep cells in range
nbCells = inputCells.GetNumberOfCells()
allowedIds = range(int(req_timestep) * (nbCells / 5), (int(req_timestep) + 1) * (nbCells / 5))

cellLocation = 0
ids = vtk.vtkIdList()
for cellIdx in range(nbCells):
    inputCells.GetCell(cellLocation, ids)
    cellSize = ids.GetNumberOfIds()
    if cellIdx in allowedIds:
        newCells.InsertNextCell(ids)
    cellLocation += cellSize + 1

self.GetPolyDataOutput().ShallowCopy(input)
self.GetPolyDataOutput().SetPolys(newCells)

# =============================================================================
# Request Informations
# =============================================================================

timesteps = range(5)
executive = self.GetExecutive()
outInfo = executive.GetOutputInformation(0)

outInfo.Remove(executive.TIME_STEPS())
for timestep in timesteps:
   outInfo.Append(executive.TIME_STEPS(), timestep)
   outInfo.Remove(executive.TIME_RANGE())
   outInfo.Append(executive.TIME_RANGE(), timesteps[0])
   outInfo.Append(executive.TIME_RANGE(), timesteps[-1])
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TemporalPythonProxy.xml
Type: text/xml
Size: 1023 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170203/6731ad2a/attachment.xml>


More information about the ParaView mailing list