m-ringler.CziCheckSharp 1.0.0-beta2

This is a prerelease version of m-ringler.CziCheckSharp.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package m-ringler.CziCheckSharp --version 1.0.0-beta2
                    
NuGet\Install-Package m-ringler.CziCheckSharp -Version 1.0.0-beta2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="m-ringler.CziCheckSharp" Version="1.0.0-beta2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="m-ringler.CziCheckSharp" Version="1.0.0-beta2" />
                    
Directory.Packages.props
<PackageReference Include="m-ringler.CziCheckSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add m-ringler.CziCheckSharp --version 1.0.0-beta2
                    
#r "nuget: m-ringler.CziCheckSharp, 1.0.0-beta2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package m-ringler.CziCheckSharp@1.0.0-beta2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=m-ringler.CziCheckSharp&version=1.0.0-beta2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=m-ringler.CziCheckSharp&version=1.0.0-beta2&prerelease
                    
Install as a Cake Tool

CziCheckSharp

A .NET wrapper for CZICheck, providing validation and checking capabilities for CZI (Carl Zeiss Image) files.

For the time being, this is not a ZEISS product, and there is no support by ZEISS.

Overview

CziCheckSharp provides a type-safe C# API for validating CZI files using the native CZICheck library. It provides:

  • Structured validation results with detailed findings
  • Configurable validation checks
  • Cross-platform support with native libraries bundled for Windows (x64) and Linux (x64)

Installation

dotnet add package m-ringler.CziCheckSharp

The NuGet package includes the native libraries for supported platforms, so no additional installation steps are required.

Quick Start

using CziCheckSharp;

// Create a checker with default configuration
var configuration = new Configuration();
using var checker = new CziChecker(configuration);

// Validate a CZI file
FileResult result = checker.Check(file);

// Check validation status
if (result.FileStatus == CheckStatus.Ok)
{
    Console.WriteLine("Validation passed!");
}
else
{
    Console.WriteLine($"Validation issues found in file {result.File}:");
    foreach (var checkResult in result.CheckResults.Where(x => x.Status != CheckStatus.Ok))
    {
        Console.WriteLine($"  {checkResult.Check}: {checkResult.Status}");
        foreach (var finding in checkResult.Findings)
        {
            Console.WriteLine($"    {finding.Severity}: {finding.Description}");
        }
    }
}

Platform Support

This package includes native libraries for the following platforms:

  • Windows x64: libczicheckc.dll (included in package)
  • Linux x64: libczicheckc.so (included in package)

The appropriate library is automatically loaded based on your runtime platform. No additional configuration is required.

Note: Other platforms (ARM64, macOS, 32-bit systems) are not currently supported. If you need support for additional platforms, you can build the native library yourself and use a custom DLL import resolver.

Configuration

Customize which checks to run and how they behave:

var configuration = new Configuration
{
    Checks = Checks.Default, // Or Checks.All, or specific flags
    MaxFindings = 100,       // Limit findings per check (-1 for unlimited)
    LaxParsing = false,      // Enable tolerant CZI parsing
    IgnoreSizeM = false      // Ignore M dimension for pyramid subblocks
};

using var checker = new CziChecker(configuration);
var result = checker.Check(file);

Available Checks

// Individual checks (can be combined with | operator)
Checks.HasValidSubBlockPositions
Checks.HasValidSubBlockSegments
Checks.HasConsistentSubBlockDimensions
Checks.HasNoDuplicateSubBlockCoordinates
Checks.DoesNotUseBIndex
Checks.HasOnlyOnePixelTypePerChannel
Checks.HasPlaneIndicesStartingAtZero
Checks.HasConsecutivePlaneIndices
Checks.AllSubblocksHaveMIndex
Checks.HasBasicallyValidMetadata
Checks.HasXmlSchemaValidMetadata          // Opt-in (requires XercesC)
Checks.HasNoOverlappingScenesAtScale1
Checks.HasValidSubBlockBitmaps            // Opt-in (expensive)
Checks.HasValidApplianceMetadataTopography

// Convenience flags
Checks.Default    // All checks except opt-in
Checks.All        // All available checks
Checks.OptIn      // Only the opt-in checks

Advanced: Custom Native Library Path

In most cases, the bundled native libraries work automatically. However, if you need to use a custom-built native library or specify a different location, you can use NativeLibrary.SetDllImportResolver:

using System.Runtime.InteropServices;

NativeLibrary.SetDllImportResolver(
    typeof(CziChecker).Assembly,
    (libraryName, assembly, searchPath) => libraryName switch
    {
        // Load from custom path
        "libczicheckc" => NativeLibrary.Load("/custom/path/to/libczicheckc.so"),
        _ => IntPtr.Zero,
    });

Building the Native Library

If you need to build the native library yourself (e.g., for unsupported platforms) consult the CZICheck building documentation.

Error Handling

The library handles errors by throwing exceptions. Common error scenarios:

  • File not found: Check the file path
  • DllNotFoundException: This should not occur with the NuGet package as native libraries are bundled. If it does occur, ensure you're using a supported platform (Windows x64 or Linux x64)
  • Unavailable checks: Some checks (e.g., HasXmlSchemaValidMetadata) may not be available if the native library wasn't compiled with required dependencies

Version Information

Get the version of the underlying CZICheck library:

string version = CziChecker.GetCziCheckVersion();
Console.WriteLine($"CZICheck version: {version}");

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-beta5 176 11/25/2025
1.0.0-beta4 173 11/24/2025
1.0.0-beta3 333 11/21/2025
1.0.0-beta2 293 11/21/2025
1.0.0-beta1 384 11/20/2025