Skip to content

Commit

Permalink
Minor tweaks and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelzwiers committed Feb 4, 2025
1 parent bbf24a3 commit 09adde8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
3 changes: 0 additions & 3 deletions bidscoin/bcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,6 @@ def test_bidscoin(bidsmapfile, options: dict=None, testplugins: bool=True, testg
success = True
if isinstance(bidsmapfile, (str, Path)):
bidsmapfile = Path(bidsmapfile)
if not bidsmapfile.is_file():
LOGGER.info(f"Cannot find bidsmap-file: {bidsmapfile}")
return 1
LOGGER.info(f"Running bidsmap checks:")
try: # Moving the import to the top of this module will cause circular import issues
from bidscoin import bids
Expand Down
2 changes: 1 addition & 1 deletion bidscoin/bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -1919,7 +1919,7 @@ def addmetadata(bidsses: Path):
for part in intendedfor:
pattern = part.split(':',1)[0].strip() # part = 'pattern: [lowerlimit:upperlimit]'
limits = part.split(':',1)[1].strip() if ':' in part else ''
matches = [niifile.relative_to(bidsses).as_posix() for niifile in sorted(bidsses.rglob(f"*{pattern}*")) if pattern and '.nii' in niifile.suffixes]
matches = [niifile.relative_to(bidsses).as_posix() for niifile in sorted(bidsses.rglob(f"*{pattern.strip('*')}*")) if pattern and '.nii' in niifile.suffixes]
limitmatches(fmap, matches, limits, niifiles, scans_table)

# Add the IntendedFor data. NB: The BIDS URI paths need to use forward slashes and be relative to the bids root folder
Expand Down
2 changes: 1 addition & 1 deletion bidscoin/bidscoiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def bidscoiner(sourcefolder: str, bidsfolder: str, participant: list=(), force:
has_run = False
for datatype in lsdirs(bidssession): # See what datatypes we already have in the bids session-folder
if next(datatype.iterdir(), None) and datatype.name in bidsmap.dataformat(datasource.dataformat).datatypes: # See if the plugin may add data for this datatype
LOGGER.info(f">>> Skipping processed session: {bidssession} already has {datatype.name} data (you can carefully use the -f option to overrule)")
LOGGER.info(f">>> Skipping {name} processing: {bidssession} already has {datatype.name} data (you can carefully use the -f option to overrule)")
has_run = True
if has_run:
continue
Expand Down
16 changes: 9 additions & 7 deletions bidscoin/bidseditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ def __init__(self, runitem: RunItem, bidsmap: BidsMap, template_bidsmap: BidsMap
self.dataformat = runitem.dataformat
"""The data format of the run-item being edited (bidsmap[dataformat][datatype][run-item])"""
self.unknowndatatypes: list[str] = [datatype for datatype in bidsmap.options['unknowntypes'] if datatype in template_bidsmap.dataformat(self.dataformat).datatypes]
self.ignoredatatypes: list[str] = [datatype for datatype in bidsmap.options['ignoretypes'] if datatype in template_bidsmap.dataformat(self.dataformat).datatypes]
self.ignoredatatypes: list[str] = [datatype for datatype in bidsmap.options['ignoretypes'] if datatype in template_bidsmap.dataformat(self.dataformat).datatypes]
self.bidsdatatypes = [str(datatype) for datatype in template_bidsmap.dataformat(self.dataformat).datatypes if datatype not in self.unknowndatatypes + self.ignoredatatypes]
self.bidsignore = bidsmap.options['bidsignore']
self.output_bidsmap = bidsmap
Expand Down Expand Up @@ -1997,10 +1997,11 @@ def __init__(self, runitems: list[RunItem], subid: list[str], sesid: list[str]):
bids_table.setToolTip('The BIDS entity that is used to construct the BIDS output filename')

# Set up the meta table
meta_label = QLabel('Metadata')
meta_label.setToolTip('Key-value pairs that will be appended to the (e.g. dcm2niix-produced) json sidecar file')
meta_table = self.fill_table(meta_data, 'meta', minsize=False)
meta_table.setToolTip('The key-value pair that will be appended to the (e.g. dcm2niix-produced) json sidecar file')
if meta_data:
meta_label = QLabel('Metadata')
meta_label.setToolTip('Key-value pairs that will be appended to the (e.g. dcm2niix-produced) json sidecar file')
meta_table = self.fill_table(meta_data, 'meta', minsize=False)
meta_table.setToolTip('The key-value pair that will be appended to the (e.g. dcm2niix-produced) json sidecar file')

# Set up the events table
if events_data:
Expand All @@ -2018,8 +2019,9 @@ def __init__(self, runitems: list[RunItem], subid: list[str], sesid: list[str]):
layout.addWidget(attributes_table)
layout.addWidget(bids_label)
layout.addWidget(bids_table)
layout.addWidget(meta_label)
layout.addWidget(meta_table)
if meta_data:
layout.addWidget(meta_label)
layout.addWidget(meta_table)
if events_data:
layout.addWidget(events_label)
layout.addWidget(events_table)
Expand Down

0 comments on commit 09adde8

Please sign in to comment.