Skip to content

Commit 4b43775

Browse files
Merge pull request #24 from AdebayoBraimah/dev5
Dev5
2 parents 9e22017 + e063936 commit 4b43775

102 files changed

Lines changed: 153 additions & 24797 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ convert_source/*.ipynb
88
tests/img.test.dir/*
99
.vscode/*
1010
test.data/*
11-
deploy/*
11+
12+
# deploy/*
1213

1314
# Command to file al .DS_STOREs files:
1415
# find . -name ".DS_Store"

.readthedocs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
3+
python:
4+
version: 3.7
5+
install:
6+
- requirements: docs/requirements.txt
7+
- requirements: requirements.txt

CHANGES.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
CHANGES
22
=========
33

4+
v0.1.0
5+
---------
6+
7+
* BUG FIX: Fixed bug in setup, which prevented proper installation and usage of the ``study_proc`` executable.
8+
* UPDATE: The documentation is now `available <https://convert-source.readthedocs.io/en/master/>`_.
9+
410
v0.1.rc1
511
---------
612

713
* Includes ``setup.py`` file, in addition to be published on PyPI.
814
* Much improved documentation.
915

10-
v0.1.rc1alpha
16+
v0.1.rc1a
1117
--------------
1218

1319
Version: ``0.1 - release candidate 1 - alpha``

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Misc
22
include LICENSE
33
include CHANGES.rst
4+
include convert_source/version.txt
5+
include convert_source/config/*
46
exclude .circleci/config.yml

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![CircleCI](https://circleci.com/gh/AdebayoBraimah/convert_source.svg?style=svg)](https://app.circleci.com/pipelines/github/AdebayoBraimah/convert_source)
1+
[![CircleCI](https://circleci.com/gh/AdebayoBraimah/convert_source.svg?style=svg)](https://app.circleci.com/pipelines/github/AdebayoBraimah/convert_source) [![Documentation Status](https://readthedocs.org/projects/convert-source/badge/?version=latest)](https://convert-source.readthedocs.io/en/latest/?badge=latest)
22

33
# convert_source
44
Convert source `DICOM`, `PAR REC` or `NIFTI` image data to BIDS directory layout.

convert_source/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010

1111
_pkg_path: str = str(pathlib.Path(os.path.abspath(__file__)).parents[1])
1212
sys.path.append(_pkg_path)
13-
_version_file: str = os.path.abspath("version.txt")
13+
_version_file: str = os.path.abspath(
14+
os.path.join(
15+
os.path.dirname(__file__),
16+
"version.txt"
17+
)
18+
)
1419

1520
from convert_source.cs_utils.utils import file_to_screen
1621

convert_source/batch_convert.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"""
44

55
# TODO:
6-
# * [PENDING] Figure out where tmp directory path is being printed.
7-
# * See functions that use TmpDir class's rm_tmp_dir() function
6+
# * Add option for renaming identified unknown files
7+
# * Add file search for image files with no extensions (DICOMs)
88
# * Add doc building to CI workflow.
99
# * Replace triple single quotes (''') with triple double quotes (""")
1010

@@ -904,7 +904,7 @@ def source_to_bids(sub_data: SubDataInfo,
904904
append_dwi_info=append_dwi_info,
905905
zero_pad=zero_pad,
906906
cprss_lvl=cprss_lvl)
907-
tmp.rm_tmp_dir()
907+
_ = tmp.rm_tmp_dir()
908908
return (imgs,
909909
jsons,
910910
bvals,
@@ -929,7 +929,7 @@ def source_to_bids(sub_data: SubDataInfo,
929929
append_dwi_info=append_dwi_info,
930930
zero_pad=zero_pad,
931931
cprss_lvl=cprss_lvl)
932-
tmp.rm_tmp_dir()
932+
_ = tmp.rm_tmp_dir()
933933
return (imgs,
934934
jsons,
935935
bvals,
@@ -991,13 +991,13 @@ def source_to_bids(sub_data: SubDataInfo,
991991
else:
992992
bvecs.append("")
993993
# Clean-up
994-
tmp.rm_tmp_dir()
994+
_ = tmp.rm_tmp_dir()
995995
return (imgs,
996996
jsons,
997997
bvals,
998998
bvecs)
999999
except ConversionError:
1000-
tmp.rm_tmp_dir()
1000+
_ = tmp.rm_tmp_dir()
10011001
return [""],[""],[""],[""]
10021002

10031003
def nifti_to_bids(sub_data: SubDataInfo,
@@ -1075,7 +1075,7 @@ def nifti_to_bids(sub_data: SubDataInfo,
10751075

10761076
# Use TmpDir and NiiFile class context managers
10771077
with TmpDir(tmp_dir=sub_tmp, use_cwd=False) as tmp:
1078-
tmp.mk_tmp_dir()
1078+
_ = tmp.mk_tmp_dir()
10791079
with NiiFile(data) as n:
10801080
[path, basename, ext] = n.file_parts()
10811081
img_files: List[str] = glob.glob(os.path.join(path,basename + "*" + ext))
@@ -1129,7 +1129,11 @@ def nifti_to_bids(sub_data: SubDataInfo,
11291129
elif (not img_data.jsons[i]) and (i == 0):
11301130
json_dict: Dict = read_json(json_file="")
11311131

1132+
param_dict: Dict = get_data_params(file=data,
1133+
json_file=img_data.jsons[i])
1134+
11321135
metadata: Dict = dict_multi_update(dictionary=None, **meta_dict)
1136+
metadata: Dict = dict_multi_update(dictionary=metadata, **param_dict)
11331137
metadata: Dict = dict_multi_update(dictionary=metadata, **mod_dict)
11341138

11351139
bids_dict: Dict = construct_bids_dict(meta_dict=metadata,
@@ -1266,7 +1270,7 @@ def nifti_to_bids(sub_data: SubDataInfo,
12661270
bvals.append("")
12671271
bvecs.append("")
12681272
# Clean-up
1269-
tmp.rm_tmp_dir()
1273+
_ = tmp.rm_tmp_dir()
12701274

12711275
return (imgs,
12721276
jsons,
@@ -1398,7 +1402,7 @@ def bids_ignore(out_dir: str) -> str:
13981402
# Write to file using File class context manager
13991403
with File(new_file) as f:
14001404
f.write_txt(".misc \n")
1401-
f.write_txt("unknown \n")
1405+
f.write_txt("unknown/* \n")
14021406

14031407
return new_file
14041408

File renamed without changes.

0 commit comments

Comments
 (0)