Skip to content

Commit

Permalink
Merge pull request #44 from AdebayoBraimah/dev5
Browse files Browse the repository at this point in the history
Dev5
  • Loading branch information
AdebayoBraimah committed Jun 25, 2021
2 parents 39758d6 + 641a44f commit c178cee
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
CHANGES
=========

0.2.0a12
---------

This version is an alpha release that contains several bug fixes and updates.

* BUG FIX: Fixed bug in which if a singular b-value was read from a b-value text file, then errors would be thrown.
* BUG FIX: Fixed bug in which unprocessed source data was not converted to BIDS NIFTI data.

0.2.0a11
---------

Expand Down
3 changes: 2 additions & 1 deletion convert_source/cs_utils/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,8 @@ def query_db(database:str,
"""Database query wrapper function that writes and performs a query for some provided value.
NOTE:
The SQL query performed in this function assumes that the value is of datatype ``TEXT``.
* The SQL query performed in this function assumes that the value is of datatype ``TEXT``.
* If ``column`` is not provided, then it is assumed that ``table`` and ``column`` share the same name.
Usage example:
>>> sub_id = query_db(database='file.db',
Expand Down
20 changes: 17 additions & 3 deletions convert_source/cs_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,16 @@ def get_bvals(bval_file: Optional[str] = ""
if bval_file and os.path.exists(bval_file):
bval_file: str = os.path.abspath(bval_file)
vals = np.loadtxt(bval_file)
vals_int = [ int(i) for i in vals ]
vals_nonzero = [ i for i in vals_int if i != 0 ]

# NOTE: This try-except statement is here for situtions
# in which a singular b-value is found in the b-value
# text file.
try:
vals_int: List[int] = [ int(i) for i in vals ]
except TypeError:
vals_int: List[int] = [ int(vals) ]

vals_nonzero: List[int] = [ i for i in vals_int if i != 0 ]
bvals: List[float] = list(np.unique(vals_nonzero))
return [ int(i) for i in bvals ]
else:
Expand Down Expand Up @@ -1142,7 +1150,13 @@ def collect_info(parent_dir: str,
prim_key='rel_path',
column='file_id',
value=db_info.get('rel_path',''))
if file_id:

bids_name: str = query_db(database=database,
table='bids_name',
prim_key='file_id',
value=file_id)

if file_id and bids_name:
if log:
log.log("Imaging data has already been processed and is stored in the database.")
else:
Expand Down
2 changes: 1 addition & 1 deletion convert_source/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0a11
0.2.0a12

0 comments on commit c178cee

Please sign in to comment.