Skip to content

Commit 4c4560c

Browse files
committed
Minor tweaks
1 parent 16117af commit 4c4560c

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

bidscoin/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
__version__ = tomllib.load(fid)['project']['version']
4242

4343
# Add license metadata
44-
__license__ = 'GNU General Public License v3 or later (GPLv3+)'
44+
__license__ = 'GNU General Public License v3.0 or later (GPLv3+)'
4545
__copyright__ = f"2018-{datetime.date.today().year}, Marcel Zwiers"
4646
__disclaimer__ = """\
4747
This module and all modules in this package are part of BIDScoin (https://github.com/Donders-Institute/bidscoin).

bidscoin/bcoin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ def test_bidscoin(bidsmapfile: Union[Path,dict], options: dict=None, testplugins
537537
except ModuleNotFoundError:
538538
pass
539539

540-
# Show an overview of the bidscoin tools. TODO: test the entry points?
540+
# Show an overview of the bidscoin tools
541541
list_executables(True)
542542

543543
# Test the plugins

bidscoin/bids.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,7 @@ def get_dicomfield(tagname: str, dicomfile: Path) -> Union[str, int]:
627627

628628
if find_spec('dicom_parser'):
629629
from dicom_parser import Image
630-
631-
LOGGER.bcdebug(f"Parsing {tagname} using `dicom_parser`")
630+
LOGGER.bcdebug(f"Parsing {tagname} from the CSA header using `dicom_parser`")
632631
for csa in ('CSASeriesHeaderInfo', 'CSAImageHeaderInfo'):
633632
value = value if (value or value==0) else Image(dicomfile).header.get(csa)
634633
for csatag in tagname.split('.'): # E.g. CSA tagname = 'SliceArray.Slice.instance_number.Position.Tra'
@@ -640,8 +639,7 @@ def get_dicomfield(tagname: str, dicomfile: Path) -> Union[str, int]:
640639
value = str(value or '')
641640

642641
else:
643-
644-
LOGGER.bcdebug(f"Parsing {tagname} using `nibabel`")
642+
LOGGER.bcdebug(f"Parsing {tagname} from the CSA header using `nibabel`")
645643
for modality in ('Series', 'Image'):
646644
value = value if (value or value==0) else csareader.get_csa_header(dicomdata, modality)['tags']
647645
for csatag in tagname.split('.'): # NB: Currently MrPhoenixProtocol is not supported
@@ -902,7 +900,7 @@ def get_p7field(tagname: str, p7file: Path) -> Union[str, int]:
902900
return str(value) # If it's a MultiValue type then flatten it
903901

904902

905-
# ---------------- All function below this point are bidsmap related. TODO: make a class out of them -------------------
903+
# TODO: A number of functions below this point are bidsmap related. Make a class out of them
906904

907905

908906
def load_bidsmap(yamlfile: Path=Path(), folder: Path=templatefolder, plugins:Iterable[Union[Path,str]]=(), checks: Tuple[bool, bool, bool]=(True, True, True)) -> Tuple[Bidsmap, Path]:

bidscoin/bidseditor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ def show_contextmenu(self, pos):
193193
rowindex = [index.row() for index in table.selectedIndexes() if index.column() == colindex]
194194
if colindex in (-1, 0, 4): # User clicked the index, the edit-button or elsewhere (i.e. not on an activated widget)
195195
return
196-
runs = []
197-
subid = []
198-
sesid = []
196+
runs = []
197+
subid = []
198+
sesid = []
199199
for index in rowindex:
200200
datatype = table.item(index, 2).text()
201201
provenance = table.item(index, 5).text()
@@ -216,7 +216,7 @@ def show_contextmenu(self, pos):
216216

217217
if action == delete:
218218
answer = QMessageBox.question(self, f"Remove {dataformat} mapping",
219-
f'Only delete mappings for obsolete data (unless you are an expert user). Do you really want to remove this mapping"?',
219+
'Only delete mappings for obsolete data (unless you are an expert user). Do you want to continue?',
220220
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.Cancel, QMessageBox.StandardButton.Cancel)
221221
if answer == QMessageBox.StandardButton.Yes:
222222
for index in rowindex:

bidscoin/plugins/dcm2niix2bids.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,10 @@ def bidscoiner_plugin(session: Path, bidsmap: Bidsmap, bidsses: Path) -> Union[N
380380
# Strip each dcm2niix postfix and assign it to the proper bids entity in the new bidsname (else assign it to the fallback entity)
381381
ext = ''.join(dcm2niixfile.suffixes)
382382
postfixes = dcm2niixfile.name.split(bidsname)[1].rsplit(ext)[0].split('_')[1:]
383-
newbidsname = bids.insert_bidskeyval(dcm2niixfile.name, 'run', runindex, ignore) # Restart the run-index. NB: Unlike bidsname, newbidsname has a file extension
383+
newbidsname = bids.insert_bidskeyval(dcm2niixfile.name, 'run', runindex, ignore) # Restart the run-index. NB: Unlike bidsname, newbidsname has a file extension
384384
for postfix in postfixes:
385385

386-
# Patch the echo entity in the newbidsname with the dcm2niix echo info # NB: We can't rely on the bids-entity info here because manufacturers can e.g. put multiple echos in one series / run-folder
386+
# Patch the echo entity in the newbidsname with the dcm2niix echo info # NB: We can't rely on the bids-entity info here because manufacturers can e.g. put multiple echos in one series / run-folder
387387
if 'echo' in run['bids'] and postfix.startswith('e'):
388388
echonr = f"_{postfix}".replace('_e','') # E.g. postfix='e1'
389389
if not echonr:
@@ -393,10 +393,10 @@ def bidscoiner_plugin(session: Path, bidsmap: Bidsmap, bidsses: Path) -> Union[N
393393
elif echonr[0:-1].isdecimal():
394394
LOGGER.verbose(f"Splitting off echo-number {echonr[0:-1]} from the '{postfix}' postfix")
395395
newbidsname = bids.insert_bidskeyval(newbidsname, 'echo', echonr[0:-1].lstrip('0'), ignore) # Strip of the 'a', 'b', etc. from `e1a`, `e1b`, etc
396-
newbidsname = bids.get_bidsvalue(newbidsname, fallback, echonr[-1]) # Append the 'a' to the fallback-label
396+
newbidsname = bids.get_bidsvalue(newbidsname, fallback, echonr[-1]) # Append the 'a' to the fallback-label
397397
else:
398398
LOGGER.error(f"Unexpected postix '{postfix}' found in {dcm2niixfile}")
399-
newbidsname = bids.get_bidsvalue(newbidsname, fallback, postfix) # Append the unknown postfix to the fallback-label
399+
newbidsname = bids.get_bidsvalue(newbidsname, fallback, postfix) # Append the unknown postfix to the fallback-label
400400

401401
# Patch the phase entity in the newbidsname with the dcm2niix mag/phase info
402402
elif 'part' in run['bids'] and postfix in ('ph','real','imaginary'): # e.g. part: ['', 'mag', 'phase', 'real', 'imag', 0]

0 commit comments

Comments
 (0)