vtkMultiThreshold strange API

Folks and @dcthomp

First, vtkMultiThreshold is a very interesting and useful class. I notice the only place it is used in vtk is in its unit test

I decided to write an example: CellsInsideObject

The filter documentation says “This multiblock dataset contains a vtkUnstructuredGrid for each thresholded subset you request.”.

But the multiblock dataset contains a multiblock dataset that contains a vtkUnstructuredGrid.

To access the unstructured grid I would expect to do this:

but have to do this:


Is the current API correct? It does not seem to be the way other multiblock datasets are accessed. If it is correct, I think the documentation should be changed to be more clear.


I originally wrote and used it in the LS-Dyna reader, which has changed significantly since then.

As far as why the unstructured grids aren’t in the top-level multiblock, I believe that is because the class allows you to output results from multiple clauses of the parse tree that the expression is decomposed in before execution; each clause has a multiblock in the top level multiblock. It has been a while since I looked at it… if you think there is a better interface, I am happy for ideas to improve it, especially if it gets used some more.


Sounds like the current API was designed to address more complex logic. I think it’s fine to leave as is.

I’ll try to exercise more of it. I think itis a valuable class, but underused.


This is an interesting class that seems to be underused as far as I see.
I added an example to the VTKExamples Project

The Code and CMakeLists.txt file are here
it produces this image

Check it out if you have a chance.


1 Like

@lorensen That’s a pretty moo-ving example! I always wanted to write a vtkMultiClip filter as well to do webcuts of datasets.

I looked at the multi-threshold source and the nested multiblocks exist to handle parallel (multi-piece) data. The filter assumes the input data is split into pieces; each top-level output will be a multiblock with numPieces children and only the currently requested piece will be a non-empty grid. I am not sure this is the right way to do things but do recall that I had to do something when reading LS-Dyna files in parallel.