Automatically sort tubes in the laboratory using barcodes

Automatically sort tubes in the laboratory using barcodes

Blog category: Barcode.NET

July 02, 2025

Modern medical and research laboratories are faced with the processing of hundreds and thousands of biological samples daily. Managing the flow of test tubes requires not only efficiency, but also minimizing errors at each stage of sorting and processing. In these conditions, automation based on barcoding technologies becomes vital to improve the efficiency, accuracy and safety of work processes.


Principles and stages of automated sorting

Automated sorting of test tubes is based on the use of machine vision and barcode recognition technologies. All test tubes are marked with individual GS1 barcodes at the preparation stage, which contain information about the type of biomaterial, the patient, the required analysis and other related information. The main principles of the system:

Automation stages:


Key tasks and challenges of the technology

Automated tube sorting is an innovative solution that significantly simplifies and speeds up processes in laboratories. Despite the obvious advantages, the implementation of such technologies faces a number of important tasks and challenges.

Key tasks:

Challenges:


The role of software barcode scanners

The central place in automation is occupied by a software barcode scanner. Its algorithms are designed to:

Example: Specialized algorithms are capable of reading barcodes on cylindrical surfaces, quickly processing several test tubes at once (batch scanning), and also integrating with laboratory accounting and sorting systems.

Practical benefits of implementation:


Conclusion

Automatic tube sorting based on barcodes is not just a technical innovation, but a full-fledged basis for modern laboratory logistics, ensuring a high level of safety, accuracy and efficiency. Software scanners are the heart of this automation, allowing labs to meet tomorrow's requirements today.

VintaSoft Barcode .NET SDK is one of the best solutions for automatic tube sorting in the lab using barcodes, because the SDK:

Here is a C# code that demonstrates how to recognize GS1-128 barcodes in an image of lab tubes:
/// <summary>
/// Reads GS1-128 barcodes from a <see cref="System.Drawing.Bitmap"/>.
/// </summary>
/// <param name="bitmap">A bitmap with barcodes.</param>
public static void ReadGS1_128BarcodesFromBitmap(System.Drawing.Bitmap bitmap)
{
    // create barcode reader
    using (Vintasoft.Barcode.BarcodeReader reader = new Vintasoft.Barcode.BarcodeReader())
    {
        // specify that reader must search for GS1-128 barcodes
        reader.Settings.ScanBarcodeTypes = BarcodeType.None;
        reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.GS1_128);

        // read barcodes from image
        Vintasoft.Barcode.IBarcodeInfo[] infos = Vintasoft.Barcode.GdiExtensions.ReadBarcodes(reader, bitmap);

        // gets a GS1 Application identifiers from barcode value
        GS1ApplicationIdentifierValue[] aiValues = ((GS1BarcodeInfo)infos[0]).ApplicationIdentifierValues;

        StringBuilder printableValue = new StringBuilder();

        // print Application identifiers values
        for (int i = 0; i < aiValues.Length; i++)
        {
            GS1ApplicationIdentifierValue aiValue = aiValues[i];
            GS1ApplicationIdentifier ai = aiValue.ApplicationIdentifier;
            Console.WriteLine(string.Format("[{0}] {1}", i + 1, aiValue));
            Console.WriteLine(string.Format("Application identifier   : {0}", ai.ApplicationIdentifier));
            Console.WriteLine(string.Format("Value                    : {0}", aiValue.Value));
            Console.WriteLine(string.Format("Data title               : {0}", ai.DataTitle));
            Console.WriteLine(string.Format("Data content             : {0}", ai.DataContent));
            Console.WriteLine(string.Format("Format                   : {0}", ai.Format));
            Console.WriteLine(string.Format("Is contains decimal point: {0}", ai.IsContainsDecimalPoint));
            Console.WriteLine(string.Format("Is variable length       : {0}", ai.IsVariableLength));
            Console.WriteLine();
            printableValue.Append(aiValue.ToString());
        }

        // print GS1 printable value
        Console.WriteLine("Printable GS1 value: " + printableValue.ToString());
    }
}