Skip to content

Commit 0a1686d

Browse files
committed
Improved check for processed data / revert commit #1f1fa7903911b92e39b6c4ddd5bc28402d0decd9 (GitHub issue #243)
1 parent a63a87a commit 0a1686d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

bidscoin/bidscoiner.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,12 @@ def bidscoiner(sourcefolder: str, bidsfolder: str, participant: list=(), force:
275275
subid, sesid = datasource.subid_sesid(subid, sesid or '')
276276
bidssession = bidsfolder/subid/sesid # TODO: Support DICOMDIR with multiple subjects (as in PYDICOMDIR)
277277
if not force and bidssession.is_dir():
278-
has_run = False
279-
for datatype in lsdirs(bidssession): # See what datatypes we already have in the bids session-folder
280-
if next(datatype.iterdir(), None) and datatype.name in bidsmap.dataformat(datasource.dataformat).datatypes: # See if the plugin may add data for this datatype
281-
LOGGER.info(f">>> Skipping {name} processing: {bidssession} already has {datatype.name} data (you can carefully use the -f option to overrule)")
282-
has_run = True
283-
if has_run:
278+
datatypes = set()
279+
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
280+
if datatype.name in bidsmap.dataformat(datasource.dataformat).datatypes: # See if the plugin may add data for this datatype
281+
datatypes.add(datatype.name)
282+
if datatypes:
283+
LOGGER.info(f">>> Skipping {name} processing: {bidssession} already has {datatypes} data (you can carefully use the -f option to overrule)")
284284
continue
285285

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

0 commit comments

Comments
 (0)