Talk:VTK

From KitwarePublic
Revision as of 23:12, 4 August 2008 by Chirod (talk | contribs) (vtk3DSImporter usage.)
Jump to navigationJump to search

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,

vtk3DSImporter usage.

In using the vtk3DSImporter, I converted a 3D Studio Max (.max) file into a 3DS (.3ds) format so that I could import within VTK. However, the color schemes are not matching up because the original .max file contains sub-materials instead of just materials. I found the vtk3DSImporter.cxx file and extracted some of the code within the class and used it after executing vtk3DSImporter->Read. I traversed the meshlist, material property list, and created actors. I assigned the correct material to each actor. I also traversed the polyData list and assigned a transform filter to each polyData item. I added each item to a vtkAppendPolyData variable.

This takes a long time within the code, but I can translate and rotate the 3DS file after it has been imported. But the color schemes are wrong, mostly coming out white or transparent.

Has anyone figured out how to accomplish this properly? I find it hard to believe that vtk3DSImporter is only used for just seeing what a 3DS file looks like. The object should be available within vtk for translating, scaling, and rotating.

I also converted the 3DS file to a .obj (Wavefront) file. A material file is created which specifies the ambient, diffuse, and specular colors for each material. The .obj file specifies which material is to be used with each face. However, the vtkOBJReader class does not even use the .mtl file. Hence, one gets no color with each face. I also checked the vtkOBJReader.cxx file and it ignores the .mtl file altogether.

Has anyone figured out a way to use the .mtl file within the vtkOBJReader class?

Thanks