LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array Manipulation for Image Data Viewing

Solved!
Go to solution

Hi,

 

So I am a first-time user of LabVIEW and I am struggling with graphically programming the project I need to do...

 

The type of data I am working with are bitmap images.  Basically, one image represents y(along the y axis) data and wavelength data (along the x axis).  Each successive image shows this data for a certain x-value.  Thus, all the images in the folder hold a cube of data (x, y, wavelength).  

 

What I want to do is create a VI to view this data nicely.  I want to average all of the wavelength data (which is in rows) for a given y point in a given image (x point), and then make that average the array value in a 2D array at index x,y.

I would like for this 2D array to correspond to an "averaged" bitmap image.  And if you click a pixel/cell in this image/array (which is formed by averaging all the wavelength data for each pixel), then a spectral diagram of the wavelength data is plotted in a separate graph.  That way you see the overall image, but if you are interested in a certain point you can see the raw wavelength data graphically after clicking that point.

 

At the moment, I have created test data.  I ran an Excel Macro to combine all of the data into one excel file.  Each "image" is three rows and three wavelengths per row.  In the attached excel file, you see 9 rows because I have put 3 images together one after another.  The problem is, in LabVIEW, I am trying to create the new 2D array that is the average image, but I am unsure how to pull the "mean" column data into this new array.  Because each "image is 3 rows long, I need to take the first 3 values in the 4th row in the data array (mean values) and make that my 1st column, then take the next 3 values in the 4th column and make that the 2nd column, etc.  So, the new 2D array should be all 7s.

 

I would really appreciate any help on going about this task, as well as an answer to the small problem I am currently facing.  If I did not explain this well, let me know and I will clear up whatever was confusing!

Download All
0 Kudos
Message 1 of 7
(2,816 Views)
Solution
Accepted by topic author Max_2013

It is typically a bad idea to have degenerate sample data as in this case where each element is 7. This does not easily allow to verify if the correct order and transposition is achieved. (Also, your second FOR loop is pure LabVIEW gibberish. :D)

 

Try something as shows in the image.... (of course the diagram constants should be replaced my math based on the input array sizes).

 

 

Message 2 of 7
(2,800 Views)

Hi, 

 

Thank you for your prompt reply.  I am still having the same problem, however, where the first row is correct in the outputted 2D array I want, but none of the other rows show.  I need to iterate through the 4th column of that first array and take all of the mean values and split it amongst a 2D array.  In this case, every 3 values is a new column.  This is what I tried to use that gibberish FOR loop for, but I as you said, it served no purpose.

0 Kudos
Message 3 of 7
(2,773 Views)

My apologies, your solution does work correctly Smiley Happy 

 

I am wondering now, how can I make it so that when I click on one cell in the output matrix, a graph is displayed plotting the original wavelength data...

 

 

0 Kudos
Message 4 of 7
(2,753 Views)

Anybody?  I really dont even know if LabVIEW is capable of this.  It should be, but I can't seem to find anything online.

0 Kudos
Message 5 of 7
(2,726 Views)

hi max,

 

how about using the indices

 

2013-07-17_indices.PNG

 

of real matrix in combination with a property node (Index Values) and the index array function from the programming>array palette

0 Kudos
Message 6 of 7
(2,715 Views)

@Max_2013 wrote:

Anybody?  I really dont even know if LabVIEW is capable of this.  It should be, but I can't seem to find anything online.


Yes, LabVIEW is capable of anything!!! What makes you doubt? 😮

 

To get the clicked element of an array, all you need is a "mouse down" event and calculate the clicked array element based on the coordinates from the event terminal and taking the array scroll position into account.

 

A simple example is in my old 4x4 tic tac toe example. The board is a 4x4 array indicator and the moves are done by clicks on the elements. See if you can figure it out. 😄 

Message 7 of 7
(2,707 Views)