[vtkusers] Modifying Medical1.cxx to use images already in memory

Norman Young norman at clearcanvas.ca
Sat Oct 14 13:58:27 EDT 2006


Hi,

I'm new to VTK and have what seems to be a pretty basic question.  I'm
trying to modify the Medical1.cxx sample so that instead of reading
from disk using vtkVolume16Reader, it uses pixel data that I already
have in memory in my application. What might be the best way of doing
that?

So far, I've created (I think) a volume with vtkImageData, then tried
to set the input on the vtkContourFilter to the volume.  It looks
something like this (BTW, I'm using C#):

vtkImageData volumeData = new vtkImageData();

[fill volumeData with some data here]

vtkContourFilter skinExtractor = new vtk.vtkContourFilter();
skinExtractor.SetInput(volumeData);
skinExtractor.SetValue(0, 500);
vtkPolyDataNormals skinNormals = new vtk.vtkPolyDataNormals();
skinNormals.SetInputConnection(skinExtractor.GetOutputPort());

[rest of the sample code here]

When I run this, I get this error:

ERROR: In ..\..\vtk\Graphics\vtkPolyDataNormals.cxx, line 94
vtkPolyDataNormals (060B7520): No data to generate normals for!

I assume this is related to not setting the input to the contour
filter correctly.  My very vague understanding of the pipeline is that
I should be using vtkAlgorithm and input/output ports, but I'm rather
confused at how that might work with vtkImageData.

Thanks in advance for any help anyone might be able to provide!

Norman



More information about the vtkusers mailing list