LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to compare and reduce from 1000 X 512 arrays to smallnumber arrays( VI is Attached)

One serious problem that remains is race conditions! (as well as extra data copies and unecessary calculations)

For example if the user presses open, it is very likely that the local variable "imagedata" gets read at position 2 before the value gets updated at positions 1. You spin another loop with stale data, recalculating what you already calculated 200ms earlier. Same with the resolution locals. In addition, the local variable forces another datacopy in memory. Also the "boudries" local is useless, just branch the wire to the two places the control is used and delete the local.

A similar problem occurs with the SAVE case structure. For every iteration, there is no way to tell which of the case structures executes first becase you broke the dataflow!

It is also completely useless to recalculate that entire code every 200ms. A recalculation is only needed if one of the controls change.

All you need is a while loop with four shift registers for the four local variables (Imagedata,resx, resy, infos) and an event structure. Add an event case for "open: value changed", another one for "save: value changed" and a main one for any of the other controls.

All property nodes that are wired to constants (e.g. A-scan:scale multiplier) need to go outside the loop. They need to be set only once and not every 200ms.



Message Edited by altenbach on 01-04-2008 09:37 AM
0 Kudos
Message 11 of 17
(1,066 Views)
Adding a bit more details to my last comment.
 
There are many calcualtions that are independent, so the suggested event structure needs a few more event cases.
  • "Zoomfactor: value changed" only needs to change the zoomfactor. No need to do any other calcualtions or display updates.
  • "threshold, peak threshold:value changed" does not need to set the various properties on the left or update "bild", b-scan, number of colums, rows, etc.
  • Palette: value changed" does not need to redraw the image or other indicators or do any of the other calcualtions.
  • The "image saved" popup belongs into the inner case, because if the path is invalid it would be lying because it actually did not save anything.
0 Kudos
Message 12 of 17
(1,059 Views)
  • If the cursor position changes on "bild", ALL you need is update the "A-scan" and nothing else.
0 Kudos
Message 13 of 17
(1,055 Views)

Hi GerdW,

I am really very thankful to you for your help,

I tried programme that you modified with my system but unfortunately there is no more difference in working speed, Is there any other alternative to reduce the size of arrays?          i mean in my programme i use correlation method but i think it is taking much time and not giving wanted result.

Wanted Result: Should be eliminate same line of data.

with regards,

dipen

0 Kudos
Message 14 of 17
(1,033 Views)

Hi altenbach,

Thank you very much  for your suggestions, In my case i will use this programm as realtime scanning, means continuously new data are entering in and result is going out,

but yes race condition will occurs in case of save data. I will  improve all the important points you have suggested.

 

Thanking you once again,

with regards,

dipen

0 Kudos
Message 15 of 17
(1,028 Views)
Hi dipen,

first point - working speed:
I made some changes, but left old code in the vi and added new code - in result the vi's will run slower. You have to delete older code portions...

2nd point - correlation:
When you want to delete "same lines" you don't need correlation at all. You only need it for "similar lines"! Maybe it's time to rethink your program design - as Altenbach suggested?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 16 of 17
(1,025 Views)

HI GerdW,

First point:-Yes i delete older code, and then after i run it.

second point:- My mistek of writing, want to delete similar lines.

with regards,

dipen

0 Kudos
Message 17 of 17
(1,023 Views)