OptrisOptrisDocumentation

Documentation/OTC SDK/Optris.Sdk — C# API referencev12.0

Ravi

public static class Ravi

PIX Connect recordings (.ravi) into SDK recordings (.mkv).

A .ravi stores energy counts and rebuilds temperatures on playback from a header in every frame. Ravi.ImportAsync(…) does that once, with PIX Connect's own model, and writes an ordinary SDK recording that ThermalCamera.OpenRecording(…) plays. PIX Connect's measuring areas become regions, the recording says which camera made it when the file says so, and ThermalCamera.PlaybackStartedAt reports when the original was recorded.

Ravi.Inspect(…) answers "will this convert?" from a few hundred kilobytes of the file, whatever its size.

Example

RaviInfo info = Ravi.Inspect("old.ravi");
if (info.Verdict == RaviVerdict.Convertible)
{
    RaviImportResult result = await Ravi.ImportAsync(
        "old.ravi", "old.mkv", new RaviImportOptions(),
        new Progress<RaviImportProgress>(
            p => Console.WriteLine($"pass {p.Pass}: {p.FramesDone}/{p.FramesTotal}")),
        cancellationToken);
    using ThermalCamera replay = ThermalCamera.OpenRecording("old.mkv");
}

Ravi: methods

public static RaviStartTime CorrectStartTime(string recording, RaviTimeZone timeZone)

Set the time zone, and with it the UTC start, of a recording converted from a PIX Connect recording.

  • recording: The .mkv the import wrote.
  • timeZone: The zone the recording PC was in.

Returns: The start as the recording now states it.

  • Throws ArgumentException: recording is null or empty.
  • Throws SdkConfigurationException: The recording was not converted from a .ravi (a recording of a camera states the known zone and start of the computer that made it), the zone cannot be used, or the recording is in several parts.
  • Throws SdkIOException: The recording cannot be read or rewritten.

For a recording converted without a zone, or with the wrong one. The start is read again from the recording PC's clock reading the conversion kept, and every place the recording states its start is rewritten to match: ThermalCamera.PlaybackStartedAt, ThermalCamera.PlaybackTimeZone (which then says RecordingTimeZone.Corrected and no longer RecordingTimeZone.Assumed) and the documents in the recording. Works on recordings converted by any SDK release.

The recording is written again beside itself and renamed into place, so it needs free space for a second copy while this runs, and a failure leaves it as it was.

public static RaviStartTime CorrectStartTime(string recording, DateTimeOffset utcStart)

Set the UTC start of a recording converted from a PIX Connect recording directly, when the instant is known some other way.

  • recording: The .mkv the import wrote.
  • utcStart: The real start. The zone becomes the fixed offset between the recording PC's clock reading and it, to the minute.

Returns: The start as the recording now states it.

  • Throws ArgumentException: recording is null or empty.
  • Throws SdkConfigurationException: As for Ravi.CorrectStartTime(…), and for a start more than 18 hours from the clock reading.
  • Throws SdkIOException: The recording cannot be read or rewritten.

As Ravi.CorrectStartTime(…).

public static RaviImportResult Import(string source, string destination, RaviImportOptions? options = null, IProgress<RaviImportProgress>? progress = null, CancellationToken cancellationToken = default)

Convert a PIX Connect recording into an SDK recording, on the calling thread.

Returns: What was written.

  • Throws ArgumentException: A path is null or empty.
  • Throws OperationCanceledException: cancellationToken was cancelled.
  • Throws RaviDeclinedException: As for Ravi.ImportAsync(…).
  • Throws SdkIOException: As for Ravi.ImportAsync(…).

The same conversion as Ravi.ImportAsync(…), blocking. For a script or a worker that already runs off the user interface thread.

public static Task<RaviImportResult> ImportAsync(string source, string destination, RaviImportOptions? options = null, IProgress<RaviImportProgress>? progress = null, CancellationToken cancellationToken = default)

Convert a PIX Connect recording into an SDK recording, without blocking the caller.

  • source: The .ravi.
  • destination: The .mkv to write.
  • options: How to convert, or null for the defaults.
  • progress: Receives a RaviImportProgress after every frame of every pass, or null for none. A Progress posts to the context it was created on; any other implementation is called on the converting thread. A handler that throws loses that report, not the import.
  • cancellationToken: Stops the import at the next frame. Unlike ThermalCamera.OpenAsync(…) this really stops the work: the native import asks between every frame.

Returns: What was written.

  • Throws ArgumentException: A path is null or empty.
  • Throws OperationCanceledException: cancellationToken was cancelled. Nothing was written at destination.
  • Throws RaviDeclinedException: The file has no radiometric model, or is short-wave without RaviImportOptions.AllowShortWave.
  • Throws SdkIOException: The source cannot be read or is not a .ravi, or the destination cannot be written.

The recording is written beside destination under a temporary name and moved into place when it is complete. A failure or a cancel leaves nothing at destination, and a file already there is replaced only by a finished recording.

The conversion runs on a thread-pool thread for its whole length, which for a long recording is minutes.

public static RaviInfo Inspect(string path, string? normDirectory = null)

Say what a PIX Connect recording holds and whether it converts.

  • path: The .ravi.
  • normDirectory: As RaviImportOptions.NormDirectory. A file whose model is a normalization table needs the table to be judged convertible.

Returns: The answer. A missing, unreadable or foreign file is RaviVerdict.Unreadable with the reason in RaviInfo.Detail; this never throws for a bad file.

  • Throws ArgumentException: path is null or empty.
public static RaviFrameCounts InspectFrameCounts(string path)

Say how many frames a PIX Connect recording declares, and in which header.

  • path: The .ravi.

Returns: The counts. Reads the headers and the RIFF part headers, a few hundred kilobytes whatever the file's size. A missing, unreadable or foreign file has RaviFrameCounts.Readable false; this never throws for a bad file.

  • Throws ArgumentException: path is null or empty.
public static RaviInfo InspectInZone(string path, string? normDirectory, RaviTimeZone? timeZone)

Say what a PIX Connect recording holds and whether it converts, with RaviInfo.RecordedAtUtc read in the recording PC's zone.

  • path: The .ravi.

  • normDirectory: As for Ravi.Inspect(…).

  • timeZone: The recording PC's zone, or null for this computer's.

  • Throws ArgumentException: path is null or empty.

  • Throws SdkConfigurationException: The zone is not known to this computer's zone database.

public static RaviStartTime InspectStartTime(string path, RaviTimeZone? timeZone = null)

Say when a PIX Connect recording started: the recording PC's clock reading, and that reading placed in a zone.

Returns: The start. A file that cannot be read, or records no start, has RaviStartTime.RecordedAtLocal null; this never throws for a bad file.

  • Throws ArgumentException: path is null or empty.
  • Throws SdkConfigurationException: The zone cannot be used.