Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Michiel Cottaar
fslpy
Commits
f5d6cae7
Commit
f5d6cae7
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Plain Diff
Merge branch 'bf/bids' into 'master'
Bf/bids See merge request fsl/fslpy!194
parents
e26fd9a1
a302be8f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.rst
+11
-0
11 additions, 0 deletions
CHANGELOG.rst
fsl/data/image.py
+2
-1
2 additions, 1 deletion
fsl/data/image.py
tests/test_image.py
+19
-0
19 additions, 0 deletions
tests/test_image.py
with
32 additions
and
1 deletion
CHANGELOG.rst
+
11
−
0
View file @
f5d6cae7
...
@@ -2,6 +2,17 @@ This document contains the ``fslpy`` release history in reverse chronological
...
@@ -2,6 +2,17 @@ This document contains the ``fslpy`` release history in reverse chronological
order.
order.
2.8.1 (Under development)
-------------------------
Fixed
^^^^^
* Fixed a bug where an error would be raised on attempts to load an image file
without a BIDS-compatible name from a BIDS-like directory.
2.8.0 (Wednesday 29th January 2020)
2.8.0 (Wednesday 29th January 2020)
-----------------------------------
-----------------------------------
...
...
This diff is collapsed.
Click to expand it.
fsl/data/image.py
+
2
−
1
View file @
f5d6cae7
...
@@ -1540,7 +1540,8 @@ def loadMetadata(image):
...
@@ -1540,7 +1540,8 @@ def loadMetadata(image):
basename
=
op
.
basename
(
removeExt
(
filename
))
basename
=
op
.
basename
(
removeExt
(
filename
))
dirname
=
op
.
dirname
(
filename
)
dirname
=
op
.
dirname
(
filename
)
if
fslbids
.
inBIDSDir
(
image
.
dataSource
):
if
fslbids
.
isBIDSFile
(
image
.
dataSource
)
and
\
fslbids
.
inBIDSDir
(
image
.
dataSource
):
return
fslbids
.
loadMetadata
(
image
.
dataSource
)
return
fslbids
.
loadMetadata
(
image
.
dataSource
)
jsonfile
=
op
.
join
(
dirname
,
'
{}.json
'
.
format
(
basename
))
jsonfile
=
op
.
join
(
dirname
,
'
{}.json
'
.
format
(
basename
))
...
...
This diff is collapsed.
Click to expand it.
tests/test_image.py
+
19
−
0
View file @
f5d6cae7
...
@@ -1401,6 +1401,25 @@ def test_loadMeta():
...
@@ -1401,6 +1401,25 @@ def test_loadMeta():
assert
img
.
getMeta
(
'
b
'
)
==
2
assert
img
.
getMeta
(
'
b
'
)
==
2
def
test_loadMeta_nonBids
():
with
tempdir
():
# non-bids file in a BIDS-like directory
imgfile
=
op
.
join
(
'
data
'
,
'
sub-01
'
,
'
anat
'
,
'
sub-01_T1w_nonbids.nii.gz
'
)
os
.
makedirs
(
op
.
dirname
(
imgfile
))
make_image
(
imgfile
)
with
open
(
op
.
join
(
'
data
'
,
'
dataset_description.json
'
),
'
wt
'
)
as
f
:
pass
img
=
fslimage
.
Image
(
imgfile
,
loadMeta
=
True
)
assert
list
(
img
.
metaKeys
())
==
[]
def
test_loadMetadata
():
def
test_loadMetadata
():
with
tempdir
():
with
tempdir
():
make_image
(
'
image.nii.gz
'
)
make_image
(
'
image.nii.gz
'
)
...
...
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