Using the Hugin C#/.NET Core API
As mentioned above, there are four versions of the Hugin C#/.NET Core API, corresponding to all combinations of 32-bit/64-bit and single/double precision computations. The 32-bit versions are only available on Windows.
The platform-independent DLL files are named:
hugincs-9.5-netstandard2.0.dll
(single/32-bit)hugincs2-9.5-netstandard2.0.dll
(double/32-bit)hugincs-9.5-netstandard2.0-x64.dll
(single/64-bit)hugincs2-9.5-netstandard2.0-x64.dll
(double/64-bit)
The base parts of the names of the platform-dependent (native) library files are:
hugincs-94-netstandard20
(single/32-bit)hugincs2-94-netstandard20
(double/32-bit)hugincs-94-netstandard20-x64
(single/64-bit)hugincs2-94-netstandard20-x64
(double/64-bit)
On Windows, the suffix .dll
is added. On Linux and macOS, the
prefix lib
is added, and the suffixes are .so
and .dylib
,
respectively.
The native library files on Windows have a dependency on the Microsoft Visual C++ 2015 Runtime. If it is not already installed, it can be downloaded here:
- Microsoft Visual C++ 2015 Redistributable Package https://www.microsoft.com/en-us/download/details.aspx?id=48145
Important: Return and parameter types vary between the four versions of the API. Specifically, this relates to certain methods in the following classes and interfaces:
A generic signature is displayed in the brief description field of methods that vary in return and parameter type throughout this manual.
On 32-bit size_t = uint
and h_index_t = int
. On 64-bit size_t = ulong
and h_index_t = long
. Single precision h_number_t = single
and double precision h_number_t = double
.
DataSet
public double[] ComputeIEMIntervals (size_t valueColumn, size_t classColumn)
public void DeleteColumn (size_t column)
public void DeleteRow (size_t row)
public String GetColumnName (size_t column)
public String GetDataItem (size_t row, size_t column)
public size_t GetNumberOfColumns()
public size_t GetNumberOfRows()
public void MoveColumn (size_t column, size_t newColumn)
public void MoveRow (size_t row, size_t newRow)
public size_t NewColumn (String name)
public size_t NewRow()
public void SetColumnName (size_t column, String name)
public void SetDataItem (size_t row, size_t column, String data)
DiscreteNode
public h_number_t GetBelief(size_t state)
public h_number_t GetExpectedUtility(size_t state)
public h_number_t GetPredictedBelief(size_t state, size_t time)
public void ComputeExplanationData(size_t x, DiscreteNode Y, size_t y, size_t maxSubsetSize)
public void ComputeExplanationData(size_t state, size_t maxSubsetSize)
public void EnterFinding(size_t state, h_number_t finding)
public h_number_t GetEnteredFinding(size_t state)
public size_t GetNumberOfStates()
public h_number_t GetPropagatedFinding(size_t state)
public size_t GetSampledState()
public h_index_t GetStateIndex(String label)
public String GetStateLabel(size_t state)
public void SelectState(size_t state)
public void SetNumberOfStates(size_t newNumber)
public void SetStateLabel(size_t state, String newLabel)
public size_t GetCaseState(size_t c)
public void SetCaseState(size_t c, size_t state)
public void UnsetCase(size_t c)
public bool CaseIsSet(size_t c)
DiscreteChanceNode
public void ComputeSensitivityData(size_t state)
public h_number_t[] GetSensitivityConstants(size_t index)
NumericDiscreteNode
h_index_t GetStateIndex(double value)
double GetStateValue(size_t s)
void SetStateValue(size_t s, double v)
ContinuousChanceNode
public double GetAlpha(size_t i)
public double GetBeta(ContinuousChanceNode parent, size_t i)
public double GetGamma(size_t i)
public double GetPredictedMean (size_t time)
public double GetPredictedVariance (size_t time)
public void SetAlpha(double alpha, size_t i)
public void SetBeta(double beta, ContinuousChanceNode parent, size_t i)
public void SetGamma(double gamma, size_t i)
public double GetCaseValue(size_t c)
public void SetCaseValue(size_t c, double value)
public void UnsetCase(size_t c)
public bool CaseIsSet(size_t c)
FunctionNode
public double GetPredictedValue(size_t time)
ParseListener
void ParseError(size_t position, String msg)
Class
public Domain CreateDBNDomain(size_t numberOfSlices)
Domain
public Domain(Class cls, size_t numberOfSlices)
public void AddCases(DataSet dataSet, size_t start, size_t count)
public size_t GetDBNWindowOffset()
public void MoveDBNWindow(size_t delta)
public void ComputeDBNPredictions(size_t numberOfTimePoints)
public void EnterCase(size_t caseIndex)
public h_number_t GetCaseCount(size_t caseIndex)
public size_t GetConcurrencyLevel()
public double GetConflict()
public size_t GetEMConcurrencyLevel()
public size_t GetGrainSize()
public size_t GetMaxNumberOfEMIterations()
public size_t GetMaxNumberOfSeparators()
public size_t GetMaxSeparatorSize()
public size_t GetNBFineTuneIterationsLimit()
public size_t GetNumberOfCases()
public size_t NewCase()
public void SaveCases(String fileName, NodeList nodes, size_t[] cases, bool caseCounts, String separator, String missingData)
public void SetCaseCount(size_t caseIndex, h_number_t caseCount)
public void SetConcurrencyLevel(size_t level)
public void SetEMConcurrencyLevel(size_t level)
public void SetGrainSize(size_t size)
public void SetMaxNumberOfEMIterations(size_t count)
public void SetMaxNumberOfSeparators(size_t count)
public void SetMaxSeparatorSize (size_t size)
public void SetNBFineTuneIterationsLimit (size_t limit)
public void SetNumberOfCases(size_t count)
public h_count_t GetNumberOfMAPConfigurations()
public size_t[] GetMAPConfiguration(size_t index)
public double GetProbabilityOfMAPConfiguration(size_t index)
public h_count_t GetNumberOfExplanations()
public NodeList GetExplanation(size_t rank)
public h_number_t GetExplanationScore(size_t index)
public h_number_t GetExpectedUtility()
Model
public Expression GetExpression(size_t index)
public size_t GetNumberOfSamplesPerInterval()
public size_t GetSize()
public void SetExpression(size_t index, Expression expression)
public void SetExpression(size_t index, String expression, ParseListener parseListener)
public void SetNumberOfSamplesPerInterval(size_t count)
Table
public double GetCovariance(size_t i, ContinuousChanceNode node1, ContinuousChanceNode node2)
public h_number_t[] GetData()
public void GetData(ref h_number_t[] data, size_t start, size_t count)
public h_number_t GetDataItem(size_t index)
public double GetMean(size_t i, ContinuousChanceNode node)
public size_t GetSize()
public double GetVariance(size_t i, ContinuousChanceNode node)
public void SetData(h_number_t[] newData)
public void SetData(h_number_t[] data, size_t start, size_t count)
public void SetDataItem(size_t index, h_number_t value)
public void GetConfiguration(ref size_t[] configuration, size_t index)
public size_t GetIndex(size_t[] configuration)
public size_t GetCGSize()
JunctionTree
public size_t GetTotalSize()
public size_t GetTotalCGSize()
In order to make switching between the different Hugin C#/.NET Core
API versions easier, it is recommended to declare aliases for
h_number_t
, size_t
and h_index_t
in the appropriate source files
and use these aliases as types. This can be done by placing the
following piece of code at the beginning of the source files (and then
use the proper size_t, h_index_t
and h_number_t
types in the
source code):
# if X64
using size_t = System.UInt64;
using h_index_t = System.Int64;
# else
using size_t = System.UInt32;
using h_index_t = System.Int32;
# endif
# if H_DOUBLE
using h_number_t = System.Double;
# else
using h_number_t = System.Single;
# endif
Define the symbol H_DOUBLE
to compile with double-precision and
leave it out to compile with single-precision. And define the symbol
X64
when compiling for 64-bit and leave it out when compiling for
32-bit.