tkeskita / BVtkNodes

Create and execute VTK pipelines in Blender Node Editor
GNU General Public License v3.0
111 stars 19 forks source link

vtkThresholdPoints Implementation faulty? #110

Open markus-ifg opened 4 months ago

markus-ifg commented 4 months ago

Hi there,

I'm trying to us the "VTK To Blender Particles" node on a subset of points from a vtkPolyDataReader based on a property called "time". The vtkThresholdPoints successfully filters values above the (somewhat misleading name) UpperThreshold, but apparently does not filter values below the "LowerThreshold" value. (See attached image) Is this a bug or am I using it wrong?

grafik

tkeskita commented 4 months ago

Hi, ObjectName I think only gives a name to the VTK object created by that class, it does not specify the thresholding field name. I haven't used vtkThresholdPoints, but I guess you might need to activate the field you intend to threshold with Custom Code command Assign like in this example.

The Info node shows the name of the point data field if you make it wider, is that "time"?

markus-ifg commented 4 months ago

Yes, it is called "time". And the filter does seem to work (look at the second info box, the values of the point data array are now starting from 100), but it does seem to ignore the other threshold. Maybe the problem is, that the vtkThresholdPoints can do three things (values above, values below and values in between) and the differentiation is not correct?

tkeskita commented 4 months ago

When doubting about the usage of VTK class, check the official documentation, here for vtkThresholdPoints. This is apparently one of the non-trivial VTK functions. Looking at the function list, I guess you have to call explicitly ThresholdBetween() (probably with min and max arguments) with Custom Code to get the between thresholding.

markus-ifg commented 4 months ago

Thanks for the reply. I will try to use it with Custom Code, although I'm never really sure how to use that properly.

Still (from a user perspective) I would think, that a threshold node with min and max value fields should be able to extract the values between those, shouldn't it? Otherwise, why have these inputs? If the underlying function has three modes (only above, only below and inbetween), maybe a corresponding dropdown selection could be introduced to disambiguate?

Thanks again for the help and your work on this great addon! :)

tkeskita commented 4 months ago

VTK has many unintuitive classes, and there is room for improvement. As BVTKNodes is downstream, the strategy with least cost is to accept VTK as it is, as there are not many active BVTKNodes developers currently. If you wish, you can also pursue changes in the upstream VTK.