TrajectoryLogReader 2.0.0-beta.1

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

Trajectory Log Reader

Reads Varian TrueBeam trajectory log files (*.bin). This has only been tested with log-files of version 5.0.

Usage

Install from NuGet

dotnet add package TrajectoryLogReader

Load the log file:

TrajectoryLog log = LogReader.ReadBinary(filePath);

Data access

Log-file data can be accessed through either a "column-based" (axes) or "row-based" (snapshots) approach.

Axes data

log.Axes provides a wrapper around the raw-data for each axis.

var expected = log.Axes.Gantry.ExpectedValues;
var actual = log.Axes.Gantry.ActualValues;
var errors = log.Axes.Gantry.ErrorValues;
var expectedSubBeam1 = log.SubBeams.First().Axes.Gantry.ExpectedValues;

Snapshots

Reading all snapshots can be done via:

foreach (var snapshot in log.Snapshots)
{
    Console.WriteLine(snapshot.X1.Actual);
    Console.WriteLine(snapshot.X1.Expected);
}

The same can be performed for sub-beams:

foreach (var sub in log.SubBeams)
{
    foreach (var snapshot in sub.Snapshots)
    {
        Console.WriteLine(snapshot.X1.Actual);
        Console.WriteLine(snapshot.X1.Expected);
    }
}

Interpolation

There are some useful functions for interpolating data at various times. For example:

int timeInMs = 20;
var gantryExpected = log.InterpolateAxisData(Axis.Gantry, timeInMs, RecordType.ExpectedPosition);
var gantryActual = log.InterpolateAxisData(Axis.Gantry, timeInMs, RecordType.ActualPosition);

Data is linearly interpolated between sampling intervals.

MLC leaf positions can be interpolated at time t:

int bankA = 0;
int bankB = 1;
int leafIndex = 0;
int timeInMs = 25;
double mlc = log.InterpolateMLCPosition(timeInMs, bankA, leafIndex, RecordType.Actual);

Or, a 2D array of MLC positions interpolated at time t can be extracted:

int t = 25; // time in ms
float[,] mlc = log.InterpolateMLCPositions(t, RecordType.Expected);

Fluence Reconstruction

The library reconstructs the delivered 2D fluence by temporally integrating the beam intensity over the course of the delivery. This provides a high-fidelity representation of the actual modulation delivered by the linac.

var fluence = log.CreateFluence(options, RecordType.Actual); // for the entire log file
var fluenceSubBeam = log.SubBeams.First().CreateFluence(options, RecordType.Actual); // just for this beam

Dosimetric Principles:

  • Aperture Integration: The total fluence is the summation of instantaneous apertures defined by the MLC and Jaws at each control point, weighted by the incremental MU delivered.
  • Geometric Accuracy: The algorithm accounts for dynamic collimator rotation and asymmetric jaw tracking.
  • Sub-pixel Resolution: To accurately model high-modulation VMAT arcs and small stereotactic fields, the system uses an exact area-intersection method (Sutherland-Hodgman) rather than simple center-point sampling. This eliminates aliasing artifacts and partial-volume errors at the leaf edges.

Gamma Analysis

The verification module implements the standard 2D Gamma Index analysis (Low et al., 1998) to quantify the agreement between the Reference (Plan) and Evaluated (Log) distributions.

Algorithm Specifics:

  • Grid Resampling: To minimize discretization error in high-gradient regions (penumbra), the Reference distribution is automatically upsampled. The resolution is set to ensure it is significantly smaller than the Distance-to-Agreement (DTA) tolerance (default $\le \frac{1}{5} \text{DTA}$).
  • Composite Metric: The algorithm evaluates the generalized $\gamma$ function, combining dose difference ($\Delta D$) and spatial distance ($\Delta d$) criteria. It supports both Global Normalization ( relative to $D_{max}$) and Local Normalization.
  • Efficient Search: A localized search window (default radius $2 \times \text{DTA}$) is used for each evaluated point to find the minimum $\gamma$ value.
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 is compatible.  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 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 is compatible.  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 is compatible.  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 is compatible. 
.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.
  • .NETStandard 2.0

  • .NETStandard 2.1

    • No dependencies.
  • net10.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on TrajectoryLogReader:

Package Downloads
TrajectoryLogReader.DICOM

Provides methods for calculating fluence using DICOM plan data

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.1 0 1/29/2026
2.0.0 80 1/28/2026
2.0.0-beta.3 28 1/27/2026
2.0.0-beta.2 34 1/27/2026
2.0.0-beta.1 36 1/26/2026
2.0.0-alpha.9 44 1/19/2026
2.0.0-alpha.8 41 1/19/2026
2.0.0-alpha.7 43 1/18/2026
2.0.0-alpha.6 44 1/16/2026
2.0.0-alpha.5 44 1/15/2026
2.0.0-alpha.4 39 1/15/2026
2.0.0-alpha.3 44 1/14/2026
2.0.0-alpha.2 42 1/11/2026
2.0.0-alpha.1 41 1/10/2026
1.2.0 169 12/23/2025
1.1.1 424 12/10/2025
1.1.0 419 12/10/2025
1.0.0 155 12/17/2024