identify cells on original filter from filter applied to

Hello,

I have the following situation:

  1. I import a surface mesh
  2. I smooth it out
  3. I generate curvature on the smoothed surface
  4. I extract with threshold some cells (faces)

Now i would like to identiy the extracted cells in 4 but on the original surface mesh imported.

how can I do this kind of manipulation? i see that each time i apply a filter the ID is recreated, i imagine that beween the original surface mesh and the smoothed one as the number of elements did not change the ID would be the same, but after the threshold there will be less cells, i imagine that there exists a solution to select the original ones from the output of the threshold itself.

is this possible?

IIUC the number of cells does not change here ? Then selection link should ā€œjust workā€.

in the last step it does, as i am using threshold to get only a part of it. i have found the generateIDs filter that I think will help me do what I wanted (keep the original ID thought the complete pipeline).

Indeed, that would help, but then you need to ā€œproject backā€ the original ids, which requires clever use of programmable filter I believe.

well, what I want to do is in the original surface mesh, generate a flag field that will indicate the cells that were ā€˜selected’ during the thershold with a 1 and the others with a 0.
how could I do this? i need to pass thought a programmable filter, no? is there any easier way?

I dont see an easy way, no.

1 Like

Perhaps it does not directly help with the problem, as there is also smoothing involved, but I had a similar issue where I needed to know a certain mesh cell ID after I applied a thresholding filter.
I used a programmable filter before the threshold to add a ā€œoriginal Cell IDā€:

import numpy as np
output.CellData.append(np.arange(inputs[0].GetNumberOfCells()), "OrigCellID")

Hello,
what i finally did that did not required extra steps (at least steps that are expensive or repeating data). was to use the find data, that can be used with python with the extract selection.
so, basically:

  1. i identify the IDs that i want to recover on the original data (on the root before doing anything i apply the global id filter to have a constant ID)
  2. set as active filter the one where i want to identify the specific cells
  3. select the respective cells or points using find data using:
    QuerySelect(QueryString=f'(in1d({fieldName}, {listOfValues}))', FieldType=FieldType, InsideOut=False)
  4. use extract selection filter.

this is an easy workaround without too much extra steps.

1 Like

oh well, this is exactly what I produced with the programmable filter - I did not know that a builtin method exists! Thanks!

yeah, the issue i was having with programmable filter was that i had the list of ids, a list of values as a python object, and outside of hardcoding the values list on the programable filter i was not sure how to do this cleanly. and this was creating a lot of extra data as i was creating a new filter that was copying all the data, getting the specific values then selecting only that, etc. I am pretty lost in regards to programmable filter, pretty sure that it is possible to do it in a ā€˜clean’ way but did not find it.

hey @mwestphal , sorry for the tag, but I just upgraded to 6.1 and the querySelect fails as (I dont know why) the format changed from in1d to isin is this normal? i could not find anything about this in the release notes of 6.1

I’m not following, could you provide steps to reproduce ?

for the 6.1 the python command changed:

paraview.simple._DisableFirstRenderCameraReset()
sphere1 = Sphere(registrationName='Sphere1')
renderView1 = GetActiveViewOrCreate('RenderView')
#######line that changed
QuerySelect(QueryString='(isin(id, [1,2]))', FieldType='POINT', InsideOut=0)
#########
extractSelection1 = ExtractSelection(registrationName='ExtractSelection1', Input=sphere1)
renderView1.Update()

when previously (6.0.1) for getting to run correctly one should use:

QuerySelect(QueryString='(is1d(id, [1,2]))', FieldType='POINT', InsideOut=0)

and the issue is that none is compatible with the other version.

I’m afraid that doesnt ring a bell, this looks like a regression or a behavior change that should have been at least documented. Please open an issue.

1 Like

created: https://gitlab.kitware.com/paraview/paraview/-/work_items/23277