Los Alamos National LaboratorySearch for people in the Lab's directorySearch the Laboratory's Web site

 


The NETMEG File Format for MEG and EEG Data

The netMEG file format is designed to be a standard format for MEG and EEG data collected by any sensor system.  It contains the signal data, as well as information about sensor location and configuration and archival information. NetMEG files use the netCDF file format standard which has a number of advantages.  NetCDF files are self describing, making it convenient  to support variability in the type of data that is stored and to extend the netMEG format as needed, without making older files obsolete.  NetCDF supports non-sequential reading of the data, so that just the data that is needed can be read. NetCDF files are portable, and can be read, without translation, on most computers.  We have written routines in C, Fortran, MATLAB and IDL to read netMEG files in order to facilitate reading the data into analysis routines. In addition, as part of MEGAN, we have implemented a GUI which allows the user to view the contents of a netMEG file directly. NetMEG files are typically used to store epochs of data which have had signal processing done, and are ready for analysis.  However, the format is flexible enough, that it could be used to store raw, continuous data.

   NetCDF files store data as arrays. In addition to the arrays, the files store information about the sizes of the arrays, as named dimensions, and also store descriptive information as attributes.  In the following sections we describe the arrays, dimensions and attributes that make up a netMEG file.  Note that the netMEG file was originally intended for storage of averaged, evoked response MEG data.  It has been extended to handle other MEG and EEG data, but some of the variable names reflect  its original use.

Global Attributes


Comments
     Comments input by the user, plus notes that may have been added by the code which made the netMEG file.
 

BaselineCorrection_(DC_Offset) [Obsolete: BaselineCorrection or BaselineCorrection (DC Offset)]
    The method used for doing a baseline correction of the data, to compensate for a DC shift. Methods currently used are: "Prestim", "None", "All Values", "User Selected Interval"

Baseline_Interval_for_Variance_Calc [Obsolete: BaselineCorrection or BaselineCorrection (DC Offset)]
    The method used for selecting the data used to calculate the baseline variance.
 

AveragingMethod
       For averaged data, the method used to average the data, if known. For example, "Neuromag Averaging", or if the data was averaged by MEGAN, information about methods used to reject passes containing artifacts.
 

FilesAveraged
       For averaged data, the names of files that were averaged together, if known.

Data_Acquisition_Sampling_Interval_(ms) [Obsolete: Data Acquisition Sampling Interval (ms)]
       This will differ from the SamplingInterval if the data in the netMEG file was downsampled.

DateOfDataAcquisition
       The date on which the data was acquired, if known.  The format of this string will vary, because it is read from the input files.
 

MontageName
       The name of the sensor system used. For example, "Neuromag", "LANL/BTi 7-sensor array", VA/Bti 37 Sensor." MEGAN looks for the "Neuromag" pattern in the MontageName so that it can offer the specialized Neuromag options.
 

SiteName
       Name of the location of the Sensor System, if known.

netCDFfileType
       Indicates the type of data stored: e.g. "AveragedData", "unaveragedSpontaneousData"
 

netCDFfileVersion
       This is a string version of the netMEG file version number.  It should be the same value as the numerical variable netMEGversionNum.
 

filtersUsed
       A string with information about the digital filters, and artifact rejection that were applied to the data, if known. Filters applied by MEGAN are always listed, but if MEGAN is reading previously filtered data, the information may not be available.
 

BadChannelsDeleted
       This is a list of the channels which were deleted from the data (netMEG version 1.1) or are marked as having a bad status in later netMEG versions.
 

SourceFileName
       The name of the main file from which the data was read.
 

date_of_netMEG_file_creation [Obsolete: date of netMEG file creation]
       The date on which this netMEG file was created.
 

hardware_filter_info [Obsolete: hardware filter info]
       A string with information about hardware filters that were used, if available.
 

hardware_artifact_rejection_info [Obsolete: hardware artifact rejection info]
       A string with information about hardware artifact rejection, if available.
 

