Quick Answer: The
jackie-fmri-simrepository demonstrates how to execute a canine fMRI simulation in Python by coupling recorded BOLD neuroimaging data with real-time physiological telemetry. The system updates a 25-region brain network and a 6D emotional vector using deterministic decay rates and session-derived regression mappings without synthetic statistical filler.
Running a canine fMRI simulation python pipeline requires bridging raw neuroimaging logs with continuous physiological monitoring. Most computational neuroscience tutorials rely on artificial toy data, but modern digital twin models extract signal vectors directly from live test runs. The jackie-fmri-sim project provides a Python architecture modeled on a single canine subject (Canis lupus familiaris), mapping real Blood Oxygen Level Dependent (BOLD) changes to subjective emotional states.
Here is how you can inspect, execute, and extend this computational neuroimaging framework.
Understanding the Canine Brain Twin Architecture
Reconstructing a living canine brain network requires tracking both core limbic centers and sensory processing hubs. The jackie-fmri-sim framework centers on three critical anatomical structures: the olfactory bulbs, the amygdalae, and the nucleus accumbens. In canine cognition, the olfactory bulb acts as the primary gate for environmental evaluation, while the amygdala registers physiological valence and potential threat.
Instead of treating every voxel independently, the model organizes the brain into a 25-region spatial network. Primary nodes take direct BOLD injections from session logs, while secondary areas—like the cingulate cortex, temporal pole, and superior temporal gyrus—stay at baseline until driven by regression weights derived from empirical scans.
# Extracting BOLD readings from scan logs
session_data = {
'olfactory_L': 1.82, 'olfactory_R': 1.28,
'amygdala_L': 2.40, 'amygdala_R': 2.21,
'nacc_L': 2.21, 'nacc_R': 4.31
}
During session J001 (exposure to chicken meat), left and right nucleus accumbens BOLD z-scores spike to 2.21 and 4.31 respectively. These values reflect acute reward anticipation, pulling the system state vector toward high excitement and joy.
That said, there is a real catch when expanding this topology to whole-brain coverage.
Mapping BOLD Dynamics and Autonomic Telemetry
Isolating brain activity without monitoring autonomic response leads to incomplete models. A core strength of this system is its simultaneous ingestion of EEG band-power percentages, respiratory frequency, accelerometer data, and heart rate.
When processing stimulus inputs, the underlying engine computes a six-dimensional emotional vector across joy, curiosity, calm, excitement, anxiety, and affection. In session J003, exposure to an unfamiliar street dog elevates heart rate to 126 bpm while amygdala BOLD readings remain elevated at 0.35 / 0.41. The model maps this pattern directly to anxiety with an arousal index of 0.783.
Contrary to common belief, you do not need complex deep neural networks to extract reliable state vectors from low-N neuroimaging studies. Practitioners often default to multi-layer perceptrons, which quickly overfit on small session sample sizes. A linear mapping centered around zero-mean session averages provides superior stability while preserving complete signal interpretability.
This balance between autonomic signals and BOLD readings forms the backbone of state predictions. Here is where it gets interesting when comparing social conditions.
Comparing Social Stimuli Across Axial fMRI Slices
The repository links numerical logs to visual ground-truth data using three T2*-weighted EPI axial slices. Scan acquisitions used a repetition time (TR) of 2000 ms, an echo time (TE) of 30 ms, a 2.0 mm slice thickness, and an in-plane resolution of approximately 1.2 × 1.2 mm.
Each social stimulus triggers distinct regional BOLD emphasis and autonomic variance. The table below outlines how specific conspecific visual and olfactory stimuli shift physiological parameters across recording runs:
| Stimulus Condition | Heart Rate (bpm) | Primary BOLD Focal Region | Dominant Emotional Vector | System Arousal Index |
|---|---|---|---|---|
| Random Street Dog (Novel) | 124 bpm | Bilateral Amygdala + Olfactory | Anxiety | 0.783 |
| Best Friend Dog (Familiar) | 112 bpm | Mid-Brain / Thalamus / Temporal | Affection | 0.412 |
| Neighbor Dog (Repeated) | 98 bpm | Bilateral Temporal Lobe | Calm | 0.215 |
As the subject experiences repeated exposure to a neighbor dog, autonomic load drops significantly. Heart rate decreases from 121 bpm in initial exposure (J005) down to 98 bpm in later sessions (J006), accompanying a clear shift from generalized arousal to temporal-lobe mediated social recognition.
This shift highlights how repeated stimulus presentation dampens limbic drive. Next, let's look at how the code models this relaxation in real time.
Implementing Neural Decay and Region Boost Dynamics
Brain regions do not remain perpetually elevated after a stimulus event. The simulation updates activation states using an exponential relaxation function that pulls region values back toward anatomical baseline levels.
In neural_core.py, the decay mechanics run on a fixed rate equation. Every timestep multiplies current region activation by a constant factor:
$$\text{Activation}_{t+1} = \text{Activation}_t \times \text{DECAY_RATE}$$
Where DECAY_RATE is configured precisely to 0.927. When a new session event occurs, BOLD values are scaled by stimulus intensity and injected into the target nodes before social offsets apply.
# Mathematical update cycle in python
def update_brain_state(regions, bold_injection, decay=0.927):
for region in regions:
# Exponential relaxation toward baseline
regions[region] *= decay
# Add scaled BOLD inputs
for region, bold_val in bold_injection.items():
regions[region] += bold_val
return regions
Without this relaxation step, subsequent stimuli cause artificial runaway activation across the 25-region map. Maintaining this exponential decay keeps state transitions physically realistic over long time horizons.
This next part trips people up every time when working with raw multi-modal telemetry.
Overcoming Edge Cases in Multi-Modal Telemetry Data
Working with combined physiological and neuroimaging datasets exposes specific edge cases that off-the-shelf pipelines rarely address. The primary failure mode in canine brain simulation is autonomic decoupling caused by physical movement.
During session runs, head shifts or panting introduce high-frequency accelerometer noise. If your algorithm scales amygdala arousal directly off heart rate spikes without cross-referencing movement channels, a simple adjustment in position registers as a spike in fear or anxiety.
To resolve this in your own building a canine fMRI simulation python implementation:
- Filter raw cardiac telemetry against movement vectors from the physical accelerometer prior to linear emotion mapping.
- Apply a strict BOLD confidence mask—rejecting sessions where confidence metrics fall below
0.65(such asJ003's0.61threshold for noisy trials). - Zero-center your emotional regression weights against resting baseline sessions before calculating secondary region boosts.
By gating autonomic input with physical movement telemetry, you isolate true neural arousal from mechanical artifact.
Frequently Asked Questions
How to model fMRI data in python for animal studies?
To model fMRI data in Python, load BOLD voxel arrays using libraries like NiBabel or standard dataclasses. Map regional z-scores to structural nodes, apply exponential decay functions (e.g., 0.927) for signal relaxation, and run linear regression against observed behavioral state markers.
What is a functional MRI digital twin?
A functional MRI digital twin is a computational model that replicates the dynamic neural states of a specific subject. It ingests historical fMRI BOLD signals, EEG, and telemetry to predict brain region activations and behavioral state vectors in response to new inputs.
How does jackie-fmri-sim calculate emotional vectors?
The jackie-fmri-sim engine uses a six-element vector (joy, curiosity, calm, excitement, anxiety, affection). It converts incoming BOLD readings and heart rate inputs into state values via a linear regression matrix centered on mean scan values across six annotated sessions.
What slice thickness is typical for canine fMRI runs?
Canine fMRI acquisitions typically use 2.0 mm slice thickness with a high gradient-echo T2*-weighted EPI sequence (TR = 2000 ms, TE = 30 ms) to resolve small anatomical structures like the olfactory bulb and amygdala.
Next Steps for Neuroimaging Developers
Building an accurate canine brain digital twin requires balancing real empirical scan metrics with clean mathematical decay rules. By linking BOLD signal shifts from olfactory and limbic centers to continuous physiological telemetry, you can construct lightweight simulations that reflect true neurobiological dynamics.
If you are working on computational neuroimaging tools, clone the open-source repository this week and run the interactive commands to inspect the state vector updates directly. Check out our detailed breakdown on building neuroimaging pipelines in Python and explore our step-by-step guide on analyzing BOLD signal regression models to take your scientific modeling further.