Getting started coloring many objects

Hello,

I am a new ParaView user. Trying to figure out if ParaView is a good choice for my application.

I am trying to visualize some medical imaging detector data. The setup is 16 arrays (11 x 15) of scintillators arranged in a ring-like fashion around the z-axis. I have the number of counts each scintillator has registered. I would like the color of each scintillator to correspond to the number of counts it has registered. The geometry will always be the same (16 x (11 x 15) arranged like a ring), but I want to be able to load new counts datasets easily.

  1. In my counts data file (CSV), each scintillator is identified by a number… should I produce new data files where the scintillator number is converted to an (x,y,z) coordinate? Any advice on how to format my data files? I am open to converting my data to something other than CSV if it is recomended.

  2. As for generating the scintillators, my first thought was to do this in CAD and import an .stl file… but I am unsure of how to work with the imported scintillators in ParaView… Right now all the scintillators are the same source. Not sure if I can apply coloring based on my data to this. If I should be generating the scintillators in ParaView from the start, is there a recommended way to create an array of cubes and then translate + rotate the array?

Thank you.

You should be able to just open your files with ParaView.

I think this is definitely something you could produce in ParaView, and I encourage you to experiment a bit and see if you can achieve what you want.

The Box source will produce a cube, and applying a Transform filter will let you move/scale/rotate it. Then in the Properties panel, you can change the Color section to apply any solid color you want.

I would then look at producing a python script to do what you want, that you could then use as a macro. If you use Tools … Start Trace and check “Show incremental trace” it will show you the python command equivalent to anything you do in the gui. With a little python code, you could read and loop through your CSV to place and color a box for each line.

HTH,
Aron

Hmm, thinking about this a little more, and seeing that you have 2640 boxes, this is probably not an ideal approach. If you are already importing an STL, then you likely have a PolyData with either triangles or quad making up the sides of the boxes. What you want to do is add a cell data array to the PolyData, which replicates the data value for that scintillator the right number of times. Then you can color that dataset based on that cell data array, and use a colormap to get different colors based on your data values.

I’m not sure how to add the cell data array with filters, it might need a Programmable Filter and some python code? Suggestions, Mathieu?

Hi Aron,

Thank you for your suggestions.

I played around a bit in ParaView. My .stl is imported as a Polygonal Mesh. I am able to use the Extractors to select one scintillator from the mesh and make a copy of it as an Unstructured Grid. I understand how I could use a python script to get all 2640 boxes as their own Unstructured Grids. Am I on the right track?

Alternatively… I am already parsing my counts data manually and writing it to a CSV. Would it be easier to just write the counts along with each scintillator’s geometry to some type of VTK file?

Cheers.