datraw 1.1.0

dotnet add package datraw --version 1.1.0
                    
NuGet\Install-Package datraw -Version 1.1.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="datraw" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="datraw" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="datraw" />
                    
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 datraw --version 1.1.0
                    
#r "nuget: datraw, 1.1.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 datraw@1.1.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=datraw&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=datraw&version=1.1.0
                    
Install as a Cake Tool

datraw

Build Status datraw Version Vcpkg Port

This is a C++ header-only reimplementation of VIS's datraw library for volumetric data. The data sets are split in two files, the dat file containing a textual description of the data and the raw file which contains the actual volumetric data without any meta information.

The dat file

The dat file holds properties describing the raw data. Each property must be in a separate line. The name of the property and its value are separated by a colon (":").

In principle, arbitrary properties can be stored. However, some properties have special meaning and some are considered to be required. The well-known properties are:

Property name Type Description
OBJECTFILENAME String The name(s) of the raw file(s). For a single raw file this is just the file name, for multiple raw files, forming for example a time-series, a the numbering is controlled by a format string.
FORMAT Enum The format (or data type) of a single element of the tuples (i.e. the scalar type)
GRIDTYPE Enum The type of grid the data is organised in.
COMPONENTS Integer The number N of components per tuple.
DIMENSIONS Integer The dimensionality M of the grid.
TIMESTEPS Integer The number of time steps/number of raw files (defaults to 1).
BYTEORDER Enum The byte order the raw files are stored in; either LITTLE_ENDIAN (default) or BIG_ENDIAN.
DATAOFFSET Integer The offset, in bytes, in the raw file(s) where the actual data starts (defaults to 0).
RESOLUTION Array of Integer The resolution of the grid, i.e. the number of elements in each dimension.
SLICETHICKNESS Array of Float The size of the grid cells in each direction/dimension (defaults to 1.0 for each dimension).
SLICETHICKNESS[a] Array of Float The distances between the grid cells on axis a for a rectilinear grid (defaults to 1.0 for all missing values).

The raw file

The raw file stores binary data as an M-dimensional array of N-dimensional tuples. All elements of the tuple need to have the same type.

Usage

In order to use the library in your project, add the datraw folder to the list of #include directories. Add #include "datraw.h". All other files are included via this file.

The library represents the dat file in the info class and provides access to the raw file(s) by means of the raw_reader class. The raw_reader can either be created from the path to a dat file or from an existing in-memory info instance. An info object can be parsed from the path to a dat file or from an in-memory string (e.g. if the data have been received from the network).

All classes are templated with the character type (char or wchar_t) and are located in the datraw namespace.

The following example shows the minimal example for iterating over all time steps in the data set described by "foot.dat":

#include "datraw.h"

typedef datraw::raw_reader<char> reader;

auto r = reader::open("foot.dat");
while (r) {
    std::vector<datraw::uint8> raw = r.read_current();
    r.move_next();
}

The variant with an explicit instance of the info class looks like:

#include "datraw.h"

typedef datraw::info<char> info;
typedef datraw::raw_reader<char> reader;

auto info = info::load("foot.dat");
reader r(info);
for (std::uint64_t i = 0; i < info.time_steps(); ++i) {
    r.move_to(i);
    assert(r);
    std::vector<datraw::uint8> raw = r.read_current();
}

There is a zero-copy overload of raw_reader::read_current which uses a user-provided buffer and returns the required buffer size. It can be used as follows:

#include "datraw.h"

typedef datraw::raw_reader<char> reader;

std::vector<datraw::uint8> frame;

auto r = reader::open("foot.dat");
while (r) {
    frame.resize(r.read_current(nullptr, 0));
    r.read_current(frame.data(), frame.size());
    r.move_next();
}
Product Compatible and additional computed target framework versions.
native native is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has 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.1.0 88 9/12/2025
1.0.9 309 1/15/2024
1.0.8 308 10/10/2023
1.0.7 298 10/9/2023
1.0.6 575 10/14/2022
1.0.5 616 5/14/2020
1.0.4 591 5/14/2020
1.0.3 599 5/13/2020
1.0.2 822 5/18/2019
1.0.1 950 10/10/2018
1.0.0 951 10/10/2018

Adds ABI versioning via an inline namespace.