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
2777a190
Commit
2777a190
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix - dicom json file sorting was not taking into account file names with
non-numeric characters in prefix.
parent
dac9abcc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/data/dicom.py
+13
-6
13 additions, 6 deletions
fsl/data/dicom.py
with
13 additions
and
6 deletions
fsl/data/dicom.py
+
13
−
6
View file @
2777a190
...
...
@@ -152,8 +152,9 @@ def scanDir(dcmdir):
if
not
enabled
():
raise
RuntimeError
(
'
dcm2niix is not available or is too old
'
)
dcmdir
=
op
.
abspath
(
dcmdir
)
cmd
=
'
dcm2niix -b o -ba n -f %s -o . {}
'
.
format
(
dcmdir
)
dcmdir
=
op
.
abspath
(
dcmdir
)
cmd
=
'
dcm2niix -b o -ba n -f %s -o . {}
'
.
format
(
dcmdir
)
snumPattern
=
re
.
compile
(
'
^[0-9]+
'
)
with
tempdir
.
tempdir
()
as
td
:
...
...
@@ -165,11 +166,17 @@ def scanDir(dcmdir):
if
len
(
files
)
==
0
:
return
[]
# sort numerically by series number
def
sortkey
(
f
):
return
int
(
op
.
splitext
(
op
.
basename
(
f
))[
0
])
# sort numerically by series number if possible
try
:
def
sortkey
(
f
):
match
=
re
.
match
(
snumPattern
,
f
)
snum
=
int
(
match
.
group
(
0
))
return
snum
files
=
sorted
(
files
,
key
=
sortkey
)
files
=
sorted
(
files
,
key
=
sortkey
)
except
Exception
:
files
=
sorted
(
files
)
series
=
[]
for
fn
in
files
:
...
...
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