| Title: | Medtronic Brain Sense Local Field Potencial Analysis |
|---|---|
| Description: | Extracts and creates an analysis pipeline for the JSON data files from Brain Sense sessions using Medtronic's Deep Brain Stimulation surgery electrode implants. |
| Authors: | Paulo Bastos [aut, cre], Raquel Barbosa [aut] |
| Maintainer: | Paulo Bastos <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.2.0 |
| Built: | 2026-05-26 10:04:52 UTC |
| Source: | https://github.com/cran/LeadSense |
This function generates spectrograms for Medtronic BrainSense time-domain signals across one or more data passes. Optionally, the user can select specific passes to plot, filter by frequency band, save the plots, and extract the underlying spectrogram data.
brain_sense_spectrogram( dataset = NULL, wl = 512, ovlp = 75, collevels = seq(-80, 0, by = 0.2), save_as = NULL, output_dir = getwd(), passes = NULL, band = NULL )brain_sense_spectrogram( dataset = NULL, wl = 512, ovlp = 75, collevels = seq(-80, 0, by = 0.2), save_as = NULL, output_dir = getwd(), passes = NULL, band = NULL )
dataset |
A JSON-like object (e.g., parsed with |
wl |
Integer. Window length for FFT. Default is 512. |
ovlp |
Numeric. Overlap percentage between successive windows. Default is 75. |
collevels |
Numeric. A sequence of color levels for the spectrogram image (in dB). Default is |
save_as |
Character. File format to save plots ("png", "pdf", or "jpeg"). If NULL (default), plots are not saved. |
output_dir |
Character. Path to the directory where plots will be saved. Default is current working directory. |
passes |
Integer vector. Indices of passes to plot (e.g., |
band |
Character. One of "Delta", "Theta", "Alpha", "Beta", "Gamma". If provided, filters signal to this frequency band before generating the spectrogram. |
WARNING: This function may be computationally intensive and take significant time to execute. Please wait until all plots are rendered.
A list of data frames (invisible). Each data frame corresponds to one spectrogram and contains:
Time in seconds
Frequency in Hz
Spectral power in dB
Channel label
Pass index (i)
brain_sense_spectrogram(dataset, passes = c(2), band = "Beta")brain_sense_spectrogram(dataset, passes = c(2), band = "Beta")
JSON list sample session file
datasetdataset
A Large list obtained using jsonlite::JSON("myJSON_sessionFile.json")
AbnormalEnd name
FullyReadForSession
FeatureInformationCode
SessionDate
SessionEndDate
ProgrammerTimezone
ProgrammerUtcOffset
ProgrammerLocale
ProgrammerVersion
PatientInformation
DeviceInformation
BatteryInformation
GroupUsagePercentage
LeadConfiguration
Stimulation
Groups
BatteryReminder
MostRecentInSessionSignalCheck
Impedance
GroupHistory
SenseChannelTests
CalibrationTests
LfpMontageTimeDomain
BrainSenseTimeDomain
BrainSenseLfp
LFPMontage
DiagnosticData
In-house created
data(dataset) # Lazy loading (!)data(dataset) # Lazy loading (!)
This function extracts impedance data from a JSON-like dataset and computes summary statistics.
impedance_summary(dataset = NULL)impedance_summary(dataset = NULL)
dataset |
A JSON object/list loaded into the work environment. If NULL, attempts to load the default dataset from the LeadSense package. |
A list containing:
combined_impedance_df - The full impedance dataset (if available).
impedance_summary - Summary of mean impedance values by Hemisphere and Type.
If no valid impedance data is found, a message is printed instead.
impedance_results <- impedance_summary(dataset) print(impedance_results$impedance_summary) print(impedance_results$combined_impedance_df)impedance_results <- impedance_summary(dataset) print(impedance_results$impedance_summary) print(impedance_results$combined_impedance_df)
This function extracts and summarizes LFP (Local Field Potential) data from a JSON-like dataset.
lfp_data(dataset = NULL)lfp_data(dataset = NULL)
dataset |
A JSON object/list loaded into the work environment. If NULL, attempts to load the default dataset from the LeadSense package. |
A structured LFP dataset including:
Power in each frequency band
LFP Frequency vs Magnitude for each electrode
Time-domain signals for all sequences in the LFP montage
lfp_dataset <- lfp_data(dataset) print(lfp_dataset$band_power_results) print(lfp_dataset$structured_lfp_dataset)lfp_dataset <- lfp_data(dataset) print(lfp_dataset$band_power_results) print(lfp_dataset$structured_lfp_dataset)
Extract basic session summary information in long format
summary_long(dataset = NULL)summary_long(dataset = NULL)
dataset |
A JSON object/list loaded into the work environment |
Long format table with summary session information
summary_long()summary_long()