FlowCytometryStandard 4.0.18

dotnet add package FlowCytometryStandard --version 4.0.18
                    
NuGet\Install-Package FlowCytometryStandard -Version 4.0.18
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FlowCytometryStandard" Version="4.0.18" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FlowCytometryStandard" Version="4.0.18" />
                    
Directory.Packages.props
<PackageReference Include="FlowCytometryStandard" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FlowCytometryStandard --version 4.0.18
                    
#r "nuget: FlowCytometryStandard, 4.0.18"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FlowCytometryStandard@4.0.18
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FlowCytometryStandard&version=4.0.18
                    
Install as a Cake Addin
#tool nuget:?package=FlowCytometryStandard&version=4.0.18
                    
Install as a Cake Tool

<div align="center">

Logo

FCS 流式细胞文件读写组件

FlowCytometryStandard —— 多语言实现的 FCS(Flow Cytometry Standard)流式细胞术数据文件读写组件, 提供 C# / Java / C++ / Python 四个语言版本

version C# Java C++ Python license

</div>


✨ 项目简介

FCS 是流式细胞术(Flow Cytometry)领域通用的数据文件格式标准。本组件提供对 .fcs 文件的读取、解析、写入能力,并内置补偿计算、刻度换算、时间通道计算等常用功能, 采用多线程 / 异步 IO 优化,适合处理大规模流式细胞数据集。

四个语言版本基于同一套核心实现移植,API 结构与语义保持一致:

语言版本 目录 说明
C# src/C# 首发版本,NuGet 包 FlowCytometryStandard,netstandard2.0
Java src/Java Maven 构建(cn.lvwl:flow-cytometry-standard),Java 8+,无第三方依赖
C++ src/C++ C++17,CMake 构建,无第三方依赖的静态库
Python src/Python Python 3.9+,flowcytometrystandard 包,仅依赖标准库

🔗 开源地址

📦 支持范围

