[vtkusers] Please help me!!!

Vicky bonsai19 at gmx.de
Tue Oct 28 09:47:06 EDT 2008


//Dear VTK users,

I'm a new user of VTK and so I hope someone can help me.
Basically, I'm trying to model segmented data in VTK, based on the tutorial, provided in:
http://www.cs.utah.edu/classes/cs5630/vtk%204.4.2/vtkhtml/applications/segment/segmented16.html

///Now I am //trying to use my own data with the above scripts.
The 160 segmented images I use are 340 x 234 and 24 bit rgb bmp-images. The slices are 
indexed. So the color of each Pixel is represented by an integer value of the color 
palette.

I thought that the integer value in the color palette is the parameter for the 
ThresholdBetween-Method. But this seems to be wrong because no model is rendered. 

So how can I see or calculate this value, which is used of the 
ThresholdBetween-Method???

The script I have written is:

vtkBMPReader bmpReader = new vtkBMPReader();
bmpReader.SetDataExtent(0, 340, 0, 234, 1, 60);
bmpReader.SetDataSpacing(dataSpacing);       
bmpReader.SetFilePattern(imageVTK.data);
bmpReader.SetDataScalarTypeToUnsignedShort();
bmpReader.GetOutput().ReleaseDataFlagOn();
bmpReader.Update();

public vtkImageAlgorithm image;
image = bmpReader;

vtkImageThreshold threshold = new vtkImageThreshold();
threshold.ThresholdBetween(159.0, 159.0);
threshold.SetInValue(255);
threshold.SetOutValue(0);
threshold.SetInput(image.GetOutput());

vtkImageToStructuredPoints structuredPoints = new vtkImageToStructuredPoints();
structuredPoints.SetInput(threshold.GetOutput());
structuredPoints.GetOutput().ReleaseDataFlagOn();

vtkMarchingCubes marchingCubes = new vtkMarchingCubes();
marchingCubes.SetInput(structuredPoints.GetOutput());
marchingCubes.ComputeScalarsOff();
marchingCubes.ComputeGradientsOff();
marchingCubes.ComputeNormalsOff();
marchingCubes.SetValue(0, 12);

vtkPolyDataNormals normals = new vtkPolyDataNormals();
normals.SetInput(marchingCubes.GetOutput());
normals.SetFeatureAngle(featureAngle);
normals.GetOutput().ReleaseDataFlagOn();

vtkStripper stripper = new vtkStripper();
stripper.SetInput(normals.GetOutput());
stripper.GetOutput().ReleaseDataFlagOn();

vtkPolyDataWriter writer = new vtkPolyDataWriter();
writer.SetInput(stripper.GetOutput());
writer.SetFileName("Model.vtk");
writer.SetFileType(2);

writer.Update();
///
vtkPolyDataReader reader = new vtkPolyDataReader();
reader.SetFileName("Model.vtk");

vtkPolyDataMapper mapper = new vtkPolyDataMapper();
mapper.SetInputConnection(reader.GetOutputPort());
mapper.ScalarVisibilityOff();

m_actor.SetMapper(mapper);

m_ren.AddActor(m_actor);


I hope someone help me.

////Warm Regards

Vicky
//




More information about the vtkusers mailing list