08-18-2016 11:51 AM
This is the example shipped as Low-level snap.vi
-I don't really don't understand the usage of sequence structure here after the error wires connected to enforce data flow.
-Did I miss anything?
-The Label "Buffer Number Mode" is getting on the image wire.(Ofcourse i can move it, but i'd expect little bit maybe 5 more seconds of Labview guys to take care and not spread these kind of programming)
-Feel free to comment 🙂
08-18-2016 11:58 AM
There are a couple of excuses I could come up with.
1. They wanted to differentiate the main method from the closing
2. It is an old example that did not have error wires in the original API
I doubt either is correct. I completely agree that the seqeunce structure is not needed at all here.
08-18-2016 05:59 PM
I guess some day there was a frame in between that allowed to wait till user does something (wait front panel activity) and only after that discard image.
Now it clears image directly after snap and you might not see the result. I can not check, may be now clearing image does not delete image display data and you do not need to pause vi. But sequence remained from old times.
Label on the wire is probably due to font issue - they made this vi with different system font and it was fine. On your machine font resized and element location - not. Very very common.
08-18-2016 11:33 PM
Oh, come on, these are examples meant to show simple things (in this case, "how to acquire a single image using low level acquisition functions and display it in an image display control". Yes, the Label on the Buffer Number Mode enum is slightly askew, and the Sequence structure is entirely unnecessary, but give these guys a break ...
Bob Schor
08-19-2016 04:20 AM
IMAQ images are a bit tricky and confusing. When you write the image to the "Image" indicator terminal, your are actually just writing a reference, and the control (running asynchronously in the UI thread) will actually read from that reference at a latter point to actually render the image on the screen. This differs from most other LabVIEW indicators, which take by-value data, not a reference. There can easily be race conditions, where one changes or destroys the image before it can be rendered by the indicator.
Indicator terminal have no outputs to enforce operation order, and the sequence structure in this subVI is to ensure that the destruction of the image happens after the write to the indicator. That may not be enough, though, unless the indiocator is set to "synchronous" diplay (meaning the display is done immediately as you write to the terminal, rather than in parallel).
A clearer way to use the sequence here is to put a single small frame around the "Image" terminal, and run the wire to the image-destroying VI through the sequence. Then it is clear what exactly we are sequencing.
08-19-2016 04:26 AM
Agreed Bob. These examples are just to illustrate the basic functionality.
-My intention of highlighting is such that experienced people will not bother and they'll carry on.
-But for beginners it teaches a bad way of coding and they'll continue doing so unless someone again points out.
-And i am sure many people use examples as starting point and develop their own, Some use the examples directly.
-Either way i just want to point out the unnecessary usage of Sequence structure and to be removed.
08-19-2016 04:39 AM
Here's a possible improvement:
08-19-2016 04:57 AM
What difference it will create if i wire directly to dispose without using sequence structure?
Reason for my doubt is as soon as all available nodes for an Function or subVI is available it will start executing so there wont be any change i hope, Curious to know answer from you.
08-19-2016 06:13 AM
drdjpowell is correct, the sequence structure is absolutely necessary to ensure the execution that is expected. If the IMAQ dispose vi executes before the indicator renders (which is possible without the sequence structure), no image will appear on the front panel (because of the by reference vs. by value that was explained above).
08-19-2016 06:31 AM
Hope even if you have sequence structure for display image, soon after the execution of dispose VI the the image will get cleared.
Am i making sense?