Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
laemtl committed Oct 21, 2021
1 parent 2390bd3 commit 0673182
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 21 deletions.
11 changes: 7 additions & 4 deletions imaging_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,26 @@ if [ ! -f "$MAKECHECK" ]; then
exit
fi

echo "-- LORIS DB Configuration --\n"
echo ""
echo "-- LORIS DB Configuration --"
read -p "What is the database name? " mysqldb
read -p "What is the database host? " mysqlhost
read -p "What is the MySQL user? " mysqluser
stty -echo
read -p "What is the MySQL password? " mysqlpass; echo
stty echo

echo "-- LORIS API Configuration --\n"
echo ""
echo "-- LORIS API Configuration --"
read -p "What is the LORIS url (including http(s))? " lorishost
read -p "What is the API version (min v0.0.4-dev recommended)? " apiversion
read -p "What is the LORIS admin user? " lorisuser
stty -echo
read -p "What is the LORIS user admin password? " lorispass; echo
read -p "What is the LORIS user admin password? " lorispwd; echo
stty echo

echo "-- LORIS MRI Configuration --\n"
echo ""
echo "-- LORIS MRI Configuration --"
read -p "What is the Linux user which the installation will be based on? " USER
read -p "What is the project name? " PROJ ##this will be used to create all the corresponding directories...i.e /data/gusto/bin.....
read -p "What is your email address? " email
Expand Down
11 changes: 7 additions & 4 deletions imaging_install_MacOSX.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,26 @@ LOGFILE="/tmp/$(basename $0).$$.tmp"
touch $LOGFILE
trap "rm $LOGFILE" EXIT

echo "-- LORIS DB Configuration --\n"
echo ""
echo "-- LORIS DB Configuration --"
read -p "What is the database name? " mysqldb
read -p "What is the database host? " mysqlhost
read -p "What is the MySQL user? " mysqluser
stty -echo
read -p "What is the MySQL password? " mysqlpass; echo
stty echo

echo "-- LORIS API Configuration --\n"
echo ""
echo "-- LORIS API Configuration --"
read -p "What is the LORIS url (including http(s))? " lorishost
read -p "What is the API version (min v0.0.4-dev recommended)? " apiversion
read -p "What is the LORIS admin user? " lorisuser
stty -echo
read -p "What is the LORIS user admin password? " lorispass; echo
read -p "What is the LORIS user admin password? " lorispwd; echo
stty echo

echo "-- LORIS MRI Configuration --\n"
echo ""
echo "-- LORIS MRI Configuration --"
read -p "What is the Linux user which the installation will be based on? " USER
read -p "What is the project name? " PROJ ##this will be used to create all the corresponding directories...i.e /data/gusto/bin.....
read -p "What prod file name would you like to use? default: prod " prodfilename
Expand Down
2 changes: 1 addition & 1 deletion python/bids_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def read_and_insert_bids(bids_dir, config_file, verbose, createcand, createvisit
for scan_data in bids_reader.bids_layout.get_collections('session', 'scans')
])

if len(scans_data.get('acq_time')) == 0:
if 'acq_time' not in scans_data.columns:
message = '\n\tERROR: Can\'t find scans acquisition time data'
print(message)
sys.exit(lib.exitcode.BIDS_SCANS_ACQ_TIME_MISSING)
Expand Down
4 changes: 3 additions & 1 deletion python/lib/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class Api:
the LORIS-MRI python code base and the LORIS backend.
"""

token = None

def __init__(self, config, verbose):
"""
Constructor method for the Api class.
Expand Down Expand Up @@ -69,7 +71,7 @@ def start_next_stage(self, candid, visit, site, subproject, project, date):
verify=False
)

if (resp.status and resp.status.code and resp.status.code == 200):
if (resp.status_code and resp.status_code == 200):
print("Next stage successfully started.")
else:
print("An error occured. Can't start next stage.")
27 changes: 18 additions & 9 deletions python/lib/bidsreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,24 @@ def load_bids_data(self):
bids_pack_version = list(map(int, bids.__version__.split('.')))
# disabled until is a workaround for https://github.com/bids-standard/pybids/issues/760 is found
# [file] bids_import.py [function] read_and_insert_bids [line] for modality in row['modalities']: (row['modalities'] is empty)
#if (bids_pack_version[0] > 0
# or bids_pack_version[1] > 12
# or (bids_pack_version[1] == 12 and bids_pack_version[2] > 0)):
# bids_layout = BIDSLayout(
# root=self.bids_dir,
# indexer=BIDSLayoutIndexer(config_filename=bids_config, ignore=exclude_arr, force_index=force_arr)
# )
#else:
bids_layout = BIDSLayout(root=self.bids_dir, config=bids_config, ignore=exclude_arr, force_index=force_arr, derivatives=True)
'''
if (bids_pack_version[0] > 0
or bids_pack_version[1] > 12
or (bids_pack_version[1] == 12 and bids_pack_version[2] > 0)):
bids_layout = BIDSLayout(
root=self.bids_dir,
indexer=BIDSLayoutIndexer(config_filename=bids_config, ignore=exclude_arr, force_index=force_arr),
derivatives=True
)
else:
'''
bids_layout = BIDSLayout(
root=self.bids_dir,
config=bids_config,
ignore=exclude_arr,
force_index=force_arr,
derivatives=True
)

if self.verbose:
print('\t=> BIDS dataset loaded with BIDS layout\n')
Expand Down
4 changes: 2 additions & 2 deletions python/lib/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ def grep_id_from_lookup_table(self, id_field_name, table_name, where_field_name,
)

if not id:
message = "\nERROR: " + where_value + " " + where_field_name + \
" does not exist in " + table_name + " database table\n"
message = "\nERROR: " + str(where_value) + " " + str(where_field_name) + \
" does not exist in " + str(table_name) + " database table\n"
print(message)
sys.exit(lib.exitcode.SELECT_FAILURE)

Expand Down
4 changes: 4 additions & 0 deletions python/lib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ def start_visit_stage(self, db, api, visit_date):
if self.verbose:
print("Starting visit stage for " + self.visit_label + " and CandID " + self.cand_id)

if not self.subproject_id or not self.project_id:
print("Can't start the visit stage - No subproject and project associated with the participant data.")
return

site = db.grep_id_from_lookup_table('Name', 'psc', 'CenterID', self.center_id)
subproject = db.grep_id_from_lookup_table('title', 'subproject', 'SubprojectID', self.subproject_id)
project = db.grep_id_from_lookup_table('Name', 'Project', 'ProjectID', self.project_id)
Expand Down

0 comments on commit 0673182

Please sign in to comment.