예제 #1
0
        public static void Save(StreamWriter writer, IHeaderFileContentVer1 content)
        {
            List <Coordinates>?channelCoordinates = content.GetChannelCoordinates();

            if (channelCoordinates != null)
            {
                writer.WriteLine();
                writer.WriteLine(IniFormat.FormatSectionName(Definitions.GetSectionName(Definitions.Section.Coordinates) !));
                FileSaverCommon.WriteCommentBlock(writer, content.InlinedComments.BelowCoordinatesInfosSection);

                for (int ch = 0; ch < channelCoordinates.Count; ++ch)
                {
                    Coordinates coordinates = channelCoordinates[ch];

                    string keyName  = Invariant($"{Definitions.KeyChPlaceholder}{ch + 1}");
                    string keyValue = Invariant($"{coordinates.Radius},{coordinates.Theta},{coordinates.Phi}");

                    string line = IniFormat.FormatKeyValueLine(keyName, keyValue);
                    writer.WriteLine(line);
                }
            }
        }
예제 #2
0
        public static EegElectrodeCollection?Collect(BrainVisionPackage filesContent)
        {
            IHeaderFileContentVer1 headerContent    = filesContent.HeaderFileContent;
            List <Coordinates>?    inputCoordinates = headerContent.GetChannelCoordinates();

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

            List <ChannelInfo>?inputChannels = headerContent.GetChannelInfos();
            int inputChannelsCount           = inputChannels == null ? 0 : inputChannels.Count;

            EegElectrodeCollection eegElectrodes = new EegElectrodeCollection();

            for (int channelNumber = 0; channelNumber < inputCoordinates.Count; ++channelNumber)
            {
                Coordinates coordinates = inputCoordinates[channelNumber];

                (double cartesianX, double cartesianY, double cartesianZ) = SphericalToCartesian(coordinates);

                EegElectrode eegElectrode = new EegElectrode(
                    //REQUIRED
                    name: channelNumber < inputChannelsCount ? inputChannels ![channelNumber].Name : string.Empty,