diff --git a/+bids/+internal/list_all_trial_types.m b/+bids/+internal/list_all_trial_types.m index cfba2bd5..92434e58 100644 --- a/+bids/+internal/list_all_trial_types.m +++ b/+bids/+internal/list_all_trial_types.m @@ -111,4 +111,10 @@ trial_type_list{idx} = []; end + % n/a not included as trial type + idx = ismember(trial_type_list, 'n/a'); + if any(idx) + trial_type_list(idx) = []; + end + end diff --git a/+bids/Model.m b/+bids/Model.m index a50619dd..c206c9c6 100644 --- a/+bids/Model.m +++ b/+bids/Model.m @@ -926,6 +926,45 @@ function write(obj, filename) end + function validate_constrasts(obj, node) + + if ~isfield(node, 'Contrasts') + return + end + + for iCon = 1:numel(node.Contrasts) + + if ~isfield(node.Contrasts{iCon}, 'Weights') + msg = sprintf('No weights specified for Contrast %s of Node %s', ... + node.Contrasts{iCon}.Name, node.Name); + bids.internal.error_handling(mfilename(), ... + 'weightsRequired', ... + msg, ... + obj.tolerant, ... + obj.verbose); + end + + switch node.Contrasts{iCon}.Test + case 't' + nb_weights = numel(node.Contrasts{iCon}.Weights); + case 'F' + nb_weights = size(node.Contrasts{iCon}.Weights, 2); + end + + if nb_weights ~= numel(node.Contrasts{iCon}.ConditionList) + msg = sprintf('Number of Weights and Conditions unequal for Contrast %s of Node %s', ... + node.Contrasts{iCon}.Name, node.Name); + bids.internal.error_handling(mfilename(), ... + 'numelWeightsConditionMismatch', ... + msg, ... + obj.tolerant, ... + obj.verbose); + end + + end + + end + end methods (Static) @@ -996,39 +1035,6 @@ function write(obj, filename) end end - % could be made static - function validate_constrasts(node) - - if ~isfield(node, 'Contrasts') - return - end - - for iCon = 1:numel(node.Contrasts) - - if ~isfield(node.Contrasts{iCon}, 'Weights') - msg = sprintf('No weights specified for Contrast %s of Node %s', ... - node.Contrasts{iCon}.Name, node.Name); - bids.internal.error_handling(mfilename(), ... - 'weightsRequired', ... - msg, ... - obj.tolerant, ... - obj.verbose); - end - - if numel(node.Contrasts{iCon}.Weights) ~= numel(node.Contrasts{iCon}.ConditionList) - msg = sprintf('Number of Weights and Conditions unequal for Contrast %s of Node %s', ... - node.Contrasts{iCon}.Name, node.Name); - bids.internal.error_handling(mfilename(), ... - 'numelWeightsConditionMismatch', ... - msg, ... - obj.tolerant, ... - obj.verbose); - end - - end - - end - end methods (Access = protected) diff --git a/+bids/layout.m b/+bids/layout.m index ff1e54df..cc2a1465 100644 --- a/+bids/layout.m +++ b/+bids/layout.m @@ -239,7 +239,7 @@ function handle_invalid_input(ME, root) bids.internal.is_octave if ischar(root) msg = sprintf(['First input argument must be an existing directory.'... - '\nGot: ''%s.'''], root); + '\nGot: "%s".'], root); bids.internal.error_handling(mfilename(), 'InvalidInput', ... msg, false); end @@ -395,6 +395,12 @@ function handle_invalid_input(ME, root) % so the parsing is unconstrained for iModality = 1:numel(modalities) + % when we go schemaless session level folder + % may get indexed as modality + if bids.internal.starts_with(modalities{iModality}, 'ses-') + continue + end + if isfield(filter, 'modality') && ... ~ismember(modalities{iModality}, filter.modality) continue @@ -836,6 +842,9 @@ function handle_invalid_input(ME, root) % other is present to help with analysis. intended = {}; if isfield(metadata, 'IntendedFor') + if isempty(metadata.IntendedFor) + continue + end intended = cellstr(metadata.IntendedFor); end diff --git a/.github/workflows/run_tests_matlab.yml b/.github/workflows/run_tests_matlab.yml index a6355c37..aa4d27a7 100644 --- a/.github/workflows/run_tests_matlab.yml +++ b/.github/workflows/run_tests_matlab.yml @@ -46,9 +46,12 @@ jobs: sudo apt-get -y -qq update sudo apt-get -y install unzip wget + - name: Install Deno + uses: denoland/setup-deno@v1 + with: + deno-version: v1.x - name: Install bids validator - run: npm install -g bids-validator - + run: deno install -Agf -n bids-validator jsr:@bids/validator - name: Install bids example run: | diff --git a/.github/workflows/run_tests_octave.yml b/.github/workflows/run_tests_octave.yml index 32c986b9..44a7f5ce 100644 --- a/.github/workflows/run_tests_octave.yml +++ b/.github/workflows/run_tests_octave.yml @@ -40,8 +40,12 @@ jobs: sudo apt-get -y -qq update sudo apt-get -y install unzip wget + - name: Install Deno + uses: denoland/setup-deno@v1 + with: + deno-version: v1.x - name: Install bids validator - run: npm install -g bids-validator + run: deno install -Agf -n bids-validator jsr:@bids/validator - name: Install bids-example run: | diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 7c300a8c..f432ff58 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -22,12 +22,6 @@ jobs: with: args: --validate - codespell: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: codespell-project/actions-codespell@master - markdown_link_check: runs-on: ubuntu-latest steps: @@ -37,26 +31,3 @@ jobs: use-quiet-mode: yes use-verbose-mode: yes config-file: .github/workflows/mlc_config.json - - miss_hit: - runs-on: ubuntu-latest - strategy: - matrix: - command: [mh_style, mh_metric --ci, mh_lint] - fail-fast: false - steps: - - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 1 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: 3.11 - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools - pip3 install -r requirements.txt - - name: ${{ matrix.command }} - run: | - ${{ matrix.command }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f1dfb9fd..2f0770f3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,4 +46,3 @@ repos: rev: v2.3.0 hooks: - id: codespell - args: [--config=setup.cfg] diff --git a/CITATION.cff b/CITATION.cff index ec0ff309..8f404f46 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -4,7 +4,7 @@ cff-version: 1.2.0 title: bids-matlab -version: 0.2.0 +version: 0.3.0 license: MIT diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7827f916..e0639b40 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,111 +7,6 @@ _We're so excited you're here and want to contribute._ If you have any questions that aren't discussed below, please let us know by [opening an issue](#understanding-issues). -## Table of contents - -Been here before? Already know what you're looking for in this guide? Jump to -the following sections: - -- [Contributing to BIDS-MATLAB](#contributing-to-bids-matlab) - - [Table of contents](#table-of-contents) - - [Joining the community](#joining-the-community) - - [Contributing through GitHub](#contributing-through-github) - - [Understanding issues](#understanding-issues) - - [Issue labels](#issue-labels) - - [Style guide](#style-guide) - - [Writing in markdown](#writing-in-markdown) - - [Matlab code style guide and quality](#matlab-code-style-guide-and-quality) - - [pre-commit hook: reformatting your code when committing](#pre-commit-hook-reformatting-your-code-when-committing) - - [Running tests on the code](#running-tests-on-the-code) - - [Making a change with a pull request](#making-a-change-with-a-pull-request) - - [1. Comment on an existing issue or open a new issue referencing your addition](#1-comment-on-an-existing-issue-or-open-a-new-issue-referencing-your-addition) - - [2. Fork [this repository](https://github.com/bids-standard/BIDS-MATLAB) to your profile](#2-fork-this-repository-to-your-profile) - - [3. Make the changes you've discussed](#3-make-the-changes-youve-discussed) - - [4. Submit a pull request](#4-submit-a-pull-request) - - [Example pull request](#example-pull-request) - - [Commenting on a pull request](#commenting-on-a-pull-request) - - [Navigating to open pull requests](#navigating-to-open-pull-requests) - - [Pull request description](#pull-request-description) - - [Generally commenting on a pull request](#generally-commenting-on-a-pull-request) - - [Specific comments on a pull request](#specific-comments-on-a-pull-request) - - [Suggesting text](#suggesting-text) - - [Accepting suggestion from a review](#accepting-suggestion-from-a-review) - - [How the decision to merge a pull request is made?](#how-the-decision-to-merge-a-pull-request-is-made) - - [Recognizing contributions](#recognizing-contributions) - - [Updating the bids-schema](#updating-the-bids-schema) - - - -## Joining the community - -BIDS - the [Brain Imaging Data Structure](https://bids.neuroimaging.io/) - is a -growing community of neuroimaging enthusiasts, and we want to make our resources -accessible to and engaging for as many researchers as possible. - -Most of our discussions take place here in -[GitHub issues](#understanding-issues). - -To keep on top of new posts, please see this guide for setting your -[topic notifications](https://meta.discourse.org/t/discourse-new-user-guide/96331#heading--topic-notifications). - -As a reminder, we expect that all contributions adhere to our -[Code of Conduct](./CODE_OF_CONDUCT.md). - -## Contributing through GitHub - -[Git](https://git-scm.com/) is a really useful tool for version control. -[GitHub](https://github.com/) sits on top of Git and supports collaborative and -distributed working. - -We know that it can be daunting to start using Git and GitHub if you haven't -worked with them in the past, but the BIDS-MATLAB maintainers are here to help -you figure out any of the jargon or confusing instructions you encounter! - -In order to contribute via GitHub you'll need to set up a free account and sign -in. Here are some -[instructions](https://help.github.com/articles/signing-up-for-a-new-github-account/) -to help you get going. Remember that you can ask us any questions you need to -along the way. - -## Understanding issues - -Every project on GitHub uses -[issues](https://github.com/bids-standard/bids-matlab/issues) slightly -differently. - -The following outlines how BIDS developers think about communicating through -issues. - -**Issues** are individual pieces of work that need to be completed or decisions -that need to be made to move the project forwards. A general guideline: if you -find yourself tempted to write a great big issue that is difficult to describe -as one unit of work, please consider splitting it into two or more issues. - -Issues are assigned [labels](#issue-labels) which explain how they relate to the -overall project's goals and immediate next steps. - -### Issue labels - -The current list of labels are -[here](https://github.com/bids-standard/bids-matlab/labels) and include: - -- [![Opinions wanted](https://img.shields.io/badge/-opinions%20wanted-84b6eb.svg)](https://github.com/bids-standard/bids-matlab/labels/opinions%20wanted) - _These issues hold discussions where we're especially eager for feedback._ - - Ongoing discussions benefit from broad feedback. This label is used to - highlight issues where decisions are being considered, so please join the - conversation! - - - ## Style guide ### Writing in markdown @@ -180,25 +75,6 @@ The code style and quality is also checked during the continuous integration. For more information about MISS_HIT see its [documentation](https://florianschanda.github.io/miss_hit/). -#### pre-commit hook: reformatting your code when committing - -There is a [pre-commit hook](https://pre-commit.com/) that you can use to -reformat files as you commit them. - -Install pre-commit by using our `requirements.txt` file - -```bash -pip install -r requirements.txt -``` - -Install the hook - -```bash -pre-commit install -``` - -You're done. `mh_style --fix` will now be run every time you commit. - ### Running tests on the code The unit and integration tests we have are in the [`tests` folder]'(./tests/) @@ -209,176 +85,6 @@ If you are not sure what unit and integration tests are, check the chapter about that in the [Turing way](https://the-turing-way.netlify.app/reproducible-research/testing.html). -## Making a change with a pull request - -We appreciate all contributions to BIDS-MATLAB. **THANK YOU** for helping us -build this useful resource. - -#### 1. Comment on an existing issue or open a new issue referencing your addition - -This allows other members of the BIDS-MATLAB team to confirm that you aren't -overlapping with work that's currently underway and that everyone is on the same -page with the goal of the work you're going to carry out. - -#### 2. [Fork](https://help.github.com/articles/fork-a-repo/) [this repository](https://github.com/bids-standard/BIDS-MATLAB) to your profile - -This is now your own unique copy of BIDS-MATLAB. Changes here won't affect -anyone else's work, so it's a safe space to explore edits to the code! - -Make sure to -[keep your fork up to date](https://help.github.com/articles/syncing-a-fork/) -with the parent repository, otherwise you can end up with lots of dreaded -[merge conflicts](https://help.github.com/articles/about-merge-conflicts/). - -#### 3. Make the changes you've discussed - -Try to keep the changes focused. If you submit a large amount of work in all in -one go it will be much more work for whomever is reviewing your pull request. -Please detail the changes you are attempting to make. - -#### 4. Submit a [pull request](https://help.github.com/articles/about-pull-requests/) - -Please keep the title of your pull request short but informative. - -Use one of the following prefixes in the title of your pull request: - -- `[ENH]` - enhancement of the software that adds a new feature or support for - a new data type -- `[FIX]` - fix of a bug or documentation error -- `[INFRA]` - changes to the infrastructure automating the project release - (for example, testing in continuous integration, building HTML docs) -- `[MISC]` - everything else including changes to the file listing - contributors - -If you are opening a pull request to obtain early feedback, but the changes are -not ready to be merged (also known as a "work in progress" pull request, -sometimes abbreviated by `WIP`), please use a -[draft pull request](https://github.blog/2019-02-14-introducing-draft-pull-requests/). - -If your pull request include: - -- some new features in the code base -- or if it changes the expected behavior of the code that is already in place, - -you may be asked to provide tests to describe the new expected behavior of the -code. - -A member of the BIDS-MATLAB team will review your changes to confirm that they -can be merged into the main codebase. - -A [review](https://help.github.com/articles/about-pull-request-reviews/) will -usually consist of a few questions to help clarify the work you've done. Keep an -eye on your GitHub notifications and be prepared to join in that conversation. - -You can update your [fork](https://help.github.com/articles/about-forks/) of -BIDS-MATLAB and the pull request will automatically update with those commits. -You don't need to submit a new pull request when you make a change in response -to a review. - -GitHub has a [nice introduction](https://help.github.com/articles/github-flow/) -to the pull request workflow, but please [get in touch](#get-in-touch) if you -have any questions. - -## Example pull request - -Example-Contribution - -## Commenting on a pull request - -Our primary method of adding to or enhancing BIDS-MATLAB occurs in the form of -[pull requests](https://help.github.com/articles/about-pull-requests/). - -This section outlines how to comment on a pull request. - -### Navigating to open pull requests - -The list of pull requests can be found by clicking on the "Pull requests" tab in -the [BIDS-MATLAB repository](https://github.com/bids-standard/BIDS-MATLAB). - -### Pull request description - -Upon opening the pull request we see a detailed description of what this pull -request is seeking to address. Descriptions are important for reviewers and the -community to gain context into what the pull request is achieving. - -![BIDS-pr](docs/commenting_images/BIDS_pr.png "BIDS_pr") - -### Generally commenting on a pull request - -At the bottom of the pull request page, a comment box is provided for general -comments and questions. - -![BIDS-comment](docs/commenting_images/BIDS_comment.png "BIDS-comment") - -### Specific comments on a pull request - -The proposed changes to the software can be seen in the "Files changed" tab. -Proposed additions are displayed on a green background with a `+` before each -added line. Proposed deletions are displayed on a red background with a `-` -before each removed line. To comment on a specific line, hover over it, and -click the blue plus sign (pictured below). Multiple lines can be selected by -clicking and dragging the plus sign. - -![BIDS-specific-comment](docs/commenting_images/BIDS_file_comment.png "BIDS-specific-comment") - -#### Suggesting text - -Comments on lines can contain "suggestions", which allow you to propose specific -wording for consideration. To make a suggestion, click the plus/minus (±) icon -in the comment box (pictured below). - -![BIDS-suggest-box](docs/commenting_images/BIDS_suggest.png "BIDS-suggest") - -Once the button is clicked the highlighted text will be copied into the comment -box and formatted as a -[Markdown code block](https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks). - -![BIDS-suggest-text](docs/commenting_images/BIDS_suggest_text.png "BIDS-suggest-box") - -The "Preview" tab in the comment box will show your suggestion as it will be -rendered. The "Suggested change" box will highlight the differences between the -original text and your suggestion. - -![BIDS-suggest-change](docs/commenting_images/BIDS_suggest_change.png "BIDS-suggest-change") - -A comment may be submitted on its own by clicking "Add single comment". Several -comments may be grouped by clicking "Start a review". As more comments are -written, accept them with "Add review comment", and submit your review comments -as a batch by clicking the "Finish your review" button. - -## Accepting suggestion from a review - -When others are making [suggestions to your pull request](#suggesting-text), you -have the possibility to accept directly the changes suggested during the review -through the GitHub interface. This can often be faster and more convenient than -make the changes locally and then pushing those changes to update your pull -request. Moreover it gives the opportunity to give credit to the reviewers for -their contribution. - -To do this, you must click on the `Files changed` tab at the top of the page of -a pull request. - -![BIDS_pr_files_changed](docs/commenting_images/BIDS_pr_files_changed.png "BIDS_pr_files_changed") - -From there you can browse the different files changed and the 'diff' for each of -them (what line was changed and what the change consist of). You can also see -comments and directly change suggestions made by reviewers. - -You can add each suggestion one by one or group them together in a batch. - -![BIDS_pr_accept_comment](docs/commenting_images/BIDS_pr_accept_comment.png "BIDS_pr_accept_comment") - -If you decide to batch the suggestions to add several of them at once, you must -scroll back to the top of the 'Files changed' page and the `commit suggestions` -button will let you add all those suggestions as a single commit. - -![BIDS_pr_commit_batch](docs/commenting_images/BIDS_pr_commit_batch.png "BIDS_pr_commit_batch") - -Once those suggestions are committed the commit information should mention the -reviewer as a co-author. - -![BIDS_pr_reviewer_credit](docs/commenting_images/BIDS_pr_reviewer_credit.png "BIDS_pr_reviewer_credit") - ## How the decision to merge a pull request is made? The decision-making rules are outlined in @@ -413,3 +119,25 @@ make update_schema A new version of the schema is fetched automatically regularly via continuous integration (see the [github action](.github/workflows/update_schema.yml)) when pushing to the repo or opening a pull-request. + +## release protocol + +- [ ] create a dedicated branch for the release candidate +- [ ] update version in `citation.cff` +- [ ] documentation related + - [ ] ensure the documentation is up to date + - [ ] make sure the doc builds correctly and fix any error +- [ ] update jupyter books +- [ ] update binder +- [ ] update changelog + - [ ] change from `[unreleased]` to the version number + - [ ] remove unused sections (like `security`) +- [ ] run `make release` +- [ ] open a pull request (PR) from this release candidate branch targeting the default branch +- [ ] fix any remaining failing continuous integration (test, markdown and code linting...) +- [ ] merge to default branch +- [ ] create a github tagged release +- [ ] after release + - [ ] set version in `citation.cff` to dev + - [ ] update changelog + - [ ] add an `[unreleased]` section diff --git a/Makefile b/Makefile index a496adcc..cccca139 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,16 @@ - .PHONY: clean manual +.PHONY: clean manual + clean: rm version.txt version.txt: clean CITATION.cff grep -w "^version" CITATION.cff | sed "s/version: /v/g" > version.txt -manual: - cd docs && sh create_manual.sh - update_schema: wget https://bids-specification.readthedocs.io/en/latest/schema.json -O schema.json +# get schema from a PR on the spec +# wget https://bids-specification--1377.org.readthedocs.build/en/1377/schema.json -O schema.json + +release: version.txt + python docs/generate_doc.py + python docs/add_links_to_changelog.py diff --git a/docs/__pycache__/utils.cpython-312.pyc b/docs/__pycache__/utils.cpython-312.pyc new file mode 100644 index 00000000..dd8ecf08 Binary files /dev/null and b/docs/__pycache__/utils.cpython-312.pyc differ diff --git a/docs/add_links_to_changelog.py b/docs/add_links_to_changelog.py new file mode 100644 index 00000000..862ad58f --- /dev/null +++ b/docs/add_links_to_changelog.py @@ -0,0 +1,28 @@ +# replace PR numbers and github usernames with links +from __future__ import annotations + +import re + +from utils import root_dir + +change_log = root_dir() / "docs" / "source" / "changelog.md" + +with open(change_log) as f: + lines = f.readlines() + +with open(change_log, "w") as f: + for line in lines: + if match := re.search(r" @([a-zA-Z0-9_\-]+)", line): + username = match[1] + line = line.replace( + match[0], f" by [{username}](https://github.com/{username}) " + ) + + if match := re.search(r"\#([0-9]+)", line): + pr_number = match[1] + line = line.replace( + match[0], + f"[{pr_number}](https://github.com/bids-standard/bids-matlab/pull/{pr_number})", + ) + + f.write(line) diff --git a/docs/bids-matlab.pdf b/docs/bids-matlab.pdf deleted file mode 100644 index bdb720af..00000000 Binary files a/docs/bids-matlab.pdf and /dev/null differ diff --git a/docs/create_manual.sh b/docs/create_manual.sh deleted file mode 100644 index 10479516..00000000 --- a/docs/create_manual.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -sphinx-build -M latexpdf source build - -cp build/latex/bids-matlab.pdf bids-matlab.pdf diff --git a/docs/requirements.txt b/docs/requirements.txt index 2df87f59..4626a4a7 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -5,4 +5,4 @@ sphinx_rtd_theme sphinx-copybutton myst-parser rich -urllib3==1.26.18 +urllib3==1.26.19 diff --git a/docs/source/changelog.md b/docs/source/changelog.md index 3917b43e..adc75a73 100644 --- a/docs/source/changelog.md +++ b/docs/source/changelog.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [v0.3.0] - 2024-09-11 ### Added -* [ENH] Add zero padding when numbers are passed for indices to `bids.File` or `bids.File.rename` #680 by @Remi-Gau - -### Changed - -### Deprecated - -### Removed +* [ENH] Add zero padding when numbers are passed for indices to `bids.File` or `bids.File.rename` [680](https://github.com/bids-standard/bids-matlab/pull/680) by [Remi-Gau](https://github.com/Remi-Gau) +* [ENH] remove checks for participants.tsv or samples.tsv in derivatives by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/666 +* [ENH] sanitize entities in rename spec by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/679 +* [ENH] Added modality retrieval from path by [nbeliy](https://github.com/nbeliy) in https://github.com/bids-standard/bids-matlab/pull/656 +* [ENH] add zero padding to entity labels / indices when passed as numbers by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/680 +* [ENH] add support for BIDS MRS by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/718 ### Fixed -* [FIX] Create valid participants and sessions tsv during dataset init #688 by @Remi-Gau - -### Security +* [FIX] Create valid participants and sessions tsv during dataset init [688](https://github.com/bids-standard/bids-matlab/pull/688) by [Remi-Gau](https://github.com/Remi-Gau) +* [FIX] create valid participants and sessions tsv during dataset init by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/688 +* [FIX] handle error for misshaped tsv by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/667 +* [FIX] index modality at same level as sessions by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/681 +* [FIX] set default empty modality for files with no entities by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/691 +* [FIX] ignore 'na' as trial types when creating default models by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/709 +* [FIX] Suppress warning when session is taken for modality when going schemaless by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/710 +* [FIX] fix validation of F contrasts by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/711 +* [FIX] handle rare case where intended for field is empty by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/716 +**Full Changelog**: https://github.com/bids-standard/bids-matlab/compare/v0.2.0...v0.3.0 ## [v0.2.0] -### Changed - -### Deprecated - -### Removed - -### Fixed - -### Security +## What's Changed + +Note some changes are missing from these release notes, but should be listed in the pull request that merged the [`dev` branch in the `main` branch](https://github.com/bids-standard/bids-matlab/pull/647). + +* [FIX] do not create empty json when copying to derivatives by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/322 +* [DOC] add orcid numbers to CITATION.CFF by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/337 +* [INFRA] only run update schema on upstream repo by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/343 +* [FIX] change download of moae demo dataset by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/351 +* [FIX] Skip missing suffix subgroup by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/365 +* [FIX] add test to catch error for invalid entities by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/367 +* [FIX] add warning when indexing folder with invalid MATLAB structure name by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/366 +* [DOC & ENH] update doc query and allow to query any BIDS entity by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/368 +* [REF] Use JSON version of the schema by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/415 +* [ENH] add NIRS support by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/433 +* [FIX] query with empty subject should return empty and not fail by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/455 +* [FIX] fix spelling with codespell by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/457 +* [FIX] make bids.copy strict by default by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/468 +* [FIX] add try catch for rare errors on invalid bids datasets by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/471 +* [FIX] cleaner handling of missing dependency by [nbeliy](https://github.com/nbeliy) in https://github.com/bids-standard/bids-matlab/pull/473 +* [FIX] do not index files that start with certain string by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/479 +* [FIX] remove byte order mark from tsv file by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/556 +* [FIX] handle nan and and datetimes when printing tables by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/605 +* [MAINT] change to MIT license by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/653 +* [MAINT] Drop `dev` branch by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/654 + +**Full Changelog**: https://github.com/bids-standard/bids-matlab/compare/v0.1.0...v0.2.0 ## [v0.1.0] -### Changed - -### Deprecated - -### Removed - -### Fixed - -### Security +* Bids report by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/1 +* small fix in a filter that skipped json files when they were in the root folder by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/8 +* Readme update: Add converter and viewer by [tanguyduval](https://github.com/tanguyduval) in https://github.com/bids-standard/bids-matlab/pull/13 +* [WIP] Unit tests - read metadata by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/10 +* Query by [tanguyduval](https://github.com/tanguyduval) in https://github.com/bids-standard/bids-matlab/pull/12 +* multi file datasets (such as BrainVision) should be represented as a single dataset, not multiple by [robertoostenveld](https://github.com/robertoostenveld) in https://github.com/bids-standard/bids-matlab/pull/14 +* Add some extra comments to better explain each function by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/21 +* More detailed error messages by [apjanke](https://github.com/apjanke) in https://github.com/bids-standard/bids-matlab/pull/30 +* gitignore: ignore local copy of bids-examples by [apjanke](https://github.com/apjanke) in https://github.com/bids-standard/bids-matlab/pull/31 +* util.tsvread: Make it a recursive call to self by [apjanke](https://github.com/apjanke) in https://github.com/bids-standard/bids-matlab/pull/33 +* util: Support jsonencode/jsondecode as regular functions by [apjanke](https://github.com/apjanke) in https://github.com/bids-standard/bids-matlab/pull/24 +* Include QUERY in the H1 line for query's helptext by [apjanke](https://github.com/apjanke) in https://github.com/bids-standard/bids-matlab/pull/29 +* Make function helptext more concise with a +bids/Contents.m by [apjanke](https://github.com/apjanke) in https://github.com/bids-standard/bids-matlab/pull/32 +* README: Document requirements by [apjanke](https://github.com/apjanke) in https://github.com/bids-standard/bids-matlab/pull/36 +* Handle non-standard-format metadata JSON files by [apjanke](https://github.com/apjanke) in https://github.com/bids-standard/bids-matlab/pull/37 +* Doc: Typo fixes in comments and helptext by [apjanke](https://github.com/apjanke) in https://github.com/bids-standard/bids-matlab/pull/38 +* Refactoring and renaming by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/41 +* Create a tsvwrite function by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/40 +* Tolerant option for bids.layout by [tanguyduval](https://github.com/tanguyduval) in https://github.com/bids-standard/bids-matlab/pull/11 +* Fix or suppress M-lint code inspection warnings by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/57 +* Move +bids/private stuff to +bids/+internal? by [apjanke](https://github.com/apjanke) in https://github.com/bids-standard/bids-matlab/pull/25 +* [INFRA] Use Ubuntu Focal 20.04 in Travis tests by [gllmflndn](https://github.com/gllmflndn) in https://github.com/bids-standard/bids-matlab/pull/72 +* [FIX] Filter subjects and sessions when querying modalities (issue [65](https://github.com/bids-standard/bids-matlab/pull/65)) by [gllmflndn](https://github.com/gllmflndn) in https://github.com/bids-standard/bids-matlab/pull/71 +* [FIX] fix writing nan issues when dealing with arrays by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/74 +* Add Brainstorm to README by [cMadan](https://github.com/cMadan) in https://github.com/bids-standard/bids-matlab/pull/62 +* add code of conduct from bids-specs by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/80 +* [INFRA] set up miss_hit linter config and github action by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/58 +* Add tsvwrite to documentation by [gllmflndn](https://github.com/gllmflndn) in https://github.com/bids-standard/bids-matlab/pull/85 +* miss_hit.cfg: define project_root by [apjanke](https://github.com/apjanke) in https://github.com/bids-standard/bids-matlab/pull/87 +* README: fix MISS_HIT name styling by [apjanke](https://github.com/apjanke) in https://github.com/bids-standard/bids-matlab/pull/89 +* Add .editorconfig? by [apjanke](https://github.com/apjanke) in https://github.com/bids-standard/bids-matlab/pull/86 +* Skip datasets when labelled as non-conformant by [gllmflndn](https://github.com/gllmflndn) in https://github.com/bids-standard/bids-matlab/pull/94 +* [DOC] Describe what bids-matlab can and cannot do by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/84 +* apply MISS_HIT linter across the board by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/95 +* Decision making & contributing by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/81 +* [FIX] add "dir" to the list of func entities by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/99 +* [INFRA] Customize code suggestions & completions by adding a functionSignatures file by [mslw](https://github.com/mslw) in https://github.com/bids-standard/bids-matlab/pull/42 +* [INFRA] conversion BIDS schema to json by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/101 +* [INFRA] run tests with github action by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/100 +* [INFRA] switch to moxunit for tests by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/108 +* refactoring and linting by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/109 +* [ENH] update schema in https://github.com/bids-standard/bids-matlab/pull/119 +* Feature #asl bids by [HenkMutsaerts](https://github.com/HenkMutsaerts) in https://github.com/bids-standard/bids-matlab/pull/127 +* [MISC] refactor and add tests for layout asl by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/132 +* [ENH] implement bids-schema - part 1 by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/124 +* [ENH] schemaless layout indexes json files by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/147 +* [ENH] add possibility to query for (and filter queries with) extensions by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/150 +* [ENH] improve management of "intended_for" by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/151 +* [ENH] update fieldname m0 scan estimate by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/149 +* Bug in file_utils by [nbeliy](https://github.com/nbeliy) in https://github.com/bids-standard/bids-matlab/pull/166 +* [HOT FIX] fixed bug in file_utils by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/168 +* [HOT FIX] implement hot fix for tsv write by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/170 +* [ENH] schema-less indexing collects files prefix that can be returned / filtered by query by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/154 +* [HOT FIX] implement hot fix for tsv write by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/173 +* [INFRA] BIDS schema update by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/180 +* [INFRA] remove obsolete schema files by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/181 +* [FIX] lower priority to use SPM function to deal with json files by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/178 +* [DOC] update instructions to run the tests by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/183 +* [ENH] index sessions.tsv and scans.tsv by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/182 +* [FIX] default pattern of get_metada expects suffixes to be preceded by underscore by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/179 +* [FIX] default pattern of get_metada expects suffixes to be preceded by underscore by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/189 +* [FIX] ensures that metadata file have the same prefix as the queried file by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/195 +* [DOC] update install isntructions in README by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/197 +* [INFRA] update miss_hit version and add pre-commit hook by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/198 +* [WIP] Function to copy derivatives by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/171 +* [FIX] fix and refactor report by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/206 +* [Fix] fix issues when parsing prefix and ordering entities after parsing filename by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/210 +* [FIX] fix bugs in copy to derivatives by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/207 +* [FIX] return empty output of append to layout when failing to parse using schema by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/212 +* [INFRA] remove unnecessary tsv files in test folder by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/216 +* [INFRA] remove unnecessary tsv files in test folder by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/217 +* [INFRA] add copyright checks from miss_hit by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/218 +* [ENH] implement input parser for copy_to_derivatives by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/221 +* [ENH] copy participants, sessions, scans TSV to derivatives by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/222 +* [ENH] add basic function to generate and update dataset_description by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/184 +* [ENH] add basic filename, path and derivatives JSON creation by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/203 +* [ENH] add basic capabilities to initialize a dataset by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/224 +* [REF] refactor schema functions into a class by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/225 +* [INFRA] fix CI by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/227 +* [DOC] set up sphinx and read the docs by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/229 +* Refactor report and update doc, jupyter notebook, binder by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/230 +* Update binder and jupyter notebooks by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/231 +* Refactoring by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/232 +* [FIX] files with missing required entities, unknown entities or extensions are skipped when using layout with schema by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/237 +* Refactor error and warning handling by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/239 +* [ENH] Index nested derivatives by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/240 +* [FIX] copy to derivatives for windows by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/242 +* [FIX] typos in filename function by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/246 +* [FIX] fix bug in create filename when entities is missing by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/247 +* Speed up dependencies indexing by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/243 +* Dev - jsonwrite by default by [CPernet](https://github.com/CPernet) in https://github.com/bids-standard/bids-matlab/pull/249 +* [FIX] enforce valid fieldnames in schema content and skip schema metadata loading by default by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/256 +* [FIX] update bids init related functions to more BIDS compliant default output by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/257 +* [FIX] allows filtering with entities for query than "data" by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/259 +* [ENH] Index tsv and json files in root folder by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/261 +* add error message to parse_filename by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/264 +* Improve bids.init by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/263 +* [DOC] add matlab exchange badge in README by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/270 +* [DOC] General update of the sphinx doc by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/269 +* [ENH] improves constructors for schema and dataset description by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/271 +* Added treatment of bids-incomatible files in dataset by [nbeliy](https://github.com/nbeliy) in https://github.com/bids-standard/bids-matlab/pull/268 +* [ENH] refactor create_filename and create_path into a bids.File class by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/273 +* [ENH] update Schema class to new schema structure by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/285 +* [INFRA] implement matlab github action by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/201 +* [INFRA] silence codecov by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/290 +* [ENH] Improve bids.query by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/286 +* [ENH] fix and improve bids.report by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/280 +* [TEST] add test for copying to derivatives with an exclude filter by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/292 +* Improvement of File.m interface by [nbeliy](https://github.com/nbeliy) in https://github.com/bids-standard/bids-matlab/pull/289 +* [FIX] fix the regex when querying subjects by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/295 +* [INFRA] add CITATION.cff file by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/284 +* [ENH] update and standardize API by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/305 +* [ENH] do not index json with bids.layout by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/307 +* [ENH] make bids.query return list of availables labels for some common derivative entities by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/308 +* [ENH] validate entity keys provided when using BIDS schema to create filenames by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/309 +* [INFRA] test for matlab octave difference by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/310 +* [INFRA] fix failing tests on windows by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/311 +* [ENH] add support for microscoy by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/315 +* [REL] rc0.1.0 by [Remi-Gau](https://github.com/Remi-Gau) in https://github.com/bids-standard/bids-matlab/pull/287 + +## New Contributors +* by [tanguyduval](https://github.com/tanguyduval) made their first contribution in https://github.com/bids-standard/bids-matlab/pull/13 +* by [robertoostenveld](https://github.com/robertoostenveld) made their first contribution in https://github.com/bids-standard/bids-matlab/pull/14 +* by [apjanke](https://github.com/apjanke) made their first contribution in https://github.com/bids-standard/bids-matlab/pull/30 +* by [gllmflndn](https://github.com/gllmflndn) made their first contribution in https://github.com/bids-standard/bids-matlab/pull/72 +* by [cMadan](https://github.com/cMadan) made their first contribution in https://github.com/bids-standard/bids-matlab/pull/62 +* by [mslw](https://github.com/mslw) made their first contribution in https://github.com/bids-standard/bids-matlab/pull/42 +* by [HenkMutsaerts](https://github.com/HenkMutsaerts) made their first contribution in https://github.com/bids-standard/bids-matlab/pull/127 +* by [nbeliy](https://github.com/nbeliy) made their first contribution in https://github.com/bids-standard/bids-matlab/pull/166 +* by [CPernet](https://github.com/CPernet) made their first contribution in https://github.com/bids-standard/bids-matlab/pull/249 + +**Full Changelog**: https://github.com/bids-standard/bids-matlab/commits/v0.1.0 diff --git a/docs/source/dev_doc.rst b/docs/source/dev_doc.rst index 6d8edb8d..d9041167 100644 --- a/docs/source/dev_doc.rst +++ b/docs/source/dev_doc.rst @@ -44,8 +44,12 @@ developer documentation .. autofunction:: +bids.+internal.keep_file_for_query .. _list_all_trial_types: .. autofunction:: +bids.+internal.list_all_trial_types +.. _list_events: +.. autofunction:: +bids.+internal.list_events .. _match_structure_fields: .. autofunction:: +bids.+internal.match_structure_fields +.. _nansum: +.. autofunction:: +bids.+internal.nansum .. _parse_filename: .. autofunction:: +bids.+internal.parse_filename .. _plot_diagnostic_table: @@ -54,6 +58,8 @@ developer documentation .. autofunction:: +bids.+internal.regexify .. _replace_placeholders: .. autofunction:: +bids.+internal.replace_placeholders +.. _resolve_bids_uri: +.. autofunction:: +bids.+internal.resolve_bids_uri .. _return_file_index: .. autofunction:: +bids.+internal.return_file_index .. _return_file_info: diff --git a/docs/utils.py b/docs/utils.py new file mode 100644 index 00000000..6595ddf6 --- /dev/null +++ b/docs/utils.py @@ -0,0 +1,8 @@ +from __future__ import annotations + +from pathlib import Path + + +def root_dir() -> Path: + """Return path to root directory.""" + return Path(__file__).parent.parent diff --git a/schema.json b/schema.json index cfc9fa58..b0695868 100644 --- a/schema.json +++ b/schema.json @@ -1 +1 @@ -{"schema_version": "0.9.1-dev", "bids_version": "1.10.0-dev", "meta": {"associations": {"events": {"selectors": ["task in entities", "extension != '.json'"], "target": {"suffix": "events", "extension": ".tsv"}, "inherit": true}, "aslcontext": {"selectors": ["suffix == 'asl'", "match(extension, '\\.nii(\\.gz)?$')"], "target": {"suffix": "aslcontext", "extension": ".tsv"}, "inherit": true}, "m0scan": {"selectors": ["suffix == 'asl'", "match(extension, '\\.nii(\\.gz)?$')"], "target": {"suffix": "m0scan", "extension": [".nii", ".nii.gz"]}, "inherit": false}, "magnitude": {"selectors": ["suffix == 'fieldmap'", "match(extension, '\\.nii(\\.gz)?$')"], "target": {"suffix": "magnitude", "extension": [".nii", ".nii.gz"]}, "inherit": false}, "magnitude1": {"selectors": ["match(suffix, 'phase(diff|1)$')", "match(extension, '\\.nii(\\.gz)?$')"], "target": {"suffix": "magnitude1", "extension": [".nii", ".nii.gz"]}, "inherit": false}, "bval": {"selectors": ["intersects([suffix], ['dwi', 'epi'])", "match(extension, '\\.nii(\\.gz)?$')"], "target": {"extension": ".bval"}, "inherit": true}, "bvec": {"selectors": ["intersects([suffix], ['dwi', 'epi'])", "match(extension, '\\.nii(\\.gz)?$')"], "target": {"extension": ".bvec"}, "inherit": true}, "channels": {"selectors": ["intersects([suffix], ['eeg', 'ieeg', 'meg', 'nirs', 'motion', 'optodes'])", "extension != '.json'"], "target": {"suffix": "channels", "extension": ".tsv"}, "inherit": true}, "coordsystem": {"selectors": ["intersects([suffix], ['eeg', 'ieeg', 'meg', 'nirs', 'motion', 'electrodes', 'optodes'])", "extension != '.json'"], "target": {"suffix": "coordsystem", "extension": ".json"}, "inherit": true}}, "context": {"context": {"type": "object", "properties": {"schema": {"description": "The BIDS specification schema", "type": "object"}, "dataset": {"description": "Properties and contents of the entire dataset", "type": "object", "properties": {"dataset_description": {"description": "Contents of /dataset_description.json", "type": "object"}, "files": {"description": "List of all files in dataset", "type": "array"}, "tree": {"description": "Tree view of all files in dataset", "type": "object"}, "ignored": {"description": "Set of ignored files", "type": "array"}, "datatypes": {"description": "Data types present in the dataset", "type": "array"}, "modalities": {"description": "Modalities present in the dataset", "type": "array"}, "subjects": {"description": "Collections of subjects in dataset", "type": "object", "properties": {"sub_dirs": {"description": "Subjects as determined by sub-*/ directories", "type": "array", "items": {"type": "string"}}, "participant_id": {"description": "The participant_id column of participants.tsv", "type": "array", "items": {"type": "string"}}, "phenotype": {"description": "The union of participant_id columns in phenotype files", "type": "array", "items": {"type": "string"}}}}}}, "subject": {"description": "Properties and contents of the current subject", "type": "object", "properties": {"sessions": {"description": "Collections of sessions in subject", "type": "object", "properties": {"ses_dirs": {"description": "Sessions as determined by ses-*/ directories", "type": "array", "items": {"type": "string"}}, "session_id": {"description": "The session_id column of sessions.tsv", "type": "array", "items": {"type": "string"}}, "phenotype": {"description": "The union of session_id columns in phenotype files", "type": "array", "items": {"type": "string"}}}}}}, "path": {"description": "Path of the current file", "type": "string"}, "size": {"description": "Length of the current file in bytes", "type": "int"}, "entities": {"description": "Entities parsed from the current filename", "type": "object"}, "datatype": {"description": "Datatype of current file, for examples, anat", "type": "string"}, "suffix": {"description": "Suffix of current file", "type": "string"}, "extension": {"description": "Extension of current file including initial dot", "type": "string"}, "modality": {"description": "Modality of current file, for examples, MRI", "type": "string"}, "sidecar": {"description": "Sidecar metadata constructed via the inheritance principle", "type": "object"}, "associations": {"description": "Associated files, indexed by suffix, selected according to the inheritance principle\n", "type": "object", "properties": {"events": {"description": "Events file", "type": "object", "properties": {"path": {"description": "Path to associated events file", "type": "string"}, "onset": {"description": "Contents of the onset column", "type": "array", "items": {"type": "string"}}}}, "aslcontext": {"description": "ASL context file", "type": "object", "properties": {"path": {"description": "Path to associated aslcontext file", "type": "string"}, "n_rows": {"description": "Number of rows in aslcontext.tsv", "type": "integer"}, "volume_type": {"description": "Contents of the volume_type column", "type": "array", "items": {"type": "string"}}}}, "m0scan": {"description": "M0 scan file", "type": "object", "properties": {"path": {"description": "Path to associated M0 scan file", "type": "string"}}}, "magnitude": {"description": "Magnitude image file", "type": "object", "properties": {"path": {"description": "Path to associated magnitude file", "type": "string"}}}, "magnitude1": {"description": "Magnitude1 image file", "type": "object", "properties": {"path": {"description": "Path to associated magnitude1 file", "type": "string"}}}, "bval": {"description": "B value file", "type": "object", "properties": {"path": {"description": "Path to associated bval file", "type": "string"}, "n_cols": {"description": "Number of columns in bval file", "type": "integer"}, "n_rows": {"description": "Number of rows in bval file", "type": "integer"}, "values": {"description": "B-values contained in bval file", "type": "array", "items": {"type": "number"}}}}, "bvec": {"description": "B vector file", "type": "object", "properties": {"path": {"description": "Path to associated bvec file", "type": "string"}, "n_cols": {"description": "Number of columns in bvec file", "type": "integer"}, "n_rows": {"description": "Number of rows in bvec file", "type": "integer"}}}, "channels": {"description": "Channels file", "type": "object", "properties": {"path": {"description": "Path to associated channels file", "type": "string"}, "type": {"description": "Contents of the type column", "type": "array", "items": {"type": "string"}}}}, "coordsystem": {"description": "Coordinate system file", "type": "object", "properties": {"path": {"description": "Path to associated coordsystem file", "type": "string"}}}}}, "columns": {"description": "TSV columns, indexed by column header, values are arrays with column contents", "type": "object", "additionalProperties": {"type": "array"}}, "json": {"description": "Contents of the current JSON file", "type": "object"}, "gzip": {"description": "Parsed contents of gzip header", "type": "object", "properties": {"timestamp": {"description": "Modification time, unix timestamp", "type": "number"}, "filename": {"description": "Filename", "type": "string"}, "comment": {"description": "Comment", "type": "string"}}}, "nifti_header": {"name": "NIfTI Header", "description": "Parsed contents of NIfTI header referenced elsewhere in schema.", "type": "object", "properties": {"dim_info": {"name": "Dimension Information", "description": "Metadata about dimensions data.", "type": "object", "properties": {"freq": {"name": "Frequency", "description": "These fields encode which spatial dimension (1, 2, or 3).", "type": "integer"}, "phase": {"name": "Phase", "description": "Corresponds to which acquisition dimension for MRI data.", "type": "integer"}, "slice": {"name": "Slice", "description": "Slice dimensions.", "type": "integer"}}}, "dim": {"name": "Data Dimensions", "description": "Data seq dimensions.", "type": "array", "minItems": 8, "maxItems": 8, "items": {"type": "integer"}}, "pixdim": {"name": "Pixel Dimension", "description": "Grid spacings (unit per dimension).", "type": "array", "minItems": 8, "maxItems": 8, "items": {"type": "number"}}, "shape": {"name": "Data shape", "description": "Data array shape, equal to dim[1:dim[0] + 1]", "type": "array", "minItems": 0, "maxItems": 7, "items": {"type": "integer"}}, "voxel_sizes": {"name": "Voxel sizes", "description": "Voxel sizes, equal to pixdim[1:dim[0] + 1]", "type": "array", "minItems": 0, "maxItems": 7, "items": {"type": "number"}}, "xyzt_units": {"name": "XYZT Units", "description": "Units of pixdim[1..4]", "type": "object", "properties": {"xyz": {"name": "XYZ Units", "description": "String representing the unit of voxel spacing.", "type": "string", "enum": ["unknown", "meter", "mm", "um"]}, "t": {"name": "Time Unit", "description": "String representing the unit of inter-volume intervals.", "type": "string", "enum": ["unknown", "sec", "msec", "usec"]}}}, "qform_code": {"name": "qform code", "description": "Use of the quaternion fields.", "type": "integer"}, "sform_code": {"name": "sform code", "description": "Use of the affine fields.", "type": "integer"}}}, "ome": {"name": "Open Microscopy Environment fields", "description": "Parsed contents of OME-XML header, which may be found in OME-TIFF or OME-ZARR files", "type": "object", "properties": {"PhysicalSizeX": {"name": "PhysicalSizeX", "description": "Pixels / @PhysicalSizeX", "type": "float"}, "PhysicalSizeY": {"name": "PhysicalSizeY", "description": "Pixels / @PhysicalSizeY", "type": "float"}, "PhysicalSizeZ": {"name": "PhysicalSizeZ", "description": "Pixels / @PhysicalSizeZ", "type": "float"}, "PhysicalSizeXUnit": {"name": "PhysicalSizeXUnit", "description": "Pixels / @PhysicalSizeXUnit", "type": "string"}, "PhysicalSizeYUnit": {"name": "PhysicalSizeYUnit", "description": "Pixels / @PhysicalSizeYUnit", "type": "string"}, "PhysicalSizeZUnit": {"name": "PhysicalSizeZUnit", "description": "Pixels / @PhysicalSizeZUnit", "type": "string"}}}, "tiff": {"name": "TIFF", "description": "TIFF file format metadata", "type": "object", "properties": {"version": {"name": "Version", "description": "TIFF file format version (the second 2-byte block)", "type": "int"}}}}}}, "expression_tests": [{"expression": "sidecar.MissingValue", "result": null}, {"expression": "null.anything", "result": null}, {"expression": "(null)", "result": null}, {"expression": "null[0]", "result": null}, {"expression": "null && true", "result": null}, {"expression": "true && null", "result": null}, {"expression": "false && null", "result": false}, {"expression": "true || null", "result": true}, {"expression": "null || true", "result": true}, {"expression": "false || null", "result": null}, {"expression": "!null", "result": true}, {"expression": "intersects([], null)", "result": false}, {"expression": "intersects(null, [])", "result": false}, {"expression": "allequal([], null)", "result": false}, {"expression": "allequal(null, [])", "result": false}, {"expression": "match(null, 'pattern')", "result": null}, {"expression": "match('string', null)", "result": false}, {"expression": "substr(null, 1, 4)", "result": null}, {"expression": "substr('string', null, 4)", "result": null}, {"expression": "substr('string', 1, null)", "result": null}, {"expression": "min(null)", "result": null}, {"expression": "max(null)", "result": null}, {"expression": "length(null)", "result": null}, {"expression": "type(null)", "result": "null"}, {"expression": "null == false", "result": false}, {"expression": "null == true", "result": false}, {"expression": "null != false", "result": true}, {"expression": "null != true", "result": true}, {"expression": "null != 1.5", "result": true}, {"expression": "null == null", "result": true}, {"expression": "null == 1", "result": false}, {"expression": "\"VolumeTiming\" in null", "result": null}, {"expression": "exists(null, \"bids-uri\")", "result": 0}, {"expression": "exists([], null)", "result": 0}, {"expression": "true || sidecar.MissingValue", "result": true}, {"expression": "1 + 2", "result": 3}, {"expression": "\"cat\" + \"dog\"", "result": "catdog"}, {"expression": "match('string', '.*')", "result": true}, {"expression": "match('', '.')", "result": false}, {"expression": "substr('string', 1, 4)", "result": "tri"}, {"expression": "substr('string', 0, 20)", "result": "string"}, {"expression": "type(1)", "result": "number"}, {"expression": "type([])", "result": "array"}, {"expression": "type({})", "result": "object"}, {"expression": "type(true)", "result": "boolean"}, {"expression": "intersects([1], [1, 2])", "result": true}, {"expression": "intersects([1], [])", "result": false}, {"expression": "length([1, 2, 3])", "result": 3}, {"expression": "length([])", "result": 0}, {"expression": "count([1, 2, 3], 1)", "result": 1}, {"expression": "index([\"i\", \"j\", \"k\"], \"i\")", "result": 0}, {"expression": "index([\"i\", \"j\", \"k\"], \"j\")", "result": 1}, {"expression": "index([\"i\", \"j\", \"k\"], \"x\")", "result": null}, {"expression": "sorted([3, 2, 1])", "result": [1, 2, 3]}, {"expression": "allequal(sorted([3, 2, 1]), [1, 2, 3])", "result": true}, {"expression": "min([-1, \"n/a\", 1])", "result": -1}, {"expression": "max([-1, \"n/a\", 1])", "result": 1}, {"expression": "[3, 2, 1][0]", "result": 3}, {"expression": "\"string\"[0]", "result": "s"}], "versions": ["1.9.0", "1.8.0", "1.7.0", "1.6.0", "1.5.0", "1.4.1", "1.4.0", "1.3.0", "1.2.2", "1.2.1", "1.2.0", "1.1.2", "1.1.1", "1.1.0", "1.0.2", "1.0.1", "1.0.0"]}, "objects": {"columns": {"HED": {"name": "HED", "display_name": "HED Tag", "description": "Hierarchical Event Descriptor (HED) Tag.\nSee the [HED Appendix](SPEC_ROOT/appendices/hed.md) for details.\n", "type": "string"}, "abbreviation": {"name": "abbreviation", "display_name": "Abbreviation", "description": "The unique label abbreviation\n", "type": "string"}, "acq_time__scans": {"name": "acq_time", "display_name": "Scan acquisition time", "description": "Acquisition time refers to when the first data point in each run was acquired.\nFurthermore, if this header is provided, the acquisition times of all files\nfrom the same recording MUST be identical.\nDatetime format and their deidentification are described in\n[Units](SPEC_ROOT/common-principles.md#units).\n", "type": "string", "format": "datetime"}, "acq_time__sessions": {"name": "acq_time", "display_name": "Session acquisition time", "description": "Acquisition time refers to when the first data point of the first run was acquired.\nDatetime format and their deidentification are described in\n[Units](SPEC_ROOT/common-principles.md#units).\n", "type": "string", "format": "datetime"}, "age": {"name": "age", "display_name": "Subject age", "description": "Numeric value in years (float or integer value).\n\nIt is recommended to tag participant ages that are 89 or higher as 89+,\nfor privacy purposes.\n", "type": "number", "unit": "year"}, "cardiac": {"name": "cardiac", "display_name": "Cardiac measurement", "description": "continuous pulse measurement\n", "type": "number"}, "channel": {"name": "channel", "display_name": "Channel", "description": "Channel(s) associated with an event.\nIf multiple channels are specified, they MUST be separated by a delimiter\nspecified in the `\"Delimiter\"` field describing the `channel` column.\nFor example, channels separated with a comma (`,`) require the `events.json`\nfile to contain `\"channel\": {\"Delimiter\": \",\"}`.\nIn the absence of a delimiter, tools MUST interpret any character as being part\nof a channel name.\n", "type": "string"}, "color": {"name": "color", "display_name": "Color label", "description": "Hexadecimal. Label color for visualization.\n", "type": "string", "unit": "hexadecimal"}, "component": {"name": "component", "display_name": "Component", "description": "Description of the spatial axis or label of quaternion component associated with the channel.\nFor example, `x`,`y`,`z` for position channels,\nor `quat_x`, `quat_y`, `quat_z`, `quat_w` for quaternion orientation channels.\n", "type": "string", "enum": ["x", "y", "z", "quat_x", "quat_y", "quat_z", "quat_w", "n/a"]}, "detector__channels": {"name": "detector", "display_name": "Detector Name", "description": "Name of the detector as specified in the `*_optodes.tsv` file.\n`n/a` for channels that do not contain NIRS signals (for example, acceleration).\n", "anyOf": [{"type": "string"}, {"type": "string", "enum": ["n/a"]}]}, "detector_type": {"name": "detector_type", "display_name": "Detector Type", "description": "The type of detector. Only to be used if the field `DetectorType` in `*_nirs.json` is set to `mixed`.\n", "anyOf": [{"type": "string"}]}, "derived_from": {"name": "derived_from", "display_name": "Derived from", "description": "`sample-