Skip to content

aagsolutions/nbis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NIST Library

Build&Test Maven Central GitHub license CodeQL Scan Status

A Kotlin implementation of NIST Biometric Image Software (NBIS) for reading, writing, and building NIST records. Compatible with any JVM language.

Getting started:

About

NBIS is a library implemented in Kotlin to extract, decode, build and write NIST compressed files. For more information about NIST Biometric Image Software, visit the official NIST page.

Features

  • βœ… Read NIST files from various input sources
  • βœ… Write NIST files to output streams
  • βœ… Build NIST files programmatically
  • βœ… Support for record types 1-17
  • βœ… JVM language compatibility (Java, Kotlin, Scala, etc.)
  • βœ… Comprehensive field access and manipulation

NIST Record Types Support

Record Type Description Read Write Build
1 Transaction Information Record βœ… βœ… βœ…
2 User-defined descriptive text βœ… βœ… βœ…
3 Low-resolution grayscale fingerprint image βœ… βœ… βœ…
4 High-resolution grayscale fingerprint image βœ… βœ… βœ…
5 Low-resolution binary fingerprint image βœ… βœ… βœ…
6 High-resolution binary fingerprint image βœ… βœ… βœ…
7 User-defined image βœ… βœ… βœ…
8 Signature image βœ… βœ… βœ…
9 Minutiae data (for fingerprints) βœ… βœ… βœ…
10 Facial and SMT image βœ… βœ… βœ…
11 Forensic and investigatory voice data βœ… βœ… βœ…
12 Forensic dental and oral data βœ… βœ… βœ…
13 Variable-resolution latent friction ridge image βœ… βœ… βœ…
14 Variable-resolution fingerprint image βœ… βœ… βœ…
15 Palm print image βœ… βœ… βœ…
16 User-defined variable-resolution test image βœ… βœ… βœ…
17 Iris image βœ… βœ… βœ…
18 DNA data ❌ ❌ ❌
19 Plantar (footprint) image ❌ ❌ ❌
20 Original image record ❌ ❌ ❌

Installation

Maven

<dependency>
    <groupId>eu.aagsolutions.img</groupId>
    <artifactId>nbis</artifactId>
    <version>0.8.0</version>
</dependency>

Gradle (Groovy DSL)

implementation 'eu.aagsolutions.img:nbis:0.8.0'

Gradle (Kotlin DSL)

implementation("eu.aagsolutions.img:nbis:0.8.0")

Quick Start

Reading a NIST File

From an input stream

Kotlin
val nistFile = NistFileReader(inputStream).use { reader -> reader.read() }
val transactionInformationRecord = nistFile.getTransactionInformationRecord()
Java
try (NistFileReader reader = new NistFileReader(inputStream)) {
    NistFile nistFile = reader.read();
    TransactionInformationRecord transactionInformationRecord = nistFile.getTransactionInformationRecord();
}

From a byte array

Kotlin
val nistFile = NistFileReader.Companion.decode(byteArray)
val transactionInformationRecord = nistFile.getTransactionInformationRecord()
Java
NistFile nistFile = NistFileReader.Companion.decode(byteArray);
TransactionInformationRecord transactionInformationRecord = nistFile.getTransactionInformationRecord();

Writing a NIST File

Kotlin

NistFileWriter(FileOutputStream("output.nist")).use { writer -> writer.write(nistFile) }

Java

NistFile nistFile = new NistFileBuilder()
        .withTransactionInformationRecord(transactionInformationRecord)
        .withUserDefinedDescriptionTextRecords(userDefinedTextRecord)
        .withFacialAndSmtImageRecords(facialAndSMTImageRecord)
        .build();
try (NistFileWriter writer = new NistFileWriter(new FileOutputStream("output.nist"))) {
    writer.write(nistFile);
}

API Documentation

Core Classes

NistFile

The main container for NIST records.

Key Methods:

  • getTransactionInformationRecord() - Get the required Type 1 record
  • getRecordsByType(RecordType) - Get all records of a specific type
  • getRecordByTypeAndIdc(RecordType, Int) - Get a specific record by type and IDC
  • getAllRecords() - Get all records in the file

NistFileReader

Reads NIST files from input streams.

NistFileWriter

Writes NIST files to output streams.

NistFileBuilder

Programmatically builds NIST files.

Working with Records

Accessing Field Data

// Get field as text 
val idcValue = record.getFieldText(DefaultFields.IDC)
// Get binary data (for image records) 
val imageData = record.getBinaryData()
// Get specific field object 
val field = record.getField(DefaultFields.LEN)

Record Types

All record types extend BaseRecord and provide type-specific functionality:

  • TransactionInformationRecord - Type 1 records
  • UserDefinedTextRecord - Type 2 records
  • HighResolutionGrayscaleFingerprintRecord - Type 4 records
  • MinutiaeDataRecord - Type 9 records
  • And more...

Field Types

The library supports different field types:

  • TextField - Text-based fields
  • ImageField - Binary image data fields

Requirements

  • Java: 17 or higher
  • Kotlin: 2.1 or higher

Inspiration and Credits

This project was inspired by the need for a robust and efficient library for handling NIST biometric image files. The inspiration comes from the original NBIS library, which is written in C and has been widely used in the biometric community. The goal of this project is to provide a modern, Kotlin-based alternative that is easier to use and maintain.

The project also draws inspiration from the work of other developers who have contributed to the open-source community with similar libraries. By leveraging their work and building upon it, we aim to create a high-quality, reliable, and efficient library for working with NIST biometric image files: