imr-framework / pypulseq

Pulseq in Python
https://pypulseq.readthedocs.io
GNU Affero General Public License v3.0
111 stars 58 forks source link

Feature: Sequence `install` #163

Open FrankZijlstra opened 5 months ago

FrankZijlstra commented 5 months ago

One main feature from pulseq that I personally use a lot at the scanner is the ability to install sequence files directly onto the host computer. In MATLAB pulseq this can be done with seq.install('siemens'), for example. I implemented a script to do this with pypulseq a while ago, but wasn't really happy with how Siemens-focused this code is. I made a llittle draft of how I thought we could be doing this in pypulseq in a bit more modular way: https://gist.github.com/FrankZijlstra/4049470aaaa7698d952c019e036796e7

The base ScannerDefinition class is the template for all seq.install() actions: We need to be able to check if the scanner is available (connected to the right network, etc.), and if so, be able to install a sequence file on it. Pypulseq would keep track of available scanner definitions (e.g. SiemensDefinition implements the Siemens-specific code that is available in MATLAB pulseq), but users would also be able to use pp.register_scanner to provide their own implementation (though ideally pypulseq would provide implementations for the cases where the seq.install workflow would be possible).

A scanner has a name, and optionally groups it belongs to, which can be used as the target for seq.install(target). E.g. all Siemens definitions will be in a 'siemens' group, so if I'm at a Siemens scanner, but don't know which one, seq.install('siemens') would figure it out (more or less the behaviour of MATLAB pulseq). One feature that I do think is missing here is the option to bypass detecting the scanner, when I know for certain that everything works and I don't need to ping the scanner every time, maybe seq.install('siemens_nx', fast=True)?.

Does this make sense? I'm also curious if someone else has experience with pulseq on vendors other than Siemens, whether a similar seq.install workflow is even possible and could be implemented within this framework?