public static DatasetDescription Collect(CustomizationInfo info)
        {
            DatasetDescription description = new DatasetDescription(
                // REQUIRED
                name: info.DatasetName)
                                             //BIDSVersion, // set internally in constructor
            {
                // RECOMMENDED
                License = info.License,
                // OPTIONAL
                Authors = info.Authors,
            };

            return(description);
        }
Exemple #2
0
        public void ConvertBrainVisionFilesToBidsFormatFiles()
        {
            DatasetDescription datasetDescription = DatasetDescriptionConverter.Collect(_info);
            string             changesFileContent = ChangesConverter.Collect();
            string             readmeFileContent  = string.Empty;

            string                 actualTaskName      = _bidsPackage.Task; // may be auto-generated, in this case will differ from info.TaskName
            EegSidecar             eegSidecar          = EegSidecarConverter.Collect(_bvPackage, _info, actualTaskName);
            EegChannelCollection?  eegChannels         = EegChannelsConverter.Collect(_bvPackage);
            EegElectrodeCollection?eegElectrodes       = EegElectrodesConverter.Collect(_bvPackage);
            EegCoordinateSystem?   eegCoordinateSystem = eegElectrodes == null ? null : EegCoordinateSystemConverter.Collect(); // if electrodes not present, no sense to create coordinates
            TaskEventCollection?   taskEvents          = TaskEventsConverter.Collect(_bvPackage);

            SaveBidsAgnosticFiles(_bidsPackage.RootFolder,
                                  datasetDescription, changesFileContent, readmeFileContent);

            SaveBidsEegModalityFiles(_bidsPackage.RootFolder.SubjectFolder.SessionFolder.EegModalityFolder,
                                     eegSidecar, eegChannels, eegElectrodes, eegCoordinateSystem, taskEvents);
        }
Exemple #3
0
        private void SaveBidsAgnosticFiles(IRootFolder rootFolder, DatasetDescription datasetDescription, string changesFileContent, string readmeFileContent)
        {
            if (datasetDescription != null)
            {
                if (File.Exists(rootFolder.DatasetDescriptionFilePath))
                {
                    Warnings.Add($"{WarningFileSkipped}{rootFolder.DatasetDescriptionFilePath}");
                }
                else
                {
                    rootFolder.SaveDatasetDescriptionFile(datasetDescription);
                }
            }

            if (changesFileContent != null)
            {
                if (File.Exists(rootFolder.ChangesFilePath))
                {
                    Warnings.Add($"{WarningFileSkipped}{rootFolder.ChangesFilePath}");
                }
                else
                {
                    rootFolder.SaveChangesFile(changesFileContent);
                }
            }

            if (readmeFileContent != null)
            {
                if (File.Exists(rootFolder.ReadmeFilePath))
                {
                    Warnings.Add($"{WarningFileSkipped}{rootFolder.ReadmeFilePath}");
                }
                else
                {
                    rootFolder.SaveReadmeFile(readmeFileContent);
                }
            }
        }
Exemple #4
0
 public static void SaveDatasetDescriptionFile(string filePath, DatasetDescription datasetDescription)
 {
     Directory.CreateDirectory(Path.GetDirectoryName(filePath));
     DatasetDescriptionWriter.Save(filePath, datasetDescription);
 }
Exemple #5
0
 public void SaveDatasetDescriptionFile(DatasetDescription datasetDescription)
 => SaveDatasetDescriptionFile(DatasetDescriptionFilePath, datasetDescription);
Exemple #6
0
 public static void Save(string filePath, DatasetDescription datasetDescription)
 => JsonWriter.Save(filePath, datasetDescription);