From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to display spectral lines in color band

I want to display a line spectrum in color band format.  What I have are two arrays: wavelength and intensity. I can plot the graph like the bottom one and I want to convert it to the top color band. The considerations are:

 

1. the color must agree with the wavelength.  For instant, the 650 nm corresponds to the red color and the 490 matches the blue

2. the line intensity is indicated by the line width of the color line.  For instant, the 650 nm line is a strong one and its red line in the color band is the widest.   The 435 nm line is a weak one so it is barely see (but still visible) in the color band.

 

I would like to know if labview has any built-in function to assist me with this job.  If not, any idea of implementing this?

 

Thanks in advance for any suggesting.

23184iD9F8C04285F9DD82

 

 

0 Kudos
Message 1 of 22
(6,647 Views)

i dont think there's labview support on this...the easiest way would be to code it yourself, by drawing an image and using rectangles...to color-code your rectangles, you will have to specify some sampling points (400nm-->blue, 540nm-->green...) and to interpolate between them...the more sampling points you have, as better the color matching...


THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 2 of 22
(6,636 Views)

I am thinking of an alternative way to implement this, but not sure if LabView can handle:

 

1. First, set a standard color spectrum as background:

23200i229FF0DA0E195154

 

2. Then, make the spectral line image as 2D, and put it in front of the color spectrum with the wavelength aligned.  The picture below has the y-axis offset a bit to show my concept:

23202i24E991146E6A6F97

 

For the 2D spectral line image, I have the max intensity set as white and the min set at black.  WHAT IF I can set the min as "opaque" and max as "100% transparent"?  Is it possible?

 

I started my labview programming last year so sometime I may think labview can "fly".  If this concept is too crazy (a.k.a. impossible) , just let me know.  Thanks!

 

0 Kudos
Message 3 of 22
(6,627 Views)

You can use the Picture functions. I would start with the shiped example .....\examples\picture\demos.llb\Histogram Plot.vi and modify it to fit your needs.



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 4 of 22
(6,614 Views)

Hello Coq, would you mind elaborate a bit more?  My understanding is to set the standard full spectrum as the background "picture" in the plot, but how to I convert the spectral line plot into a transparent one based on their intensity?  Or, are you suggesting another method to implement?  Thanks!

0 Kudos
Message 5 of 22
(6,603 Views)

another possibility are user defined controls...for example, you can use an xy graph and use your spectrum as a background (right-click an xy-graph and chose advanced-->customize)

 

or: use the function "get image subset" in the picture palette to extract a part of your spectrum (or one spectral line...), then you can create an output picture depending on your picture...


THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 6 of 22
(6,597 Views)

You mean like this?

 

23206i82C6CB3733173E8E

 

Shane

Message 7 of 22
(6,590 Views)

yeah, thats what i meant :-)...didn't know that theres already an example...


THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 8 of 22
(6,585 Views)

YES Intaris, your bottom plot is very close to what I need.

 

My original data is a 2D array which I usually plot like this:

 

23208i68DB56630E010430

My goal is to make it look like this:

23210iD7B04B01F4850AAB

 

Following the replies from this post, I am currently in a step of having this (this is another spectrum so the lines look different):

23212i07DC4C47E22BA4A1

 

Can you give me hints on how to make your bottom plot?

 

Thanks everyone for their reply

0 Kudos
Message 9 of 22
(6,578 Views)

I used a picture control to generate the images.

 

An important note is to ALWAYS create the picture from scratch (start with an empty picture) because if you keep drawing over the old one, performance gets really bad really quickly.

 

I'll post an example when I get back home, that's where my code is.

 

Regards

 

Shane.

0 Kudos
Message 10 of 22
(6,557 Views)