Skip to content
Snippets Groups Projects
Commit ce35d815 authored by nbeliy's avatar nbeliy
Browse files

working on process

parent f7acb04e
No related branches found
No related tags found
No related merge requests found
...@@ -7,44 +7,101 @@ from definitions import checkSeries, plugin_root ...@@ -7,44 +7,101 @@ from definitions import checkSeries, plugin_root
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# global variables #############################
rawfolder = "" # global bidscoin variables #
bidsfolder = "" #############################
# Folder with prepared dataset
preparedfolder = None
# folder with bidsified dataset
bidsfolder = None
# switch if is a dry-run (test run)
dry_run = False dry_run = False
participants_table = None
rec_path = "" #####################
countSeries = {} # Session variables #
#####################
# list of sequences in current session
# used to identify fMRI and MPM MRI images
series = list()
#####################
# Sequence variable #
#####################
# The id of current sequence
sid = -1
# Identified tag for fMRI and MPM MRI
Intended = ""
def InitEP(source: str, destination: str, dry: bool) -> int: def InitEP(source: str, destination: str, dry: bool) -> int:
global rawfolder """
Initialisation of plugin
1. Saves source/destination folders and dry_run switch
Parameters
----------
source: str
path to source dataset
destination:
path to prepared dataset
"""
global preparedfolder
global bidsfolder global bidsfolder
global dry_run global dry_run
rawfolder = source preparedfolder = source
bidsfolder = destination bidsfolder = destination
dry_run = dry dry_run = dry
def SubjectEP(scan): def SubjectEP(scan):
"""
Subject modification
1. Fills the handiness value for subject
"""
# values in scan.sub_values are pre-filled
# from participants.tsv file, no need to refill them.
# If needed to remove value from participants, you
# can set it to None
scan.sub_values["handiness"] = random.choice([0, 1]) scan.sub_values["handiness"] = random.choice([0, 1])
def SessionEP(scan): def SessionEP(scan):
"""
Session files modifications
1. Stores the list of sequences in the session
2. Checks if session contains correct sequences
2. Checks if session HCL and LCL contains task and
KSS/VAS files
"""
######################################
# Initialisation of sesion variables #
######################################
global series global series
global sid global sid
sub = scan.subject sub = scan.subject
ses = scan.session ses = scan.session
path = os.path.join(rawfolder, path = os.path.join(scan.in_path, "MRI")
sub, ses,
"MRI")
series = sorted(os.listdir(path)) series = sorted(os.listdir(path))
series = [s.split("-", 1)[1] for s in series] series = [s.split("-", 1)[1] for s in series]
sid = -1 sid = -1
checkSeries(path, sub, ses, False) checkSeries(path, sub, ses, False)
# copytng behevioral data
aux_input = os.path.join(rawfolder, sub, ses, "auxiliary")
#############################################
# Checking for existance of auxiliary files #
#############################################
aux_input = os.path.join(session.in_path, "auxiliary")
if ses in ("ses-LCL", "ses-HCL"): if ses in ("ses-LCL", "ses-HCL"):
if not os.path.isdir(aux_input): if not os.path.isdir(aux_input):
logger.error("Session {}/{} do not contain auxiliary folder" logger.error("Session {}/{} do not contain auxiliary folder"
...@@ -60,12 +117,10 @@ def SessionEP(scan): ...@@ -60,12 +117,10 @@ def SessionEP(scan):
.format(sub, ses, source)) .format(sub, ses, source))
series = list()
sid = -1
Intended = ""
def SequenceEP(recording): def SequenceEP(recording):
"""
Sequence identification
"""
global series global series
global sid global sid
global Intended global Intended
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment