Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evan Edmond
fslpy
Commits
8a8c3649
Commit
8a8c3649
authored
4 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
RF: Change filename check back to not requiring any entities, because e.g.
"T1w.json" is a valid sidecar file
parent
0b3df708
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/utils/bids.py
+6
-2
6 additions, 2 deletions
fsl/utils/bids.py
with
6 additions
and
2 deletions
fsl/utils/bids.py
+
6
−
2
View file @
8a8c3649
...
...
@@ -156,7 +156,7 @@ def inBIDSDir(filename):
def
isBIDSFile
(
filename
,
strict
=
True
):
"""
Returns ``True`` if ``filename`` looks like a BIDS image or JSON file.
A BIDS file name must consist of
one
or more
"
entities
"
(alpha-numeric
A BIDS file name must consist of
zero
or more
"
entities
"
(alpha-numeric
``name-value`` pairs), a
"
suffix
"
, all separated by underscores, and a
regular file extension. For example, the following file::
...
...
@@ -170,8 +170,12 @@ def isBIDSFile(filename, strict=True):
dataset directory, as defined by :func:`inBIDSDir`.
"""
# Zero or more entities because sidecar files
# do not necessarily need to contain any
# entities (e.g. ``T1w.json`` is valid)
name
=
op
.
basename
(
filename
)
pattern
=
r
'
([a-z0-9]+-[a-z0-9]+_)
+
([a-z0-9])+\.(.+)
'
pattern
=
r
'
([a-z0-9]+-[a-z0-9]+_)
*
([a-z0-9])+\.(.+)
'
flags
=
re
.
ASCII
|
re
.
IGNORECASE
match
=
re
.
fullmatch
(
pattern
,
name
,
flags
)
is
not
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment