Skip to content

orger-lab/sardine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sardine

Core WPF Addons
NuGet Core NuGet WPF

Version

Sardine is an open-source framework for developing and executing complex scientific workflows written in C# and built with .NET 8. It is designed to rapidly create and execute data acquisition and processing desktop applications following a modular approach.

Sardine allows the reliable execution of dynamic networks of independent modules - where each module can interface with hardware, process data, or both. It includes integrated logging and UI management, has a low overhead, provides fault-tolerant hardware control, and minimizes downstream delays by providing dedicated data processing queues for each module. Any .NET class can be easily adapted to a Sardine module, facilitating integration with existing codebases.

Get Sardine through NuGet! The WPF add-ons to build desktop applications are available in the WPF add-ons package.

Our component collection and examples are available here.


A change log is available here.

Submit crash reports/bugs/feature requests through GitHub Issues.

Quick Start

Get the packages via NuGet, by using the package manager or from the CLI:

nuget install Sardine.Core
nuget install Sardine.Core.Views.WPF

Building a Fleet and Freighting Vessels

using Sardine.Core;
namespace ExampleSystem;

// Create a new Fleet
public class MySystem : Fleet
{

    // Declare Vessel properties that will serve as containers for the components
    public Vessel<CameraService> CameraProvider { get; }
    public Vessel<Camera> ImagingCamera { get; }
    public Vessel<DataSaver> FrameSaver { get; }

    public MySystem()
    {

        // Freight the Vessels by providing both dependencies
        // and build, initializer, and invalidator methods
        CameraProvider = Freighter.Freight(
				builder: () => new CameraService()
			     );

        ImagingCamera = Freighter.Freight(
				CameraProvider,
				builder: (provider) => ...,
				initializer: (provider, camera) => ...,
				invalidator: (provider, camera) => ... );

        FrameSaver = Freighter.Freight(() => ...);
    }
}

Adding a data operation

// Write methods matching one of the data operation signatures
public delegate TOut? Source<out TOut>(THandle handle, out bool hasMore);
public delegate TOut? Transformer<in TIn, out TOut>(THandle handle, TIn data, MessageMetadata metadata);
public delegate void Sink<in TIn>(THandle handle, TIn data, MessageMetadata metadata);

// Add data operation to vessels in the Fleet constructor
public MySystem()
{
...
ImagingCamera.AddSource(CameraFrameSource);
FrameSaver.AddSink(FrameSink);
ImagingCamera.SourceRate = 100;
...
}

Creating an application

--- XAML
<sardine:SardineApplication            
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:sardine="clr-namespace:Sardine.Core.Views.WPF;assembly=Sardine.Core.Views.WPF"
	xmlns:fleet="clr-namespace:ExampleSystem;assembly=ExampleSystem"
	x:TypeArguments="fleet:MySystem"
	x:Class="ExampleApplication.App"
/>

--- Code behind
using Sardine.Core.Views.WPF;

namespace ExampleApplication;

// Have the entrypoint derive from SardineApplication
public partial class App : SardineApplication<MySystem> { }

License

Sardine is licensed under the MIT License. If you are using software built with Sardine for your research, please cite our publication below.

Citation

Martins, A. L., Laborde, A., & Orger, M. (2025). Sardine: a modular framework for developing data acquisition and near real-time analysis applications. bioRxiv, 2025-08. doi: https://doi.org/10.1101/2025.08.05.668834

Contact

  • Point of contact: Lucas Martins
  • Email: lucas.martins at neuro.fchampalimaud.org
  • Organization: Champalimaud Foundation

Acknowledgments

This work was financed by funding to Michael Orger's lab from the European Research Council (Consolidator Grant, Neurofish-DLV-773012), the Champalimaud Foundation, the Volkswagen Stiftung Life? Initiative (A126151) and through national funds from the Portuguese FCT - Foundation for Science and Technology, I.P., under the projects PTDC/NEU-SCC/5221/2014 and 2023.14873.PEX.

A. Lucas Martins received funding from the Portuguese Fundação para a Ciência e Tecnologia (FCT) through the PhD fellowships SFRH/BD/129843/2017 and COVID/BD/152726/2022.

About

A framework for building data acquisition systems

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages