[vtkusers] Why is the image red?

David Gobbi david.gobbi at gmail.com
Mon Dec 14 18:05:40 EST 2009


On Mon, Dec 14, 2009 at 3:45 PM, David Doria <daviddoria+vtk at gmail.com> wrote:

> David G,
>
> I guess I still don't follow you why it is so bad to create an image
> the way I had? I'll trust you though and I changed it to use a
> vtkImageCanvasSource2D to generate the blank image (I had to use
> FillBox on the whole image though because it wasn't initialized).

There are three reasons why it is bad.

1) If people directly access the data objects in VTK, it makes it
impossible for the developers to change their interface methods
because of backwards compatibility concerns.

2) One of the great things about the pipeline redesign in VTK 5 is
that, for the most part, people no longer have to directly access the
data objects.  And we should not encourage them to.  See #1 and #3
below.

3) People who create data objects by hand are likely to want to do
things like get the output from a filter and use
SetScalarComponentFromDouble() on it to change the color of a pixel.
But guess what?  The next time the pipeline updates, the pixel will be
overwritten.  The outputs of all filters should be considered "const"
but they cannot be because VTK cannot be redesigned to that extent
(see backwards compatibility).  So at the very least, users should be
strongly discouraged from modifying output data, and at best, they
should never even touch the output data objects.

For the rest of your questions, see the source code, because that's
what I'd have to do in order to answer them.  I wouldn't be surprised
if CanvasSource2D is more than a little buggered.

  David



More information about the vtkusers mailing list