04-09-2009 01:12 PM
I just inherited the labview code to run an optical mamography imaging system.
It has 32 sources 128 detectors and 2 sets of wavelenghts and the user has the option to control the gain settings for every detector at each source for each source of wavelengths so as you can imagine there are a lot of controls and indicators on the front panel.
The user also has the option of selecting how many sources and detectors they would like to use.
Depending on how many sources are input the labview code runs through a For loop which makes a "smooth box" visible or invisible covering the gain setting control depending on whether the current detector is greater than the number input by the user. This loop slows down the program because it runs 128 times (max number of detectors ) and has 4 case structures (2 sets of wavelengths, 2 for each breast) with 64 property nodes in each where it either turns the visible property on or off the box with that covers the detectors.
I was wondering if there was an easier way to activate or inactivate the controls for the unused detectors, not only does this slow down the program but in order to reconfigure the data to use more sources, I have to stop the program and re-run it.
Any advice on creating a dynamic front panel would be appreciated
Solved! Go to Solution.
04-09-2009 02:03 PM
A few points:
1) The visible property is (AFAIK) the only way of showing or hiding controls and indicators.
2) Turn on deferred update for the front panel before changing the visibility. PaneProperty node -> Front Panel -> Deferred updates to True.
3) Turn deferred update off when finished (Steps 2 and 3 should really speed up how fast the changes are made)
4) You could use references wired to a property node instead of 128 strictly linked nodes (Im guessing this one)
5) Why not simply use an array instead of duplicating all those controls and Indicators?
6) There's no reason whatsoever why this function (hiding and showing) should not be able to be called while the program is running. I think it's just outside your main program loop.
These are just the imediate points which occur to me. Pictures of code would probably help further.
Shane.
04-09-2009 02:07 PM
Maybe it would be a good moment to carefully consider a redesign of the UI, to prevent you need to resort to this kind of solution in the first place.
Only show the sources and configure the source by opening a dialog to do the settings. The dialog can be the same VI for all sources. Now you only need to loop through the 32 sources.
04-09-2009 02:20 PM
Hi Themike,
Could you please post a scrubbed up screen shot so we can advise better?
There are many techniques availabel before resorting to dynamically creating FP objects.
Just trying to help,
Ben
04-09-2009 02:46 PM
Ben is right...
Another simple technique is placing the controls in a Tab. Change page index and the controls dissappear {are not seen (or active)}.
There are many approaches. Seeing what your working with will help provide good suggestions.
R
04-09-2009 02:58 PM
Thank you for all your help:
Here are a few snap shots so you have a better idea of my situation
The first one is of the front panel, behind each of the tabs is another set of 32 detectors 4 tabs (128 total)
The second one of the front panel shows one of the smooth boxes I was talking about being active and how it hides the gain setting control.
The third and fourt pics are of the part of the block diagram that controls whether or not the smooth boxes are visible, I couldn't fit it on one screen so I have it split up top and bottom
04-09-2009 02:59 PM
04-09-2009 03:04 PM
04-09-2009 06:38 PM - edited 04-09-2009 06:47 PM
Are those clusters? If so, you can just hide/show the clusters directly rather than a box over each cluster.
Another option is to use just two boxes and simply resize their widths based on how many sensors/detectors you want to show.
Another option is to use two separate arrays of clusters and change the number of visible columns based on how many sensors/detectors you want to show. The arrays would be initialized to have a max of 16 elements. Attached is a crude demo (LV 8.2) showing this concept. (EDIT: As for implementation you can obviously do the same thing using the Quotient and Remainder function.) Not sure if this will fit into your code since we've only seen a small snippet.
04-09-2009 08:47 PM
Thank you so much this looks very promising!
I have never used an event structure before, I see that it is very useful
I am a labview novice and am not sure how to extract the seperate data values from the string array.
I was wondering if this would still work if the "Numeric" that resizes the array was a global variable as it is in the program.
If not I can always add a Reconfigure button which will prompt the user to re-input the max number of detectors and sources as well as the number they want.
The reason I didn't post the code is that it contains many subVIs (~20 different ones) as well as DAQmx files.
I have posted the main GUI but it will prompt for many files once opening it is in labview 8.2
The grad student before me who coded this was in a hurry to graduate so it is difficult to navigate through and isn't well commented.
The area that regulates whether the sources and detectors are shown is to the far left of the program.
It is the in a stacked sequence structure it is #4.
Regardless, I really appreciate all your help, I now have a starting point
thank you!