Skip to content

Commit

Permalink
Improved check for processed data / revert commit #1f1fa7903911b92e39…
Browse files Browse the repository at this point in the history
…b6c4ddd5bc28402d0decd9 (GitHub issue #243)
  • Loading branch information
marcelzwiers committed Feb 4, 2025
1 parent a63a87a commit 0a1686d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bidscoin/bidscoiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ def bidscoiner(sourcefolder: str, bidsfolder: str, participant: list=(), force:
subid, sesid = datasource.subid_sesid(subid, sesid or '')
bidssession = bidsfolder/subid/sesid # TODO: Support DICOMDIR with multiple subjects (as in PYDICOMDIR)
if not force and bidssession.is_dir():
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 {name} processing: {bidssession} already has {datatype.name} data (you can carefully use the -f option to overrule)")
has_run = True
if has_run:
datatypes = set()
for datatype in [dtype for dtype in lsdirs(bidssession) if next(dtype.iterdir(), None)]: # See what non-empty datatypes we already have in the bids session-folder
if datatype.name in bidsmap.dataformat(datasource.dataformat).datatypes: # See if the plugin may add data for this datatype
datatypes.add(datatype.name)
if datatypes:
LOGGER.info(f">>> Skipping {name} processing: {bidssession} already has {datatypes} data (you can carefully use the -f option to overrule)")
continue

LOGGER.info(f">>> Coining {name} datasources in: {sesfolder}")
Expand Down

0 comments on commit 0a1686d

Please sign in to comment.