LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array index

Solved!
Go to solution

I have one more question Chris!

 

I would like to avoid displaying the images two times. Which is why i tried this small Vi (see attachment) based on yours. I try to keep the Mouse event configuration but this time directly with the image array.

 

I can't link its index to the index array function because of the different types of the elements. I don't know how to do it, basically because i don't know how the image array was built.  I copied and pasted it from the example Sequence.vi.

 

(I promise to stop after this one...)

0 Kudos
Message 11 of 16
(784 Views)

hmm, the value of an Image Array is not its index, so that is why that code doesn't work. You may be able to use the IndexVals property of the Image array to get the desired effect (you will have to index out the first element of the output from this property for a 1D array). You really don't have to display the array twice. The content of the indicator is on the wire, not the actual indicator, so you can just delete the extra indicator. I don't think the mouse down approach is a good one because there are other ways to change the array index besides clicking, so you could easily miss an index change, and then your two "display" arrays would be out of sync.

 

Chris

0 Kudos
Message 12 of 16
(768 Views)

C. Minnella wrote:

You may be able to use the IndexVals property of the Image array to get the desired effect (you will have to index out the first element of the output from this property for a 1D array).


I tried to follow your instructions but i lose the mouse event. Besides I don't have 2 arrays of images but only one. But I display images twice if i want the corresponding pixel table.

 

Do you know how i could use IndexVals with Vals(Sgnl)?

0 Kudos
Message 13 of 16
(762 Views)

Maybe you could attach code again. I don't think I understand.

 

Chris

0 Kudos
Message 14 of 16
(751 Views)

Ok! Here it is.

 

As you can see, i have only one image array and images are displayed again at the end of the code. And when the index changes, the corresponding pixel value is displayed. But I would like to keep the image array, retrieve the index of that array and change the pixel values when that index changes. And it seems that i have to use both IndexVals and Vals(Sgnl) but due to the different types of data on the wires, i have mutiple errors.

 

 

0 Kudos
Message 15 of 16
(749 Views)

I can think of no foolproof way to trigger an event when the index of Image Array changes. Like I said, I don't think the mouse down is that reliable. I would just delete the Image Array indicator, and use the Frame Number control to determine what you see. If you really want to use Image Array, about the only way I can think of is to poll your UI. Every 100ms or so, read IndexVals from the Image Array, and us it to change the page displayed of Frame's Pixel Array. You can put this code in the timeout case of the event structure, or just get rid of hte event structure altogether. I don't recommend this approach because it is inefficient, but it would work.

 

Chris

0 Kudos
Message 16 of 16
(740 Views)