= Duneuro forward modeling using containers = <> This tutorial explains how to compute EEG/MEG forward models with '''duneuro''' using the new container-based integration in Brainstorm. Using containers allows running duneuro without manually installing its dependencies or compiling external libraries. ---- == Introduction == Duneuro is an advanced forward modeling tool for EEG and MEG. It relies on a number of external numerical libraries, which can make manual installation difficult. Brainstorm now supports running duneuro using '''containers''', which package duneuro and all its dependencies in a reproducible environment. This tutorial demonstrates how to use duneuro through containers directly from Brainstorm. ---- == Requirements == * Brainstorm (development version including container support) * A supported container runtime: * Docker (Windows, macOS, Linux) * Podman (Linux) * Apptainer / Singularity (HPC clusters) If you have not installed a container runtime yet, please follow: [[Tutorials/bstContainers|Using Containers with Brainstorm]] ---- == About containers (short reminder) == Containers allow Brainstorm to run external tools without manual installation of libraries or compilers. ''Note:'' Docker requires a running ''daemon'' (a background service). Podman and Apptainer do not. ---- == Dataset == This tutorial uses the same example dataset as the standard duneuro tutorial. You may either: * Follow the tutorial using your own subject anatomy, or * Reuse the sample anatomy provided in Brainstorm tutorials The exact dataset is not critical for demonstrating the container workflow. ---- == Step 1: Prepare the anatomy == As with any forward modeling approach, you need a subject anatomy. 1. Import a subject MRI 1. Compute the cortical surface 1. Import or generate the head surfaces (scalp, skull, brain) Refer to the general Brainstorm documentation if needed: [[Tutorials/Anatomy|Anatomy processing]] ---- == Step 2: Open the forward modeling interface == 1. Select your subject 1. Right-click on the subject name 1. Select: . ''Compute head model'' In the head model computation panel: * Select '''duneuro''' as the forward model * Select EEG, MEG, or both, depending on your data ---- == Step 3: Enable container-based execution == In the duneuro options panel: * Enable the option to run duneuro using '''containers''' * Brainstorm will automatically: * Detect an available container runtime * Check that the runtime is usable * Download the duneuro container image if needed (after confirmation) No manual container commands are required. ---- == Step 4: Container image download == If the duneuro container image is not already available, Brainstorm will display a confirmation dialog asking whether the image should be downloaded. After confirmation: * The image is downloaded automatically * The image is cached and reused for future runs This step is required only once. ---- == Step 5: Compute the forward model == After the container is ready: 1. Validate the duneuro options 1. Start the computation Brainstorm will run duneuro inside the container and retrieve the results automatically. From the user perspective, the workflow is identical to a native execution. ---- == Inspecting the results == Once the computation is complete: * The head model appears in the database * Sensitivity maps and lead fields can be visualized as usual For MEG: * Tangential sources show higher sensitivity than radial sources * This behavior is expected and reflects the physical properties of MEG ---- == Advantages of the container approach == Using duneuro with containers provides several benefits: * No manual installation of duneuro dependencies * Identical behavior across operating systems * Easier reproducibility of results * Simplified usage on shared systems and clusters ---- == Notes and limitations == * Container support is currently considered '''experimental''' * The interface may evolve based on user feedback * Future versions may integrate container management more tightly . with the Brainstorm Plugin Manager ---- == Summary == * Brainstorm can run duneuro using containers * Only a container runtime is required * Duneuro dependencies are handled automatically * The workflow is identical to standard head model computation ---- == See also == * [[Tutorials/Duneuro|Standard duneuro tutorial]] * [[Tutorials/bstContainers|Using Containers with Brainstorm]] * [[https://github.com/brainstorm-tools/brainstorm3/pull/882|Container support PR]]