LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3d surface

Hello,

In a aplication, I´m using 3d surface function to graph in a PC  ultra sound data from a scanner. The scanner run over a x,y plane of a piece, emit ultra sound wave (throw the piece) and send to PC delay time and amplitude data of echo signal. The 3d surface show delay time echo signal in z axe (micro seconds).  All that is working, but I need that the surface color represent amplitude data echo signal.

At this moment, surface color is function of z axes and I didn´t find a way change it. How could I do to make the color surface be function of amplitude data echo signal??

Thanks.

 

 

0 Kudos
Message 1 of 10
(7,785 Views)

Hm, i think there is a gap in between what you want the 3D graph to do and what the 3D graph is meant for.....

 

The 3D is a tool to display measurement values to a 2D coordinate system in a way that the values are represented in a third dimension. In order to better illustrate the measurement value, usage of a color ramp improves the visual appearance.

The 3D graph is not designed to display measurement values purely as color code for a 3D based coordinate system....

 

Let's take a landscape for example:

The height of the individual location is a function of the x- and y- coordinate of the location. It is therefore "the measurement of height in dependence of X and Y". Granting a color ramp will only improve visual appearance of the height.

If you now would like to use a color ramp to display temperature of each location depending on the height, you cannot do this. You can either keep the traditional landscape (height vs. location) or create a new temperature map (temperature vs. X and Y coordinate)......

 

At least, i am not aware of any solution for this request (temperature vs. location in X, Y AND Z coordinate).

 

Norbert

 

EDIT: Depending on your skills and dedication, you can create your own display for this requirement. The 3D graph is indeed an XCtrl (at least afaik), so you can create a new "3D Color Graph". This XCtrl would require a 3D array (instead of 2D like the 'classic' 3D graph) as input and use a picture control for display. It wouldn't be as performant as the 3D graph though (as this uses something like MESA for 3D display).

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 10
(7,778 Views)

If you don't have the Full Development System, look away now.

 

Head to Modern > Graph > 3D Graph > Surface Graph and drop it on the front panel.

 

You get a helper VI and a class output. The helper VI has the following terminals:

 

3dghelp.png

 

That's input terminals for X and Y arrays and a 2D Z array. These should all have matching dimensions: e.g. X has length m, Y has length n, Z should have dimensions m * n. That's the physical surface sorted.

 

Note the optional input for the colour matrix. Wire in a 2D array of intensities that matches the dimensions of Z, and you'll see that the colour now changes accordingly. With some access to the properties of the plot, you can change the colour map, the interpolation mode etc etc. Here's one I made earlier:

 

3dgraph.png

 

The 3D Graph property node can be created by right clicking on the control and heading to Create > Property Node, and then adding the desired methods. The data wired is arbitrary - I generate a sine and cosine pattern for the X Y arrays, a Z array of ramps from 0 to 127, and a colour array of random doubles. The array of clusters wired to Surface Color Map are my colours, and I've changed the integer value (for colour) to a hexadecimal so I can use my beloved RGB. So my colour map is:

 

0 -> 0000FF (Blue)

0.5 -> 00FF00 (Green)

1.0 -> FF0000 (Red)

 

The result?

 

3dgraphfp.png

 

I believe that's what you were after.

 

A word of caution: this method may not be very suitable for large datasets and feeble PCs. I've found a few pieces of software that render 3D surfaces far better than this (I'm thinking of profilometer software), but haven't really investigated how to make it any less of a resource-hog.

---
CLA
Message 3 of 10
(7,767 Views)

Thanks you very much Norbert, I would like to work on your last suggest (about to create a new 3d graph). Could you send to me a link or example wich I can study to begin?? Thank your very much again. Daniel.

0 Kudos
Message 4 of 10
(7,749 Views)

Thank you thoult,

tell me please, which labview version is your example??

 

Daniel

0 Kudos
Message 5 of 10
(7,739 Views)

I'm using LV2012 SP1, but as I mentioned it's the Professional Development System. I don't believe it's present in other versions.

---
CLA
0 Kudos
Message 6 of 10
(7,720 Views)

@thoult wrote:
[...]

I believe that's what you were after.

[...]


Nice approach using the color matrix this way. Wasn't aware of the feature you can achieve with it.

 

Point is, that the VI you are using is not directly accessable in LV 2013. LV 2013 drops the "Plot Helper.VI" which doesn't provide the color matrix input instead of the "create_plot_surface.vi".

Therefore, with LV 2013, your recommendation is possible, but not obvious (nor easily accessable).

 

@Op: If you want to use this approach with LV 2013 without going through thoult's snippet, you have to place the create_plot_surface.vi manually and replace the Plot Helper with it.

You cannot find that VI on the palette, but can "Select a VI..." and browse to <vi.lib>\Native 3D Graph\merge.

On my machine, the complete path would be C:\Program Files (x86)\National Instruments\LabVIEW 2013\vi.lib\Native 3D Graph\merge.

 

hope this helps,

Norbert

 

@EDIT: @Op: You are aware that thoult's image of the code is a snippet you can load as LV code? If not, please refer to the LV help with the keyword "VI snippet"....

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 10
(7,702 Views)

Hey Norbert,

 

Have a look at the following screen grab from my front panel. That plot helper is dropped automatically using Surface Graph, whereas the one without the colour matrix is just labelled Surface.

 

Not sure why there's a difference between the two.

 

 

controls.png

---
CLA
Message 8 of 10
(7,695 Views)

Good catch. Never dropped the "Surface Graph"...

 

The difference is that "Surface" is using an XCtrl which is derived from a graph and exchanges the traditional 2D coordinate system with a 3D picture control (including all nice MESA stuff for zooming, rotating and lighting the scene).

The "Surface Graph" uses an XCtrl which is derived from the 3D picture control, so you have no color ramp and "helper buttons" availbale. But indeed this one grants direct access to the "create_plot_surface.vi".....

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 9 of 10
(7,691 Views)

Hi,

 

I'm trying to use your code but discover a problem. I tried to change the random value by a constant 0 or 1 to display the same color for the plot. When I do this, the surface graph always display the same color which is green. But when i look at the color map for 0 it should be blue and for 1 it should be red. You will see my code below :

2021-05-26_11h25_56.png

This is really simple, in this case the plot should be all blue but I obtained a green plot as follow

2021-05-26_11h27_53.png

When I look at the 3D graph properties, I have the correct color map with blue (0), green(0,5) and red (1).

2021-05-26_11h28_20.png

 

It seems that it follows the color but not the value associated with it. Looks like it changes the Minimum and Maximum and calculates the average of the color matrix that I'm sending to it to display the graph.  the surface graph is not using the color map surface that I'm sending to him.

 

Do you have the same behavior ? Is it normal that the graph runs like that ? 

 

I'm using LabVIEW 2020 - 32 bits on Windows 10.

0 Kudos
Message 10 of 10
(4,892 Views)