📜 ⬆️ ⬇️

Overview of some versatile LabVIEW virtual instruments to help the developer (with source code)

image

Good day to all!

In recent years, working in the LabVIEW environment has had to deal with different tasks, the solution of which flowed into the creation of simple and not very simple virtual instruments (VP). My work specialization is designing various algorithms for analyzing biomedical signals. And like any developer over several years, I have accumulated a large amount of code of varying complexity. For all the virtual devices that for one reason or another I felt sorry for deleting, I created a folder where I saved everything. In this article I would like to cite some samples from my LabVIEW portfolio.
')
The sample is quite eclectic in nature, and many devices experienced developers can play themselves in a few minutes. Therefore, I believe this article can be useful mainly for beginner LabVIEW-developers. Most of the presented code can be found in LabVIEW forums or in instances of the environment anyway. The source code is attached at the end of the article (version 9.0).

In the beginning I would like to give a couple of VP, which belong to the category of very simple, but perhaps someone needed.

Signal normalization


LabVIEW has a built-in signal normalization function, Normalization.vi, but its work did not satisfy us, since it was not clear how to get an output array at rigidly defined limits at its output. As a result, a sub-instrument was developed, in this case implementing the normalization of the input array in values ​​from 0 to 100. Agree that this is sometimes necessary.

image

Removing zeros from an array


Back in student time during graduation design, my classmate had the task of searching for extrasystoles on electrocardiogram, and to solve it, it was necessary to implement a code that removes all zero values ​​from the array. As a result, we together created this mega code.

image

Reading data from a Bluetooth device.


This device was borrowed from ni.com when the task was to receive data from the Polar breast sensor. The user of the English-language forum successfully implemented the code for receiving data from the device, but decoding the BT-string and translating it into pulse values ​​had to be slightly modernized. The topic can be viewed here . In addition to the pulse sensor, another BT device was successfully connected to the virtual device.

image

Convert video to graphic files


Somehow it was necessary to process the video image in LabVIEW, but the codes used were not adapted for opening the video image, but read a sequence of graphic files. Therefore, a useful device was found that translates video into JPEG - pictures.

image
image

Launch VLC Player from LabVIEW


When solving a video launch problem during device operation, for example, at the touch of a button, I looked for a convenient implementation, but the Windows Media Player built into LabVIEW showed an unstable operation. Then the look focused on using the solution based on the .NET platform with the connection of an external VLC player. It works quite stably and is currently used as part of a program for laboratory research.

image

Spline signal interpolation


Often in the tasks of digital signal processing is required to perform the interpolation procedure. Sometimes, because the original signal is too “angular” or when, for the convenience of displaying on a graphical indicator, it requires a greater number of signal points. Simply, if out of 10 signal points you need to make 100, such a procedure is applied. In my EPs, very often I resorted to spline interpolation, slightly smoothing the signal and increasing the number of samples. A similar implementation of other types of interpolation can be found in the LabVIEW environment examples.

image
image

Custom Signal Filtering


When working with arrays of rhythmograms (a set of instantaneous heart rate values ​​for a certain period of time), there was a problem of removing artifacts / anomalous values ​​due to various reasons when recording a pulse. One possible solution for removing such emissions from the source array is the device below. In appearance, the code is not simple, but in fact it implements a procedure for linearly connecting two adjacent numbers between which an outlier was found. And then the middle of this segment is found, with which the found anomalous value is replaced. If there are two neighboring artifacts, then we take and connect their extreme neighbors. And we divide the segment not into two, but into three parts, etc.

image
image

Linear approximation of random numbers


The following code implements a linear approximation of a set of numbers, in this example it is random numbers. This operation was necessary for the construction of the scangram — a graphical regression analysis of the rhythmogram used in assessing heart rate variability. Along with linear approximation, LabVIEW has examples of other types of approximations.

image
image

At the end of the article I would like to especially thank all those people who helped me in solving many, sometimes difficult tasks. I would especially like to express my gratitude to the LabVIEW Portal community for their invaluable help in implementing a variety of algorithms and my professional growth.

Instrument Source Files

Source: https://habr.com/ru/post/234895/


All Articles