Masking structured data

Hi Developers

I am in a situation where I am working on structured data, which needs to be filtered using a bit-mask, e.g. at least one of the first 3 bits must be set and always bit 7. I looked into vtkImageMaskBits, where only one operation can be set and this applies to vtkImageData only. In my situation, I need to 3 OR and 1 AND operation applied to the same data.

  1. Would it make sense to introduce a vtkStructuredDataMaskBits?
  2. Perhaps with an array of operations and an array of masks
  3. Would it make sense (in general) to have vtkThreadedStructuredGridAlgorithm?

Is there any development going on in threaded algorithms on grids. Threaded using SMPTools or threaded using a vtkThreadedCompositePipeline?

For prototyping, I just by writing a vtkStructuredDataMaskBits (no threading).

Thanks in advance
Jens Munk

Hi Jens,

Since it operates only on the arrays, and doesn’t care about the geometry, you can derive from vtkDataSetAlgorithm. Use vtkSMPTools to parallelize over the data in the array.

Another option is to derive from vtkPassInputTypeAlgorithm, like the existing vtkArrayCalculator class does. The code of vtkArrayCalculator.cxx should provide hints for how to write your code (caveat: I’ve never looked at the vtkArrayCalculator code, myself!)

Definitely avoid using the same architecture as vtkThreadedImageAlgorithm. That class has lots of ugly code that reflects how we did SMP back in 1999. It doesn’t reflect current best practices!

Nice. Thanks, I will look into vtkDataSetAlgorithm and also vtkPassInputTypeAlgorithm. Always nice to derive from something less general than vtkAlgorithm.

So far just modified the vtkThreshold a lit with bits from vtkMaskImageData - I can reuse that part later. vtkPassInputTypeAlgorithm is very neat since I intend to have the possibility to get an output also as vtkPolyData…

Thanks
Jens