A minimal C++/CLI bridge that embeds the .NET runtime to read Thermo .raw files via the official ThermoFisher vendor DLLs.
- Embeds .NET 9 runtime inside a native C++ DLL
- Loads ThermoFisher.CommonCore vendor DLLs
- Exposes a simple C++ API to read mass spectra from
.rawfiles - Tested on Windows x64
Python / C++ caller
|
ThermoWrapper.dll (C++/CLI bridge)
|
ThermoFisher.CommonCore.RawFileReader.dll (vendor .NET DLL)
|
.raw file
RawBridge::GetScanCount(filePath) // Total number of scans
RawBridge::GetRetentionTime(filePath, scanNum) // Retention time in minutes
RawBridge::GetScanFilter(filePath, scanNum) // Scan filter string
RawBridge::GetScan(filePath, scanNum) // Full spectrum (m/z + intensity arrays)- Windows x64
- .NET 9 runtime
- Visual Studio 2022 (to compile)
- ThermoFisher.CommonCore DLLs (from NuGet: ThermoFisher.CommonCore.RawFileReader)
MSBuild ThermoWrapper.sln /p:Configuration=Release /p:Platform=x64
import pythonnet
pythonnet.load("coreclr")
import clr, sys
sys.path.append(r"path\to\dlls")
clr.AddReference("ThermoWrapper")
from ThermoWrapper import RawBridge
count = RawBridge.GetScanCount(r"path\to\file.raw")
scan = RawBridge.GetScan(r"path\to\file.raw", 1)
print(scan.Masses, scan.Intensities)- Windows x64 - Working
- Linux - In progress
- macOS - Planned