Randomization_Range_for_ISI [Obsolete: Randomization Range for ISI]
       For evoked response data, the range of the randomized inter-stimulus interval.
 
 

Dimensions

These dimensions define the sizes of the arrays described under "Variables"

numDataPts
       The maximum number of samples in an epoch of data

NumberOfDatasets
       Obsolete.

numBaselinePts
       The maximum number of samples in the baseline data (optional)

numChannels
       The number of channels of data of all types

numSensors
        The number of MEG sensors

numEEGsensors
        The number of EEG sensors for which we have sensor location information

maxSensElements
        The maximum number of loops the MEG sensors contain

numStims
       The  number of stimulus conditions  for averaged evoked response data or the number of epochs of unaveraged data.

coords
         The three Cartesian coordinates, X, Y, Z.

LengthOfLabelString
         The maximum length of string data in arrays

numHeadShapePts
        The number of digitized locations on the subject's head that were recorded.

largeXformSize
        For Neuromag planar gradiometer data only:  the size of the large transform matrix used to convert the data to simulated magnetometer values.

smallXformSize
      For Neuromag planar gradiometer data only: the size of the small transform matrix used to convert the data to simulated magnetometer values.

NumberOfNonReferenceMEGChannels
The number of helmet MEG Channels (as opposed to reference MEG channels, used to collect noise)

MaximumNumberReferenceMEGChannelsUsed
Reference MEG Channels (type MEG_REF) are used for the CTF noise cancellation method. This dimension is used for the variables that contain the coefficients used to weight the reference channel data, and the corresponding channel index of the reference channel.

numHeadLocationCoilPts
Number of head localization coils, in SIS system
 

Variables

General Variables

Waveforms(numStims, numDataPts, numChannels) float
        This is the signal  for all epochs, from all channels whose data was saved.  The channels are described in the chanToSensorMap, ChannelStatus, ChannelTypes and ChannelUnits variables.  The number of samples actually stored for each epoch may vary: numDataPts is the maximum number of samples stored for an epoch, while numSamples indicates how many samples were stored for each epoch. The global attribute netCDFfileType indicates whether the stored signal is averaged or unaveraged.

BaselineVariance(numStims, numSensors) ; (float)
    The baseline variance for each channel and epoch pair is the square of the standard deviation of the baseline data for that channel and epoch.  Baseline data is either the pre-stimulus period (for evoked response data) or a window of data chosen for each epoch of spontaneous data (BaselineData).  If there is no baseline data, this variable is set to a default value input by the user.

chanToSensorMap(numChannels, LengthOfLabelString) ; (char)
        This is the name of each channel.  The ordering here corresponds to the order of the channel data in the Waveforms variable, and in other variables that contain the "numChannels" dimension.

ChannelSignalProcSets(numChannels); (short)
       Different signal processing options may be applied to groups of channels. This variable contains the number of the signal processing option set that was used for each channel. The actual options in each set are listed in the Global Attributes: filtersUsed, and AveragingMethod.

ChannelStatus(numChannels) ; (short)
        This variable is used to designate which channels will be used in calculations and visualizations. Good channels have a status of 1, while channels which the user has marked as containing bad data have a status of 0.  This variable was introduced in netMEG version 1.2.  Version 1.1 files have the data from bad channels deleted.  NetMEG files with more recent version numbers which were made from version 1.1 files will have the missing data filled with zeros, and a bad status for the missing channels.

ChannelTypes(numChannels, LengthOfLabelString) ; (char)
        ChannelTypes indicates what kind of data each channel contains. MEGAN, and the code to read data for the source localization codes look for "MEG," "MEG_REF," and "EEG" and "EEG_REF" types. Other types often used are "BGD," "STIM," "STI," "EOG," "ECG." MEG_REF refers to reference channels used for noise cancellation in systems like CTFs. These reference channels must be modeled in the forward. BGD refers to data collected by sensors that do not pick up any signal from the brain, (SIS system), and therefore do not need to be modeled in the forward calculation.

