Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bidsme_examples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
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
GIGA-CRC Human Imaging
Public
BIDStools
BIDSme
bidsme_examples
Commits
1329ed2f
Commit
1329ed2f
authored
5 years ago
by
Beliy Nikita
Browse files
Options
Downloads
Patches
Plain Diff
bidsification adapted
parent
0c8dea10
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
example1/resources/plugins/bidsify_plugin.py
+5
-33
5 additions, 33 deletions
example1/resources/plugins/bidsify_plugin.py
with
5 additions
and
33 deletions
example1/resources/plugins/bidsify_plugin.py
+
5
−
33
View file @
1329ed2f
import
os
import
shutil
import
logging
import
pandas
import
Modules
from
definitions
import
Series
,
checkSeries
from
definitions
import
checkSeries
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -28,34 +25,12 @@ def InitEP(source: str, destination: str, dry: bool) -> int:
bidsfolder
=
destination
dry_run
=
dry
participants
=
os
.
path
.
join
(
rawfolder
,
"
participants.tsv
"
)
if
not
os
.
path
.
isfile
(
participants
):
e
=
"
participants.tsv not found in {}
"
.
format
(
rawfolder
)
logger
.
critical
(
e
)
raise
FileNotFoundError
(
"
participants.tsv not found
"
)
global
participants_table
participants_table
=
pandas
.
read_csv
(
participants
,
sep
=
'
\t
'
,
header
=
0
,
index_col
=
"
participant_id
"
,
na_values
=
"
n/a
"
)
participants_table
=
participants_table
.
groupby
(
"
participant_id
"
)
\
.
ffill
().
drop_duplicates
()
duplicates
=
participants_table
.
index
.
duplicated
(
keep
=
False
)
if
duplicates
.
any
():
logger
.
error
(
"
One or several subjects have conflicting values.
"
"
See {} for details
"
.
format
(
participants
))
raise
KeyError
(
"
Conflicting values in subject descriptions
"
)
Modules
.
baseModule
.
sub_BIDSfields
.
LoadDefinitions
(
os
.
path
.
join
(
rawfolder
,
"
participants.json
"
))
def
SessionEP
(
scan
):
global
series
global
sid
sub
=
scan
[
"
subject
"
]
ses
=
scan
[
"
session
"
]
sub
=
scan
.
subject
ses
=
scan
.
session
path
=
os
.
path
.
join
(
rawfolder
,
sub
,
ses
,
"
MRI
"
)
...
...
@@ -99,21 +74,18 @@ series = list()
sid
=
-
1
Intended
=
""
def
SequenceEP
(
recording
):
global
series
global
sid
global
Intended
Intended
=
""
sub
=
recording
.
subId
()
part
=
participants_table
.
loc
[
sub
]
for
f
in
participants_table
.
columns
:
recording
.
sub_BIDSvalues
[
f
]
=
part
[
f
]
sid
+=
1
recid
=
series
[
sid
]
if
recid
!=
recording
.
recId
():
logger
.
warning
(
"
{}: Id mismatch folder {}
"
.
format
(
recording
.
recIdentity
(
False
),
recid
))
recid
))
if
recid
==
"
cmrr_mbep2d_bold_mb2_invertpe
"
:
mod
=
series
[
sid
+
1
]
if
mod
.
endswith
(
"
cmrr_mbep2d_bold_mb2_task_fat
"
):
...
...
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