Talk:VTK: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
(2D rectilinear Grid using Legacy ASCII VTK)
No edit summary
Line 44: Line 44:
Gordon Taub
Gordon Taub
gotaub@u.washington.edu
gotaub@u.washington.edu
Dear VTK User
I am a vtk user and unfortunetly relatively new to it, I have search the archives and the post “How to write multiple vtkPolyData into on single XML file” is the closest I’ve come to what I’m trying to do. I have created two series of vtkPoints and saved them out in the polydata format with vtkPolyDataWriter, once I have saved them I try to bring them both into a new program and merge them together using vtkAppendPolyData. Whenever I try to merge two files or even a file and some already existing PolyData it won’t render them out.
I have provided my code below:
package require vtk
package require vtkinteraction
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
ren1 SetBackground 1.8 1.8 1.8
renWin SetSize 720 720
# Import two PolyData Files.
vtkPolyDataReader reader1
            reader1 SetFileName "d:/education/spencer/simulation/servers.txt"
            reader1 update
vtkPolyDataReader reader2
            reader2 SetFileName "d:/education/spencer/simulation/points.txt"
            reader2 update
# Appended into a single polydata.
vtkAppendPolyData apd
    apd AddInput [reader1 GetOutput]
    apd AddInput [reader2 GetOutput]
vtkSphereSource node
                        node SetRadius 1.25
                        node SetPhiResolution 18
                        node SetThetaResolution 18
#create a glyph using 'balls' as the object and 'inputData' for location with 3D space
vtkGlyph3D glyphPointsServers
            glyphPointsServers SetInputConnection [apd GetOutputPort]
            glyphPointsServers SetSource [node GetOutput]
#Assign simple mapper to glyph
vtkPolyDataMapper glyphMapperServers
            glyphMapperServers SetInput [glyphPointsServers GetOutput]
#create actor of gylph to enable rendering of points
vtkActor glyphServers
            glyphServers SetMapper glyphMapperServers
            [glyphServers GetProperty] SetColor 255 0 0
            [glyphServers GetProperty] SetSpecular .3
            [glyphServers GetProperty] SetSpecularPower 10
            ren1 AddActor glyphServers
renWin Render
Thankyou for any help you can provide,

Revision as of 11:46, 11 December 2007

Hi,

I am a new user about VTK. My operating system is Windows XP. I downloaded and installed vtk42-LatestRelease.exe into the folder C:\Program Files\vtk42. The path and classpath as follows:


PATH: C:\MikTeX\miktex\bin; C:\Program Files\Java\jdk1.5.0_01\bin;C:\PROGRA~1\vtk42\bin;C:\PROGRA~1\Tcl\bin

CLASSPATH: .;C:\Program Files\Java\jdk1.5.0_01\lib\tools.jar; C:\Program Files\vtk42\bin\vtk.jar;

After the installation, I restart my computer. Then I try to compile Cone.java to test vtk. However, I got the error message said: package vtk does not exist on the line of import vtk.*. There are 11 error message in total, that was the first one and all of the rest are related to vtk stuff.

Any suggestions are highly appreciated!

ct 512x512 images in ray-casting, the axis image is divided ,why

 my code is as following:

vtkVolume16Reader *v16 = vtkVolume16Reader::New();

v16->SetDataDimensions(512,512);
v16->SetDataByteOrderToLittleEndian();
v16->SetFilePrefix ("D:/AMy_career/papercode/image/1.CT.THORAX_LUNGLOWDOSE_(ADULT).1");
v16->SetImageRange(1,10);

v16->SetDataSpacing (0.5859375, 0.5859375, 2);

questiion about GetBounds()

I want to get the bound of the DEM ,so i used vtkDataSet::GetBounds();but the return vale(zmin = = zmax).I don't know why to that?  I want get the range of  the XYZ three orientations  of  the DEM. How to get it? Thanks at first.

2D rectilinear Grid using Legacy ASCII VTK

I'm new to this forum and hope I'm doing this right.

I'm writing a program that will convert the output from my professor's simulation software into a format that visualization software packages such as Paraview and VisIt can read. I'm using legacy ASCII VTK and my program is working beautifully for 3D data.

I can't seem to get it to work for 2D data. I'm using the RECTILINEAR_GRID data structure this works for 3D data but I think I might be misinterpreting how to alter the file layout for 2D data, or perhaps this dataset only works on 3D data? I've also tried using the dataset STRUCTURED_GRID, and have not gotten this work either.

The data I wish to visualize is 2D rectilinear where dx dy and dz are all constants on the grid.

Does anybody have a sample Legacy VTK file with this type of data that they can e-mail me or post? I'm sure if I can look at a sample file for 2d rectilinear data I can figure out how my file needs to be formatted.

Gordon Taub gotaub@u.washington.edu

Dear VTK User

I am a vtk user and unfortunetly relatively new to it, I have search the archives and the post “How to write multiple vtkPolyData into on single XML file” is the closest I’ve come to what I’m trying to do. I have created two series of vtkPoints and saved them out in the polydata format with vtkPolyDataWriter, once I have saved them I try to bring them both into a new program and merge them together using vtkAppendPolyData. Whenever I try to merge two files or even a file and some already existing PolyData it won’t render them out.

I have provided my code below:


package require vtk package require vtkinteraction

vtkRenderer ren1 vtkRenderWindow renWin renWin AddRenderer ren1 vtkRenderWindowInteractor iren iren SetRenderWindow renWin ren1 SetBackground 1.8 1.8 1.8 renWin SetSize 720 720

  1. Import two PolyData Files.

vtkPolyDataReader reader1

           reader1 SetFileName "d:/education/spencer/simulation/servers.txt"
           reader1 update

vtkPolyDataReader reader2

           reader2 SetFileName "d:/education/spencer/simulation/points.txt"
           reader2 update
  1. Appended into a single polydata.

vtkAppendPolyData apd

   apd AddInput [reader1 GetOutput]
   apd AddInput [reader2 GetOutput]

vtkSphereSource node

                       node SetRadius 1.25
                       node SetPhiResolution 18
                       node SetThetaResolution 18

  1. create a glyph using 'balls' as the object and 'inputData' for location with 3D space

vtkGlyph3D glyphPointsServers

           glyphPointsServers SetInputConnection [apd GetOutputPort]
           glyphPointsServers SetSource [node GetOutput]

  1. Assign simple mapper to glyph

vtkPolyDataMapper glyphMapperServers

           glyphMapperServers SetInput [glyphPointsServers GetOutput]

  1. create actor of gylph to enable rendering of points

vtkActor glyphServers

           glyphServers SetMapper glyphMapperServers
           [glyphServers GetProperty] SetColor 255 0 0
           [glyphServers GetProperty] SetSpecular .3
           [glyphServers GetProperty] SetSpecularPower 10
           ren1 AddActor glyphServers

renWin Render


Thankyou for any help you can provide,