[vtkusers] .fgrid and .fflow file formats

Sriharsha Sista sistaharsha at gmail.com
Mon Apr 16 16:17:18 EDT 2007


 Are there any vtk readers for .fgrid and .fflow files within VTK?

I have tried to use the vtkPLOT3DReader class .. but cant get it to do
everything that i want it to for the scalars in the data..


I am also pasting an example rogram here.. if there is someone out there who
knows about this.. please let me know what the problem is.. the example
works fine with thw combxyz.bin and combq.bin files provided with the VTK
data cd.

 Number of Outputs returned a value 1 and also the normals were not computed
as it said there is no data to find normals.. but I have data in the files
for sure..

import vtk.*;

import javax.swing.*;

import java.awt.*;

import java.awt.event.WindowAdapter;

import java.awt.event.WindowEvent;

/**

* This example shows how to use isosurfaces

*/

public class CombIso {

// in the static contructor we load in the native code

// The libraries must be in your path to work

static {

System.loadLibrary("vtkCommonJava");

System.loadLibrary("vtkFilteringJava");

System.loadLibrary("vtkIOJava");

System.loadLibrary("vtkImagingJava");

System.loadLibrary("vtkGraphicsJava");

System.loadLibrary("vtkRenderingJava");

}

public static void main(String s[]) {

// Read the data files

vtkPLOT3DReader pl3d = new vtkPLOT3DReader();

pl3d.SetXYZFileName("path/gridFileName.fgrid");

pl3d.SetQFileName("path/flowFileName.fflow");

pl3d.SetScalarFunctionNumber(100);

pl3d.SetVectorFunctionNumber(202);

System.out.println("NUmber of Outputs: " + pl3d.GetNumberOfGrids()); // the
number of outputs returned a value 1

pl3d.Update();

System.out.println("NUmber of Outputs: " + pl3d.GetNumberOfGrids());

vtkContourFilter iso = new vtkContourFilter();

iso.SetInput(pl3d.GetOutput());

iso.SetValue(0, .38);

vtkPolyDataNormals normals = new vtkPolyDataNormals();

normals.SetInput(iso.GetOutput());

normals.SetFeatureAngle(45);

vtkPolyDataMapper isoMapper = new vtkPolyDataMapper();

isoMapper.SetInput(normals.GetOutput());

isoMapper.ScalarVisibilityOff();

vtkActor isoActor = new vtkActor();

isoActor.SetMapper(isoMapper);

isoActor.GetProperty().SetColor(1.0, 0.0, 0.0);

vtkStructuredGridOutlineFilter outline = new

vtkStructuredGridOutlineFilter();

outline.SetInput(pl3d.GetOutput());

vtkPolyDataMapper outlineMapper = new vtkPolyDataMapper();

outlineMapper.SetInput(outline.GetOutput());

vtkActor outlineActor = new vtkActor();

outlineActor.SetMapper(outlineMapper);

outlineActor.GetProperty().SetColor(0.0, 0.0, 1.0);

// Add the actors to the renderer, set the background and size

vtkRenderer renderer = new vtkRenderer ();

vtkRenderWindow renWin = new vtkRenderWindow();

renWin.AddRenderer(renderer);

renderer.AddActor(outlineActor);

renderer.AddActor(isoActor);

renderer.SetBackground(1, 1, 1);

vtkCamera cam1 = renderer.GetActiveCamera();

cam1.SetClippingRange( 3.95297, 50);

cam1.SetFocalPoint( 9.71821, 0.458166, 29.3999);

cam1.SetPosition( 2.7439, -37.3196, 38.7167);

cam1.ComputeViewPlaneNormal();

cam1.SetViewUp(-0.16123, 0.264271, 0.950876);

vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();

iren.SetRenderWindow(renWin);

renWin.SetSize(500, 500);

renWin.Render();

iren.Start();

}//main

}//CombIso




Thanks,

Sriharsha Sista
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070416/7e7f57ee/attachment.htm>


More information about the vtkusers mailing list