예제 #1
0
        public static EegChannelCollection?Collect(BrainVisionPackage filesContent)
        {
            IHeaderFileContentVer1 headerContent = filesContent.HeaderFileContent;
            List <ChannelInfo>?    inputChannels = headerContent.GetChannelInfos();

            if (inputChannels == null)
            {
                return(null);
            }

            double samplingFrequency = Common.GetSamplingFrequencyFromSamplingInterval(headerContent.SamplingInterval !.Value);

            EegChannelCollection eegChannels = new EegChannelCollection();

            foreach (ChannelInfo inputChannel in inputChannels)
            {
                PrefixedUnit?channelUnits = Common.ConvertTextToPrefixedUnit(inputChannel.Unit);
                if (channelUnits == null)
                {
                    throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, Resources.UrecognizedUnitExceptionMessage, inputChannel.Unit, inputChannel.Name));
                }

                EegChannel eegChannel = new EegChannel(
                    //REQUIRED
                    name: inputChannel.Name,
                    type: ChannelType.EEG,
                    units: channelUnits.Value)
                {
                    //OPTIONAL
                    SamplingFrequency = samplingFrequency,
                    //Reference = null,
                    //LowCutoff = null,
                    //HighCutoff = null,
                    //Notch = null,
                };

                eegChannels.Add(eegChannel);
            }

            return(eegChannels);
        }
예제 #2
0
 public static void SaveEegChannelsFile(string filePath, EegChannelCollection channels)
 {
     Directory.CreateDirectory(Path.GetDirectoryName(filePath));
     EegChannelsWriter.Save(filePath, channels);
 }
예제 #3
0
 public void SaveEegChannelsFile(EegChannelCollection channels)
 => SaveEegChannelsFile(EegChannelsFilePath, channels);
예제 #4
0
 public static void SaveEegChannelsFile(string filePath, EegChannelCollection channels)
 => EegModalityFolder.SaveEegChannelsFile(filePath, channels);
예제 #5
0
        public static void Save(string filePath, EegChannelCollection channels)
        {
            List <EegChannelTsv> list = channels.ConvertAll(p => new EegChannelTsv(p));

            TsvTableWriter <EegChannelTsv> .Save(filePath, EegChannelTsv.TsvIdentifiers, list);
        }