[vtk-developers] Problem when creating vtkImageData by hand

Prabhu Ramachandran prabhu_r at users.sf.net
Sun Jul 10 07:22:38 EDT 2005


Hi,

Sorry for the barrage of emails this week.  I just ran into a peculiar
problem with VTK from CVS.  If I use the vtkImagePlaneWidget along
with image data read from a file, everything seems to work.  However,
when I create a vtkImageData object by hand and use that as input, I
get wierd problems.  Stranger still, this works fine with VTK-4.4.

I've attached a slightly modified version of
Examples/GUI/Python/ImagePlaneWidget.py that demonstrates this
problem.

When run without modifications everything runs fine.  I recreate the
same image data like so:

    img_data = v16.GetOutput()
    # Now lets create this data without the reader.
    my_img_data = vtk.vtkImageData()
    my_img_data.SetDimensions(img_data.GetDimensions())
    my_img_data.SetSpacing(img_data.GetSpacing())
    my_img_data.SetOrigin(img_data.GetOrigin())
    my_img_data.SetScalarType(img_data.GetScalarType())
    my_img_data.GetPointData().SetScalars(img_data.GetPointData().GetScalars())
    my_img_data.Update()

I then use 'my_img_data' instead of img_data as the input to the image
plane widgets.  The example breaks and I get black planes which can't
be moved.  The outline disappears (or maybe reduces to a point).
Something seems very wrong.  If I don't use the vtkImagePlaneWidgets
and only use the outline then it is visible and looks OK.

The same exact code works with VTK-4.4.  I wonder if I am doing
something wrong or is there a bug somewhere?

Any clarifications would be appreciated.

cheers,
prabhu

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ImagePlaneWidget.py
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20050710/2285da97/attachment.ksh>


More information about the vtk-developers mailing list