ChannelUnits(numChannels, LengthOfLabelString) ; (char)
        These strings indicate the units of the data in the Waveforms array. It is assumed that MEG data will be stored as fT, and EEG data as microVolts.

NumElementsInSensor(numSensors) ; (short)
        This variable indicates the number of loops in each MEG sensor, allowing for a sensor system with more than one type of MEG sensors.

SensorLocation(numSensors, coords) ; (float)
        The meaning of the Sensor Location, which is always in patient coordinates, depends on the type of MEG sensor. For radial gradiometers, it is the location of the loop closest to the head. For magnetometers, it is the location of the magnetometer.  For the Neuromag planar gradiometers, it is the midpoint between the two loops. The units are cm.

SensorElementsLoc(numSensors, maxSensElements, coords) ; (float)
        This contains the location of each loop in the MEG sensors, in patient coordinates. (cm)

SensorElementsOrient(numSensors, maxSensElements, coords) ; (float)
        This is the orientation of each loop of the MEG sensors, in patient coordinates.

SensorElementRadius(numSensors, maxSensElements) ; (float)
        The radius of each loop of the MEG sensors, in cm.

CoilWeight(numSensors, maxSensElements) ; (short)
        The weight to assign to each loop in the MEG sensors when calculating the forward problem.

SensorGain(numSensors) ; (float)
        This is the MEG sensor sensitivity.  It is here for archival purposes only.  The gain has already been applied to data in the Waveforms array.

EEGpickupLocation(numEEGsensors, coords) ; (float)
        The location of each EEG pickup sensor, in patient coordinates. Note that unlike the MEG sensor units, these locations are in meters.

EEGreferenceLocation(numEEGsensors, coords) ; (float)
        The location of the EEG reference sensor corresponding to each pickup sensor, in patient coordinates. Note that unlike the MEG sensor units, these locations are in meters.

EEGpickupRadius(numEEGsensors) ; (float)
        The radius of each pickup EEG sensor, in mm.

EEGreferenceRadius(numEEGsensors) ; (float)
        The radius of each reference EEG sensor, in mm.

EEGBaselineVariance(numStims, numEEGsensors); (float)
        The baseline variance for each EEG channel and epoch pair is the square of the standard deviation of the baseline data for that channel and epoch. Baseline data is either the pre-stimulus period (for evoked response data) or a window of data chosen for each epoch of spontaneous data (BaselineData). If there is no baseline data, this variable is set to a default value input by the user.

numSamples(numStims) ; (float)
        The number of samples actually stored for each epoch or stimulus condition.

SamplingInterval ; (float)
        The elapsed time in ms between each sample in the Waveforms array.

