[vtkusers] copying GlobalIds through vtkExtractGeometry

David E DeMarle dave.demarle at kitware.com
Tue Jul 20 12:35:17 EDT 2010


That flag is meant to be used internally by the filter and is not a
control that you can change the behavior of arbitrary filters with.

Filters that know how to work with gobalid data without destroying
their meaning turn it on when they are preparing to do their work.
This makes the DataSetAttributes copy helpers copy that array. Most
filters  do not know how to preserve the meaning of globalids  (having
been written well before globalids existed or being incompatible with
it). They leave the flag in the default off state. This ensures that
their outputs do not have the array, which is better than having the
array with invalid results in it.

For reference, see how vtkDataSetSurfaceFilter uses the flag when its
PassThroughCell/PointIds flags are on.

David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109



On Mon, Jul 19, 2010 at 6:11 PM, Eric Nodwell <enodwell at ucalgary.ca> wrote:
> Hi,
>
> I would like to preserve the attribute array GlobalIds of the PointData on an object being operated on by vtkExtractGeometry .  I am having some difficulty however in determining where to set the Copy Flag for GlobalIds.
>
> According to the comments in the header of vtkDataSetAttributes, and examining the source code, this flag should be set on the destination, not on the source.  So that would suggest code like this:
>
>  // Make an extractor
>  vtkExtractGeometry* extractor = vtkExtractGeometry::New();
>  extractor->SetImplicitFunction (function);
>  extractor->SetInput (data);
>
>  // OK, now get the output of the filter because we need to set the Copy Tuples flag on GlobalIds
>  vtkDataSet* output = extractor->GetOutput();
>  output->GetPointData()->CopyGlobalIdsOn();
>  // CopyGlobalIds on output is verifiably ON at this point
>
>  // Run the filter.
>  extractor->Update();
>  // Oops, CopyGlobalIds on output is verifiably OFF at this point.  No GlobalIds are present on output.
>
> The problem is that the pipeline, during the Update of the vtkExtractGeometry object, calls vtkDataObject::PrepareForNewData, which wipes out any flags that we have set.
>
> So the question is, what is the solution to this catch 22?  How does one set the Copy Tuple flag on the filter output *before* the filter updates, but *after* the PrepareForNewData call?
>
> Thank you for any insight,
> Eric Nodwell
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list