项目 支持情况
读取版本 3.2、3.1、3.0 及部分 2.0
写入版本 3.2、3.1、3.0
存储模式 Mode L(列表模式)
数据格式 DataType I(整数)、F(单精度浮点)、D(双精度浮点)
目标平台(C#) netstandard2.0
目标平台(Java) Java 8+,Maven
目标平台(C++) C++17,CMake,无第三方依赖
目标平台(Python) Python 3.9+,仅依赖标准库

🚀 快速开始

C#(命名空间 FlowCytometryStandard)

// 读取文件中全部数据集
IList<IFCS> fcsList = await Factory.OpenAsync(@"C:\test.fcs");

// 仅读取文件中第一个数据集
IFCS firstDataset = await Factory.OpenOneAsync(@"C:\test.fcs");

// 保存数据集到文件
await Factory.SaveToFCSAsync(@"C:\test1.fcs", fcsList.ToArray());

// 计算补偿后的刻度值数据(写入各通道的 CompensationScaleValues 属性)
await firstDataset.CalculationCompensationAsync();

// 清除补偿后的刻度值数据
firstDataset.ClearCompensationScaleValues();

Java(包名 flowcytometrystandard)

// 读取文件中全部数据集
List<IFCS> fcsList = Factory.open("C:/test.fcs");

// 仅读取文件中第一个数据集
IFCS firstDataset = Factory.openOne("C:/test.fcs");

// 保存数据集到文件(另提供返回 CompletableFuture 的 *Async 异步方法)
Factory.saveToFCS("C:/test1.fcs", fcsList.toArray(new IFCS[0]));

// 计算补偿后的刻度值数据(写入各通道的 CompensationScaleValues 属性)
firstDataset.calculationCompensation();

// 清除补偿后的刻度值数据
firstDataset.clearCompensationScaleValues();

C++(头文件 <fcs/Factory.h>,命名空间 fcs)

#include <fcs/Factory.h>

using namespace fcs;

// 读取文件中全部数据集(同步 API,可自行提交到线程池)
auto fcsList = Factory::open("C:/test.fcs");

// 仅读取文件中第一个数据集
auto firstDataset = Factory::openOne("C:/test.fcs");

// 保存数据集到文件
Factory::saveToFCS("C:/test1.fcs", fcsList);

// 计算补偿后的刻度值数据(写入各通道的 compensationScaleValues 属性)
firstDataset->calculationCompensation();

// 清除补偿后的刻度值数据
firstDataset->clearCompensationScaleValues();

Python(包名 flowcytometrystandard)

from flowcytometrystandard import Factory

fcs_list = Factory.open("C:/test.fcs")          # 读取文件中全部数据集
first = Factory.open_one("C:/test.fcs")         # 仅读取第一个数据集
Factory.save_to_fcs("C:/test1.fcs", fcs_list)   # 保存数据集到文件
raw = Factory.save_to_bytes(fcs_list, "FCS3.2") # 序列化到内存,不落盘

first.calculation_compensation()                # 计算补偿后的刻度值数据
first.clear_compensation_scale_values()         # 清除补偿后的刻度值数据

另提供 open_async / save_to_fcs_async 等异步方法、read_data 补读数据段、 create_fcs 生成数据集;详见 src/Python/examples/quickstart.py。

🧩 核心能力

  • 多语言版本 —— C# / Java / C++ / Python 四端同构 API,核心行为与文件输出一致(同版本与跨版本保存均逐字节一致,个别已知差异见 SDK 文档)。
  • 文件读写 —— Factory 提供多版本读取 / 保存 API,支持文件路径与数据流两种入口。
  • 数据解析 —— 文本段、补充文本段、数据段的解析与生成,兼容多种字节序。
  • 补偿计算 —— 支持 FCS3.0 的 Compensation 与 FCS3.1 / 3.2 的 Spillover,多线程矩阵运算。
  • 刻度换算 —— PnE 对数放大、PnG 线性放大、校准(Calibration)及其逆运算。
  • 性能优化 —— 数据段「并行解码 + 有界流水线」,等宽通道走整块批量路径,CRC16 slice-by-8,大文件读写吞吐见 性能实测。

⚡ 性能

数据段读写采用并行解码 + 有界流水线:读满一块立即提交解码、与后续读盘重叠;写入时数据块生成 与落盘、CRC 校验重叠。单块大小按「128MB 流水线预算 ÷ 在飞块数」自动折算,在飞块数与并行度不变, 峰值内存不随核数线性膨胀。

四语言实测吞吐(同一工作负载,$DATATYPE=D、20 通道 × 150 万事件、数据段 240MB):

语言版本 读取 写入
C# 3045 MB/s 932 MB/s
Java 1518 MB/s 653 MB/s
C++ 1074 MB/s 994 MB/s
Python 223 MB/s 172 MB/s

测试环境:Windows 11 / 16 逻辑核 / NVMe SSD;.NET 11、OpenJDK 21、MSVC /O2 /MD、CPython 3.13。 口径:「读」为 OpenOne 全量解析(含数据段解码与通道数组分配),「写」为 SaveToFCS (含数据段编码、CRC16 校验与落盘);暖缓存下三次独立进程各 6 轮,取中位。 「相对 4.0.17」为同一工作负载、同一台机器上的实测倍数。Python 版仅用标准库(不含 numpy), 绝对值低于其余三端,其优化主要来自 CRC 与等宽通道批量路径。 磁盘写入带宽低于上表时吞吐受 IO 限制;CPU 核数越多,并行路径收益越明显。

影响吞吐的主要因素:

  • 通道位宽与事件数 —— 同一字节量下,位宽越窄、事件数越多,解码循环次数越多,吞吐越低。
  • 通道位宽是否一致 —— 等宽通道走「整块 array / 目标类型直取」批量路径;混合位宽或非 8 倍数位宽走回退路径。
  • 单任务字节数 —— OneTaskAnalysisMaxBytesCount(默认 20MB)决定单块大小与并行粒度,可按磁盘与内存调整。
  • 并行开关 —— Java / C++ 可在运行时关闭并行(Java Factory.setParallelEnabled(false)、 C++ Factory::setParallelEnabled(false)),Python 受 GIL 限制为串行分块(set_parallel_enabled 仅为语义对齐保留)。

详细实现(流水线结构、内存预算、各语言快路径、异常路径收尾)见 SDK 文档 · 性能与内存。

📖 文档

📄 许可证

本项目基于 AGPL-3.0 许可证开源。

商业支持

如需购买、定制流式采样或分析控件/软件,请联系:

  • 微信:Lvwl-CN
  • 邮箱:Lvwl@outlook.com

(请说明来意,会及时回复)

❤️ 支持开源

开源不易,感谢支持!

支付宝 / 微信

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.18 108 11/19/2026
4.0.17 106 11/13/2026
4.0.15 130 10/9/2026