Skip to main content

To convert snirf file to bids format.

Project description

snirf2bids pysnirf2

Table of Contents

snirf2BIDS

Conveniently generate BIDS structure from .snirf files.
Developed by BU BME Senior Design Group 3 (2022): Christian Arthur, Jeonghoon Choi, Jiazhen Liu, Juncheng Zhang.
Will be maintained by Boston University Neurophotonics Center(BUNPC).
snirf2BIDS requires Python >3 and h5py >3.6.

Features

Create BIDS Compliant Structures

Export(self, outputFormat: str = 'Folder', fpath: str = None) creates the BIDS compliant metadata files based on information stored in the Subject class object. It has outputFormat as Folder or Text. Folder: Assemble output (metadata file) to a specific file directory specified by the user. Text: Assmble output (metadata file) as a string in JSON-like format.

        if outputFormat == 'Folder':
            self.coordsystem.save_to_json(self.subinfo, fpath)
            self.optodes.save_to_tsv(self.subinfo, fpath)
            self.optodes.export_sidecar(self.subinfo, fpath)
            self.channel.save_to_tsv(self.subinfo, fpath)
            self.channel.export_sidecar(self.subinfo, fpath)
            self.sidecar.save_to_json(self.subinfo, fpath)
            self.events.save_to_tsv(self.subinfo, fpath)
            self.events.export_sidecar(self.subinfo, fpath)
            return 0
        else:
            subj = {}
            if self.subinfo['ses-'] is None:
                subj = {'name': 'sub-' + self.get_subj(), 'filenames': self.pull_fnames(), 'sessions': self.get_ses()}

            out = json.dumps(subj)
            if fpath is None:
                return out
            else: 
                open(fpath + '/snirf.json', 'w').write(out)
                return 0

Code Generation

The fields and descriptions in JSON files are generated based on the latest Brain Imaging Data Structure v1.7.1-dev and SNIRF specification.

Maintainers

@Christian Arthur :melon:
@Juncheng Zhang :tangerine:
@Jeonghoon Choi :pineapple:
@Jiazhen Liu :grapes:

Contributors

This project exsists thanks to all people who contribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snirf2bids-0.1.19.tar.gz (7.7 MB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page