Writing File Loader Plugins
SIGVIEW supports custom file loader plugins written in Julia. These plugins allow you to extend SIGVIEW with support for additional signal file formats beyond the built-in ones. This provides a flexible and powerful way to integrate proprietary, experimental, or uncommon data formats directly into your analysis workflow.
For details about using File Plugins, see this topic.
For details about basic data types used for the development, see Data types.
Writing a Plugin
A plugin is a single Julia script file (.jl) that must implement four functions:
getPluginName()
getFileExtensions()
getFileTypeDescription()
loadFile( filePath :: String )
The plugin script has access to the SigviewSignalWindow type, which is automatically available without any include or import statement. You do not need to include SigviewBaseTypes.jl or any other Sigview base script. The plugin environment is set up by Sigview before your script runs.
If your plugin requires external Julia packages, add a "using" statement at the top of your script. If the package is not installed, SIGVIEW will detect this and offer to install it for the user.
Simple Example
The following plugin loads single-column CSV files as signals:
function getPluginName()
return "Simple CSV Loader"
end
function getFileExtensions()
return "csv"
end
function getFileTypeDescription()
return "Comma-separated values (.CSV)"
end
function loadFile( filePath :: String )
channels = SigviewSignalWindow[]
lines = readlines( filePath )
values = Float32[]
for line in lines
line = strip( line )
if length( line ) > 0
try
push!( values, parse( Float32, line ) )
catch
end
end
end
if length( values ) > 0
channel = SigviewSignalWindow()
channel.samples = values
channel.samplingRate = 1.0
push!( channels, channel )
end
return channels
end
Required Functions Reference
getPluginName()
Returns a string with the display name of the plugin. This name is used in error messages and dialogs.
Example:
function getPluginName()
return "My Custom File Loader"
end
getFileExtensions()
Returns a string containing the file extension(s) this plugin handles, without the leading dot. If the plugin supports multiple extensions, separate them with semicolons.
Example for a single extension:
function getFileExtensions()
return "mat"
end
Example for multiple extensions:
function getFileExtensions()
return "npy;npz"
end
getFileTypeDescription()
Returns a string describing the file type. This text appears in the File Open dialog filter dropdown.
Example:
function getFileTypeDescription()
return "MATLAB data files (.MAT)"
end
loadFile( filePath :: String )
This is the main function of the plugin. It receives the full path to the file the user selected and must return an array of SigviewSignalWindow objects, one for each signal channel found in the file.
The filePath parameter is an absolute file path as a Julia String.
The function must return a value of type Array{SigviewSignalWindow} (which can also be written as SigviewSignalWindow[]). If the file contains no loadable signals, return an empty array. If an error occurs, the function may throw an exception, which Sigview will catch and display to the user.
Example:
function loadFile( filePath :: String )
channels = SigviewSignalWindow[]
channel = SigviewSignalWindow()
channel.samples = Float32[ 1.0, 2.0, 3.0 ]
channel.samplingRate = 44100.0
push!( channels, channel )
return channels
end