LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array index

Solved!
Go to solution

Hi,

 

I built a small VI that displays a 1D array of images and a 2D array of pixel values for each image (it becomes 3D). I would like to have access to the array index to display the image with its pixel values (see attachment).

 

If there is no way to access the index because it is an output, i thought about a 2 column array where the first column will be composed of all the images and the second of all the 2D arrays of the corresponding pixel values. And the display could be done in parallel because it will be part of the same array.

 

I really don't know if I can do this. It sounds a bit strange to build an array of 2D arrays...

 

 

Thanks people for your help. I have searched a lot but I still haven't found something similar. I attach my VI (8.0), the FileInfo.vi just gets information about a binary file and i read images all the (320*240*2)+1016 bytes (size of the frame + size of the frame header).

 

 

 

 

Download All
0 Kudos
Message 1 of 16
(4,084 Views)

It's not really clear to me what you want to do. You have two arrays, one a 1D array of images, and the other is a 3D array of pixel values, where the pages (1st dimension) correspond to the images in the other array. Are you saying that you'd like the index of the image array and the page index of the pixel array locked to one and other for display purposes? So when you change the index of one, the other changes as well?

 

Chris

0 Kudos
Message 2 of 16
(4,066 Views)

Hi Chris,

 

You understood exactly what i want to do! And by the way sorry for the english.

 

Do you think that there is a way to lock the index? I am trying to bundle the 3D array of pixel values with the 1D array of images but i think that i will encounter the same problem.

 

Thanks in advance!

0 Kudos
Message 3 of 16
(4,058 Views)
I am not sure I completely understand what you want to do, but in the attached example, the first index of array 2 will be set to the index of array 1.  This is done through property nodes on the arrays.  This will allow you to have the pixel values change when the user changes the image.  You would not want to do this constantly in a loop.  It would be better to do this in an Event and look for a Mouse Up Event on Array 1.  If you use this method, you will be able to hide the index display on your pixel values list so the user cannot interact with it.  The user iwll only see the index display for the image array.
Message 4 of 16
(4,055 Views)
Solution
Accepted by topic author christophe69000

It appears that Matthew has suggested a solution that sounds like it will work (unfortunately, I can't do anything in LabVIEW at the moment because I've pissed it off, and it is essentially hung... I'm trying to give it a chance to redeem itself before I have to abort the process and lose my other work... :smileymad:). What I would suggest for you is to abstract the idea of how you store the data from how you display the data. All you really need to display is a single image and a 2D array of pixel values, along with some sort of control that allows you to change which image and 2D array you are displaying.

 

grrr. Curse you LabVIEW! Who knew you couldn't put 300k elements in a Listbox and expect it to work.. I just killed LabVIEW; at least the auto recovery tool works.

 

So, now that that is out of the way, I can whip up an example. I've attached a quick example where you can basically copy the block diagram and paste it into your vi (just replace the Tableau 3 and Image Array controls with the wires from your for loop (you can delete the indicators connected to those wires). This is a very simple GUI that allows you to slide the slider to select an image, and when you do, it will display the appropriate image and pixel value array. The property node is there just so that when you run the program, correct values will be displayed even before you click anything.

 

Chris

 

[Cool new image insertion tools!]  Incidentally, the vi is broken because I do not have the Vision Toolbox.
Message Edited by C. Minnella on 06-24-2009 10:22 AM
Download All
Message 5 of 16
(4,043 Views)

Matthew Kelton wrote:
the first index of array 2 will be set to the index of array 1.  This is done through property nodes on the arrays.  This will allow you to have the pixel values change when the user changes the image. 

Nice!

 

But I have to run the Vi to display the array of pixel values corresponding to the image. Can you tell me more about Mouse Events ? Because i would prefer to instantaneously change the pixel values.

0 Kudos
Message 6 of 16
(4,038 Views)

Chris' solution is actually the one I would implement if it were my code.  For me, it seem cleaner, although you are using up some extra memory.

 

But, to use what I showed you, you can still use Chris' example. He is using an event structure to detect a vlaue change event of a control.  This causes that code to run only when someone changes the value, and you don't have to constantly check to see if someone changed it.  There are numerous events, and one is the Mouse Up event.  It fires when someone releases the mouse button while on top of a control.  For someone to change the index of the array, they have topress a mouse button.  So, when the mouse button is released, you can check to see if the index value changed (or blindly assumed that it did), and update the other index.

 

LabVIEW's help has more information and there hsould be several examples of using events in the examples that shipped with LabVIEW.

0 Kudos
Message 7 of 16
(4,030 Views)

Sorry if I my Vi was responsible for freezing Labview Chris! I followed your instructions and it works very well. I changed your image number to a scrollbar to make it more user friendly. But the scrollbar has a really strange behavior.

 

Can't we freeze it at 0 and at the end of the sequence ?

 

 

 

[Edit]  Are these properties (Source, Type, Temps, RéfCmde) related to the GUI ?

 

 

Message Edited by christophe69000 on 06-24-2009 10:11 AM

Message Edited by christophe69000 on 06-24-2009 10:14 AM
0 Kudos
Message 8 of 16
(4,004 Views)

Nope, your vi isn't the problem. Mine are..

 

Anyway, if you really want to use a scrollbar instead of a slider you'll have to change a few of the properties to get it to act the way you like. You should right-click on the scrollbar and create a property node on the block diagram. Select the PageSize and the DocMax properties. You'll want to set PageSize to 1, and DocMax to the lenght of your image array. Then it will scroll from 0 to length-1.

 

Chris

0 Kudos
Message 9 of 16
(3,979 Views)

Ok! I am becoming a bit more familiar with the property nodes which appear to be very useful.

 

Thank you for your help, i learned a lot!

0 Kudos
Message 10 of 16
(3,947 Views)