[vtkusers] vtk/Examples/Medical/Medical3.cxx strange problem

kdsfinger at gmail.com kdsfinger at gmail.com
Wed Sep 6 23:40:39 EDT 2006


hi, all
I got a strange problem for the performance of the example
Medical3.cxx for a different dataset. I have reported this earlier
(with connection with itk) but got no answer. I now get rid off the
itk part and its now pure vtk.

The only thing I did which is different from the original example is
that I used vtkPNGReader to read in a stack of png images of unsigned
char with dimension of 256x256x127. I also comment out the skull and
skin part to make it simple. The reader works fine and the
vtkImageData is correct.

Here comes the problem: some region of the SetDisplayExtent will show
pure black or pure white plane, which is wrong, while the rest are
displayed correctly. For example, it might show a pure white (or
black) slice if I use
axial->SetDisplayExtent(0,255, 0,255, 100,100).
However, I can get correct display if I use
axial->SetDisplayExtent(0,255, 0,255, 70,70).
This also happens to the other two dimensions.

I also have a vtkPolyDataMapper for the outline of the cube, which
always display correctly. Notice that the axial plane is always inside
the cube.

I also observed that the miss display is related with the parameter of
the vtkCamera. With the tunning of the parameters, some missed display
can be shown correctly. But, I have not figured out the clear
relationship yet. And as I tried many times of different parameters,
the axial can never be shown in full range no matter how.

The problem is so annoying since if the outmost part (the outline of
the cube) can be seen, how come that some of the inner slides display
right while some others not? If the outline displays correctly, I can
expect that the camera is at the right distance and direction, can't
I? Even I don't setup vtkCamera manually, the system itself will setup
a default one at the right place and direction, right? (And here is an
other question not related to the current problem: if I have multipule
actors at different positions, what's the mechanism for the system to
setup the default camera so that the user can view them all?)

Can someone please give me a hand to solve this problem? Thanks ahead.

Attached is the piece of code related to the problem (99% from Medical3.cxx).

zl2k


// Create the second (axial) plane of the three planes. We use the
  // same approach as before except that the extent differs.
  vtkImageMapToColors *axialColors = vtkImageMapToColors::New();
    axialColors->SetInputConnection(reader->GetOutputPort());
    axialColors->SetLookupTable(hueLut);
    axialColors->Update();
  vtkImageActor *axial = vtkImageActor::New();
    axial->SetInput(axialColors->GetOutput());
    int p = (int)atoi(argv[1]);
    axial->SetDisplayExtent(0,255, p,p, 0,126);
    axial->InterpolateOn();



More information about the vtkusers mailing list