CodeD.CSV2Heatmap 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package CodeD.CSV2Heatmap --version 1.0.0
                    
NuGet\Install-Package CodeD.CSV2Heatmap -Version 1.0.0
                    
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="CodeD.CSV2Heatmap" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeD.CSV2Heatmap" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CodeD.CSV2Heatmap" />
                    
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 CodeD.CSV2Heatmap --version 1.0.0
                    
#r "nuget: CodeD.CSV2Heatmap, 1.0.0"
                    
#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 CodeD.CSV2Heatmap@1.0.0
                    
#: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=CodeD.CSV2Heatmap&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CodeD.CSV2Heatmap&version=1.0.0
                    
Install as a Cake Tool

CodeD.CSV2Heatmap

日本語 | English

This is a .NET library that generates heatmap images from 2D map data in CSV format. It is ideal for visualizing scientific measurement data such as surface roughness measurements, X‑ray focusing intensity distributions, and point‑cloud data.

Supported Data Formats:

  • Grid Data (Height Map / Surface Map / Intensity Map / Raster Map)
  • Point Cloud Data (XYZ Format / Scatter Data / Tabular XYZ Data)

Both grid‑based and XYZ‑based data structures are supported, enabling efficient image generation through fast parallel processing and SIMD optimization.

.NET Standard 2.0 License

Features

  • 📊 Supports multiple data formats: Grid Data and Point Cloud Data (XYZ Format)
  • 🎨 Multiple color modes: Rainbow, Monochrome, Black‑Purple‑White
  • 🚀 High performance: Parallel processing + SIMD‑optimized bitmap generation
  • 🔧 Image processing utilities: Plane correction, rotation, trimming, and more
  • 📈 Data conversion: Linear, logarithmic, and natural‑log scales
  • 🔌 Powered by SkiaSharp: Cross‑platform graphics backend

Use Cases

  • Surface roughness data (Surface Map / Height Map)
  • X‑ray intensity distribution (Intensity Map / Raster Map)
  • Visualization of temperature or concentration fields
  • 2D projection of point‑cloud data
  • Gridding and visualization of scattered data
  • Any other 2D map (Grid / Raster) data

Installation

NuGet Package (planned)

dotnet add package CodeD.CSV2Heatmap

Manual Build

git clone https://github.com/dck-jp/CodeD.CSV2Heatmap.git
cd CodeD.CSV2Heatmap
dotnet build src/CodeD.CSV2Heatmap/CodeD.CSV2Heatmap.csproj -c Release

Requirements

  • .NET Standard 2.0 or later
  • SkiaSharp 2.88.8 or later

Usage

Generating a Heatmap from Grid Data

Generates an image from Grid Data (GridCSV, 2D Map Data, Height/Surface/Intensity Maps, etc.).

using CodeD;
using SkiaSharp;

var heatmap = new HeatmapRenderer("grid_sample.txt");

SKBitmap bitmap = heatmap.ToBitmap(
    colorMode: HeatmapRenderer.ColorMode.Rainbow,
    convertMode: HeatmapRenderer.ConvertMode.None
);

using (var image = SKImage.FromBitmap(bitmap))
using (var data = image.Encode(SKEncodedImageFormat.Png, 100))
using (var stream = File.OpenWrite("output.png"))
{
    data.SaveTo(stream);
}

Processing Point Cloud (XYZ) Data

using CodeD;

var parser = new XyzCsvParser("xyz_sample.txt", zColNum: 3);

double[,] gridData = parser.Data;

var heatmap = new HeatmapRenderer(gridData);

var bitmap = heatmap.ToBitmap();

Color Modes

var bitmap1 = heatmap.ToBitmap(colorMode: HeatmapRenderer.ColorMode.Rainbow);
var bitmap2 = heatmap.ToBitmap(colorMode: HeatmapRenderer.ColorMode.Monochorome);
var bitmap3 = heatmap.ToBitmap(colorMode: HeatmapRenderer.ColorMode.BlackPurpleWhite);

Data Conversion Modes

var bitmap1 = heatmap.ToBitmap(convertMode: HeatmapRenderer.ConvertMode.None);
var bitmap2 = heatmap.ToBitmap(convertMode: HeatmapRenderer.ConvertMode.log);
var bitmap3 = heatmap.ToBitmap(convertMode: HeatmapRenderer.ConvertMode.ln);

Image Processing

var heatmap = new HeatmapRenderer("data.txt", pixelSize: 1.0);
var corrected = heatmap.GetPlaneCorrection();
var trimmed = heatmap.GetTrim(10, 10, 50, 50);
var rotatedCW = heatmap.GetRotateCW();
var rotatedCCW = heatmap.GetRotateCCW();
var rotated45 = heatmap.GetRotate(Math.PI / 4);

Accessing Data

int xSize = heatmap.XSize;
int ySize = heatmap.YSize;

double max = heatmap.Max;
double min = heatmap.Min;

double[] rowData = heatmap.GetRowData(0);
double[] columnData = heatmap.GetColumnData(0);

double value = heatmap.Data[x, y];

heatmap.SaveAs("output.txt");

Supported File Formats

Grid Data (GridCSV / 2D Map Data)

Represents numerical data arranged in a grid—commonly used for surface roughness, X‑ray intensity, and raster data.

1.0  2.0  3.0  4.0
2.5  3.5  4.5  5.5
3.0  4.0  5.0  6.0
  • Delimiters: Tab, comma, space
  • Headers: Rows containing strings are treated as headers
  • Data: Numeric rows only

Point Cloud Data (XYZ Format)

Contains X, Y, and Z values (multiple Z columns allowed).

X   Y   Z1    Z2    Z3
0   0   10.5  20.0  30.5
1   0   11.0  21.5  31.0
0   1   12.0  22.0  32.0
  • Delimiters: Tab, comma, space
  • Columns: X, Y, Z (multi‑value supported)
  • Conversion: Automatically transformed into grid data

Note: Assumes regularly spaced grid points. Irregular point-cloud data may not interpolate correctly.

Performance

Optimizations used:

  • Parallel processing
  • SIMD acceleration (Vector<T>)
  • Asynchronous file I/O
  • Memory‑efficient direct pixel access

Samples

Available in samples/:

  • grid_sample_simple.txt
  • grid_sample_temperature.csv
  • xyz_sample.txt
  • xyz_sample2.txt

See samples/README.md for details.

Tests

cd tests/CodeD.CSV2Heatmap.Tests
dotnet test

Includes unit tests for:

  • GridCsvParser
  • XyzCsvParser
  • HeatmapRenderer
  • File-format parsing

License

Released under the MIT License. See LICENSE.

Contributing

Pull requests are welcome. For major changes, open an issue first.

Author

dck-jp

  • SkiaSharp — cross‑platform 2D graphics library
  • .NET Standard — common API set

Changelog

Version 1.0.0

  • Initial release
  • GridCSV support
  • XYZ support
  • Multiple color modes
  • SIMD‑accelerated rendering
  • Basic image‑processing tools

⭐ If you find this project useful, please consider giving it a star!

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.2.0 417 11/18/2025
1.1.0 158 11/15/2025
1.0.2 282 11/13/2025
1.0.1 276 11/13/2025
1.0.0 274 11/13/2025

Initial release with Grid Data and XYZ Point Cloud support, multiple color modes, and SIMD-optimized rendering.