Runnable Examples
fluxEngine comes with several example programs that the user may run. It also comes with two simple example cubes (reduced to a small size) and two example models.
C++
The C++ examples can be found in the directory examples/cpp
in the
fluxEngine directory. It uses the CMake build system to build the
various examples.
As a first step the user must modify the file
examples/cpp/paths.h
and adjust the following paths:
g_licenseFileName
– the path to the license file for fluxEngine
g_driverDirectory
– the path to the directory containing the device drivers (may be left as-is if no device-specific examples are to be tested)
g_recordingCubeFileName
– the name of the ENVI file that will be written by the examples that generate ENVI recordings
In paths.h
there are two different path definitions, depending on
the operating system.
On Windows the paths should be specified as a
std::wstring
so that Unicode paths will work.(It is also possible to specify them as a
std::string
on Windows, but then only the local code page (CP_ACP
) is used to encode the file names, which may mean that some file names cannot be represented in this manner.)On Linux and macOS the paths must be specified as a
std::string
as these platforms always encoude their paths in 8bit.
Note
On Windows it should be noted that the directory separator, \
,
must be escaped as \\
in a C/C++ string. For example, write
L"C:\\Users\\developer\\Desktop\\fluxEngine.lic"
, which the
C++ compiler will then interpret correctly as the path
C:\Users\developer\Desktop\fluxEngine.lic
.
After paths.h
has been adjusted, CMake must be run. The same CMake
snippet that is described in Building with CMake is
used here, so the user must specify the base directory for fluxEngine
as an argument to CMake.
The following console snippet shows how this may be done on Windows:
C:\Users\developer\Documents\fluxEngine-latest\examples\cpp> mkdir build
C:\Users\developer\Documents\fluxEngine-latest\examples\cpp> cd build
C:\Users\developer\Documents\fluxEngine-latest\examples\cpp\build> cmake -G "GENERATOR" .. -D FLUXENGINE_DIR=C:\Users\developer\Documents\fluxEngine-latest
The GENERATOR
should be replaced with the correct generator for the
compiler in use, e.g. cmake -G "Visual Studio 16 2019" -A "x64"
for
Visual Studio 2019 or cmake -G "MinGW Makefiles"
for MinGW.
The following console snippet shows how this may be done on Linux:
/home/developer/fluxEngine-latest/examples/cpp$ mkdir build
/home/developer/fluxEngine-latest/examples/cpp$ cd build
/home/developer/fluxEngine-latest/examples/build$ cmake .. -D FLUXENGINE_DIR=/home/developer/fluxEngine-latest
After CMake has run the examples may now be built. This may either be
done via cmake --build
from the command line, or, alterantively,
via the development tools directly.
The following sections describe the available examples.
There are several helper methods that may be found in helpers.h
and
helpers.cpp
. They exist for handling file-names properly in a
cross-plattform way. On Windows systems the function
encodeFileNameForConnectionParameter()
may be of particular
interest, as it shows how to properly encode filenames for device
connection parameters.
.NET
The .NET examples can be found in the directory examples/dotnet
in the fluxEngine package.
As a first step the user must modify the file
examples/dotnet/ExampleHelpers/Paths.cs
and adjust the following
paths:
LicenseFileName
– the path to the license file for fluxEngine
DriverDirectory
– the path to the directory containing the device drivers (may be left as-is if no device-specific examples are to be tested)
RecordingCubeFileName
– the name of the ENVI file that will be written by the examples that generate ENVI recordings
The examples have the same functionality as the corresponding C++ examples with the same name and produce approximately the same output.
To compile the examples, open the solution file dotnet.sln
in
the examples/dotnet
directory in Visual Studio. That solution
contains all examples as individual projects.
Note
The user must have configured the nuget package source first before opening the solution in Visual Studio, otherwise Visual Studio will not be able to find the fluxEngine.NET nuget package and automatically install it.
Python
The Python examples can be found in the directory examples/python
in the fluxEngine directory.
As a first step the user must modify the file
examples/python/fluxEngine_example_paths.py
and adjust the
following paths:
licenseFileName
– the path to the license file for fluxEngine
driverDirectory
– the path to the directory containing the device drivers (may be left as-is if no device-specific examples are to be tested)
recordingCubeFileName
– the name of the ENVI file that will be written by the examples that generate ENVI recordings
The examples have the same functionality as the corresponding C++ examples with the same name and produce approximately the same output.
Example Programs
- Read ENVI Cube and Process using Model
- Read ENVI Cube and Process using Model (Explicit Variant)
- Enumerate Devices
- Obtain a frame from a camera
- Generate a Preview for a PushBroom
- Record an ENVI Cube in Intensities with References from a PushBroom
- Record an ENVI Cube in Reflectances from a PushBroom (Normalized)
- Record an ENVI Cube in Intensities with References from a PushBroom While Generating a Preview
- Process Data from a PushBroom Device in a Model
- Process Data from a PushBroom Device in a Model (Loading a White Reference from disk)
- Record data from a PushBroom and then process the entire recording
- Process Data from a PushBroom Device in a Model (Chunkwise Separate Thread)
- Process Data from a PushBroom Device With an Object Detector