PatientCoords(coords, coords) ; (float)
        The locations of the three fiducials (the three locations on the patient's head that are measured for use in reconciling the coordinate systems of different imaging modalities), in meters. These are in the coordinate system used by LANL and BTi:  positive X  is in the front half of the head, positive Y is on the patient's left side, positive Z is through the top of the head.  If the data acquisition system uses a different coordinate system, the locations are rotated into this system.

PatientCoordMethod(coords, LengthOfLabelString) ; (char)
        The name of the location of each fiducial, e.g. "Periauricular","Nasion" "Periauricular".

CoilToPatientXform(coords, coords) ; (float)
        This is the 3X3 transform matrix used to rotate the MEG sensor locations from device coordinates to patient coordinates. These values have not been shifted or rotated. (In version 1.4 netMEG files, the Neuromag transforms were inadvertently stored as the transpose of the transform. The IDL code that reads the netMEG files corrects for this error when it reads version 1.4 files.)

CoilToPatientXformOrig(coords) ; (float)
        The vector used to shift the MEG sensor locations from device coordinates to patient coordinates.

headShapeData(numHeadShapePts, coords) ; (float)
        The locations of points on the head, other than the PatientCoords, in meters, and using the LANL coordinate system. This is an optional variable.

netMEGversionNum  (float)
        The version number of the netMEG file. This is changed when changes are made to the netMEG file format.

Variables for Averaged  Evoked Response Data

LengthOfPrestim(numStims) ; (float)
        For evoked response data, the length of the prestimulus period, in ms, that is stored in the Waveforms array.

StimDuration(numStims, LengthOfLabelString) ; (char)
        For evoked response data, the duration of the stimulus presentation in ms.  This is a character string, to allow for values such as "N/A" or "unknown."  It is used for archival purposes only.

StimNames(numStims, LengthOfLabelString) ; (char)
        A label for each stimulus condition or epoch. For unaveraged data, the name is based on the time window, or starting time of the selected data.

NumPassesUsed(numStims) (short)
      For averaged data, this is the number of epochs that were averaged together for each averaged epoch.  This may vary because of the number of times each stimulus condition was presented, or because some epochs were rejected because of artifacts.  These values are available if MEGAN averaged the data, or in the case that we are reading data averaged by the data acquisition system, if the values exist in the input files.

NumStimPresentations(numStims) (short)
      For averaged, evoked response data, this is the number of times each stimulus condition was presented to the subject. This will not match
NumPassesUsed if some epochs were rejected because of artifacts.

Variables for Spontaneous Data

BaselineData(numStims, numBaselinePts, numChannels) ;(float)
      For spontaneous data, the user selects a window of baseline data to pair with each epoch, to use to calculate the baseline variance, and to perform a baseline shift. The units correspond to the units in the Waveforms array.

numBaselineSamples(numStims) ; (float)
      For spontaneous data, the number of points in each window of baseline data.

epochOffsets(numStims) ; (float)
      For unaveraged data, the time in ms after the start of data acquisition at which the first sample of each epoch was taken.

Variables for Neuromag Sensor System Data

largeXform(numSensors, largeXformSize) ; (float)
        In order to make contour plots, we  simulate magnetometer data as a way to combine the two values that the Neuromag System measures at each location.  This  transform matrix  is used to calculate a minimum norm solution for  magnetometer values at  largeXformSize locations.

smallXform(numSensors, smallXformSize) ; (float)
         This transform matrix is similiar to the largeXform matrix, except that it is used to solve for values at  the 61 Neuromag sensor locations.

Variables for CTF Sensor System Data

NoiseBalancedState; scalar, short
A value of 0 means no noise cancelling has been done. A value of 3 means that the data is in CTF's 3rd Gradient state.

NumNoiseCoefsPerChannel(NumberOfNonReferenceMEGChannels); short
For each non-reference MEG channel, the number of Reference Channel, noise coefficient pairs we have.

NoiseCancellingCoefficients(NumberOfNonReferenceMEGChannels, MaximumNumberReferenceMEGChannelsUsed); double
For each non-reference MEG channel, the list of coefficients used to weight the Reference Channel signal. MEGAN saves the 3rd Gradient Real coefficients.

ReferenceChannelIndicesForCoefficients(NumberOfNonReferenceMEGChannels, MaximumNumberReferenceMEGChannelsUsed); short
For each non-reference MEG channel, the indices of the Reference Channels corresponding to each coefficient.

Variables for SIS Sensor System Data

headLocationCoilData(3,numHeadLocationCoilPts) ; float
The locations, in LANL subject coordinates, of the coils that are activated to determine the location of the head relative to the sensor system.

SISsensorBaseline(numSensors) ;
The distance of each SIS sensor from the superconducting surface.

Variables for  BTi Sensor System Data

probeXmitterRelation
    The probe-transmitter relation  used to record the location of the patient's head relative to the  MEG sensors.

directCosXmitter
    The direction cosine of the transmitter used in taking PPI measurements for recording the location of the patient's head relative to the MEG sensors.

 

 
Contacts
Doug Ranken


  Operated by the University of California for the National Nuclear Security Administration, of the US Department of Energy.    
Copyright © 2002 UC
| Disclaimer/Privacy
  

physics-webteam@lanl.gov
Last Modified: July 5, 2005