vtkOBJImporter load data, and how to get the color of point, and change some of the cells' color by SetScalars?

Hi, When I use vtkOBJImporter load some obj mtl file, I can get the mapper, actor, and polydata of the data, But I want to get the color of point in polydata by texture data.

Issue1: I found some ways to get the rgb value of texture map, but I cannot get the texture map of the mtl file.
Issue2:I want to change some cell’s color by id, like the geomatic(when choose some area, the cells of this area will be dark red ), I trid to use SetScalars of the polydata, but it does not work.

  1. You can use vtkProbeFilter to get texture value at a position. See a complete example in the TextureModel module in a 3D Slicer extension:
  1. Once you switched to color by point data, you can change color by changing that point data array. If you want to have sharp edges then you need to switch from using point data to cell data.
1 Like

Thanks. The solution looks well. I soulve this problems by reading the orgiginal obj file and png picture.
Because the actor by objimport is opengl actor, it can not be deepcopy(Beacause in my task, I need to segment the data to 2 or more parts), so I prefer to load obj file and make an normal polydata, and show the color by polydata.GetCellData().SetScalars() and vlookuptable. It seems well and more editable.
anyway thank you very much.

Hi, Andras, I’m using vtk to get the threshold segment and translate it to polydata. But here is some problems, Can you see it? Thank you.
If possible, Can you give me how slicer process this flow?(Get the CT, threshold, translate to polydata?)

here is the link: