[vtkusers] Compute vorticity from imagedata
David E DeMarle
dave.demarle at kitware.com
Wed Jun 10 18:24:33 EDT 2015
Use a writer to write out the input data set to a different file.
Are the two files the same size?
In paraview, how many arrays are there in each file?
David E DeMarle
21 Corporate Drive
Clifton Park, NY 12065-8662
On Wed, Jun 10, 2015 at 6:15 PM, Stephen Hamilton <
stephenshamilton at gmail.com> wrote:
> I'm fairly new to VTK, but I've been stuck for over a day on trying to
> figure out a fairly simple task.
> I have a numpy array that I'm trying to convert to image data (structured
> grid), compute the vorticity, and use the cellderivatives to create an
> array of vorticity magnitude. I can do this easily in Paraview, but in
> python the cell derivatives never seem to compute.
> Here is what I have so far:
> vtkdata = numpy_support.numpy_to_vtk(h5file[i][:,:,:,:].ravel(),
> deep=True, array_type=vtk.VTK_FLOAT)
> image = vtk.vtkImageData()
> image.SetDimensions(xl, yl, zl) #This is set above and matches the numpy
> At this point, if I write the vti file using vtkXMLImageDataWriter(), I
> get what I expect in Paraview when I load it.
> Here is where I have problems:
> vorticity = vtk.vtkCellDerivatives()
> vwriter = vtk.vtkXMLImageDataWriter()
> When I check the vorticity file, it is basically the same as if I never
> applied the cell derivative filter. I've tried using the imagestreamer,
> and basically still get the same results. I can't seem to find a good vtk6
> example on the web that is close enough to what I'm trying. I also tried
> the threshold function, and got the same thing, so I think I'm applying the
> filter incorrectly (not at all in the case).
> Any help would be much appreciated!
> PhD Student, Johns Hopkins University
> Powered by www.kitware.com
> Visit other Kitware open-source projects at
> Please keep messages on-topic and check the VTK FAQ at:
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> Follow this link to subscribe/unsubscribe:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers