Skip to content

Commit

Permalink
Merge pull request #43 from AdebayoBraimah/dev5
Browse files Browse the repository at this point in the history
Dev5
  • Loading branch information
AdebayoBraimah authored Jun 25, 2021
2 parents 1c14d46 + 47de03f commit 39758d6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 22 deletions.
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
CHANGES
=========

0.2.0a11
---------

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

* BUG FIX: Fixed bug in which DICOM header scan technique could not be read, and would thus throw exceptions. This now handled more gracefully.

0.2.0a10
---------

Expand Down
45 changes: 24 additions & 21 deletions convert_source/cs_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1566,36 +1566,39 @@ def get_dcm_scan_tech(dcm_file: str,
dcm_fields: List[str] = ['SeriesDescription', 'ImageType', 'ProtocolName']

for dcm_field in dcm_fields:
try:
dcm_scan_tech_str: str = str(eval(f"ds.{dcm_field}")) # This makes me dangerously uncomfortable
except AttributeError:
dcm_scan_tech_str: str = ""

# Use dictionary to search in string
for i in search_arr:
if mod_found:
break
for k,v in i.items():
if depth(i) == 3:
for k2,v2 in v.items():
# Use dictionary to search in string
for i in search_arr:
if mod_found:
break
for k,v in i.items():
if depth(i) == 3:
for k2,v2 in v.items():
mod_type: str = k
mod_label: str = k2
mod_task: str = ""
mod_search: List[str] = v2
if list_in_substr(in_list=mod_search,in_str=dcm_scan_tech_str):
mod_found: bool = True
modality_type: str = mod_type
modality_label: str = mod_label
task: str = mod_task
elif depth(i) == 4:
for k2,v2 in v.items():
for k3,v3 in v2.items():
mod_type: str = k
mod_label: str = k2
mod_task: str = ""
mod_search: List[str] = v2
mod_task: str = k3
mod_search: List[str] = v3
if list_in_substr(in_list=mod_search,in_str=dcm_scan_tech_str):
mod_found: bool = True
modality_type: str = mod_type
modality_label: str = mod_label
task: str = mod_task
elif depth(i) == 4:
for k2,v2 in v.items():
for k3,v3 in v2.items():
mod_type: str = k
mod_label: str = k2
mod_task: str = k3
mod_search: List[str] = v3
if list_in_substr(in_list=mod_search,in_str=dcm_scan_tech_str):
mod_found: bool = True
modality_type: str = mod_type
modality_label: str = mod_label
task: str = mod_task

return (modality_type,
modality_label,
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.0a10
0.2.0a11

0 comments on commit 39758d6

Please sign in to comment.