Closed XushanLu closed 3 years ago
Oh you're right Thanks for reporting it, what if we do:
if above is not None and below is not None:
if above > below:
th.SetInvert(True)
th.ThresholdBetween(below, above)
else:
th.ThresholdBetween(above, below)
elif above is not None:
th.ThresholdByUpper(above)
elif below is not None:
th.ThresholdByLower(below)
that would even allow for above > below by flipping the selection, what do you think of it? does it work?
I think that surely works. It is probably the best just to flip above and below when above < below rather than throwing out an error. I will update the code from the repository to see what happens.
Hi @marcomusy , I don't think the code is in the repository, is it? I tried to update the code with
pip install -U git+https://github.com/marcomusy/vedo.git
but nothing seems to have been changed.
I think there is possibly a bug in vedo.tetmesh.
In the code, you have
which simply means above cannot be equal to below because otherwise the entire tetmesh would be returned which is not really what should happen. Sometimes, we are purely interested in thresholding the mesh to get just those cells equal to a single value. Also, it seems that vtk does allow above to be equal to below (https://vtk.org/doc/release/5.0/html/a03868.html):
I tried to bypass the current vedo code which does not allow above == below using the following code:
and I think I got what I wanted, i.e., getting cells with the attribute that is the same as above and below.
Please take a look at this and see what you think. Thanks!