LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Quickly Get Heat Map as Image (Code Review Request)

Solved!
Go to solution

My VI is receiving about 5k - 10k rows from a database table with the following information:

 

X(mm)     Y(mm)    occurrence(#)
0000.00  0000.00      002
0002.00  0000.00      052
0005.00  0000.00      071
.......  .......      ...
9999.00  0578.00      300

 

I would like to take the data and quickly generate an image that I can overlay drawing elements (circles) that will highlight areas of interest.

JScherer_1-1585075373707.png

 

 

Is there any way I can improve this vi to

  • Stop using the hidden 3dplot control
  • Add an X,Y axis
  • Render the image more quickly
0 Kudos
Message 1 of 8
(3,514 Views)

Instead of drawing by points couldn't you just convert your data to a pixel array and use Draw Unflattened Pixmap? I think by default your points will be pixels but you could fuzz each one to include neighbor pixels as well, right?

 

(I don't use much picture stuff, sorry).

0 Kudos
Message 2 of 8
(3,505 Views)

Just use an intensity graph and quantize the x and y values to a reasonable grid. You can easily do a 2D histogram as described here.

Initialize a 2D I32 array, place in shift register, autoindex on data and use the IPE to increment values at scaled X,Y to array indices. Use a nice color ramp for the z scale.

0 Kudos
Message 3 of 8
(3,504 Views)

@altenbach wrote:

Just use an intensity graph and quantize the x and y values to a reasonable grid. You can easily do a 2D histogram ...


 

Here's what I had in mind...

 

(you can hide the x and y scales or remap them to actual values using x0/dx if the scaling is different) 

 

altenbach_0-1585077399716.png

 

 

 

0 Kudos
Message 4 of 8
(3,493 Views)

@altenbach wrote:

Here's what I had in mind...

 

(you can hide the x and y scales or remap them to actual values using x0/dx if the scaling is different) 

 

altenbach_0-1585077399716.png

 

 

 


I like the intensity graph, but how would I draw the user's regions of interest on the graph? (eg, a circle r 30 at XY=0,0)

0 Kudos
Message 5 of 8
(3,478 Views)

Hi JScherer,

 

you can draw those circles into a 2DPicture and use that picture as front image (by property node) of the intensity graph…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 8
(3,471 Views)

@JScherer wrote:
I like the intensity graph, but how would I draw the user's regions of interest on the graph? (eg, a circle r 30 at XY=0,0)

"Plot images" property.

 

(example to draw a line, but any 2D image tools are of course allowed)

 

Here's an old example drawing circles on an intensity graph.

0 Kudos
Message 7 of 8
(3,452 Views)
Solution
Accepted by JScherer

Simplified example:

 

(To do: Size graph area such that pixels are square, ensure execution order (draw circles only after axes have autoscaled), Do axis mapping such that data and axes can go from -100 ..+100, etc.) 

 

altenbach_0-1585081564134.png

 

Message 8 of 8
(3,438 Views)