To download NI software, including the products shown below, visit ni.com/downloads.
Overview: This VI averages a 3D array in a very efficent and simple manner.
Description: This VI uses For-loop to average a 3D array in a simple manner.
Requirements: LabVIEW 2012 (or compatible). Hardware: none.
Steps to Implement or Execute Code:
1. Input some values in Array.
2. Don't forget about 3d dimension (first array control).
3. Run this VI.
Additional Information or References:
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
This is an excellent piece of coding...
I am new to this LabVIEW business and was fairly shocked that such an essential function did not already exist. I must confess to not fully understanding how the VI code works (yet), but within the hour of downloading it, I had successfully utilised it to my needs. Thankyou Jason_D.
FYI: I capture N frames of noisy image data and this script has allowed me to output the mean frame which is the temporal average of the image.
Very simple and efficient. Thanks for that!
Your VI only handles a very, very specific case: Averaging an I32 integer array, with the result rounded to a new I32 integer array. You should mention this in the description!
In any case, your code is a potentially lossy operation, because the output cannot fully handle the real result, which is inherently DBL. It probably would have been better to show a general DBL case. The user can later decide how to convert the input and output if really needed for the specific application.
Measurement data is typically floating point (or much less than 32 bit), and images are often U8 per color plane, so I don't quite understand the typical use case to average a I32 array back into I32 representation. What did you have in mind?
If you don't want to execute the case structure with every iteration of the loop, here's an alternative, using an initial "delete from array". Same result.
lovely lil piece of code.
shradha