Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions dcm2bids/dcm2niix_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import tarfile
import zipfile
from glob import glob
from pathlib import Path

from dcm2bids.utils.io import valid_path
from dcm2bids.utils.utils import DEFAULT, run_shell_command
Expand Down Expand Up @@ -153,8 +154,9 @@ def execute(self):
self.logger.info("Check log file for dcm2niix output\n")
else:
for dicomDir in self.dicom_dirs:
shutil.copytree(dicomDir, self.output_dir, dirs_exist_ok=True)
cmd = ['cp', '-r', dicomDir, self.output_dir]
self.logger.info("Running: %s", " ".join(str(item) for item in cmd))
for filepath in Path(dicomDir).rglob("*"):
if filepath.is_file():
shutil.copy(filepath, Path(self.output_dir / f"{Path(dicomDir).name}_{filepath.name}"), follow_symlinks=True)
self.logger.info("Copying NIFTI files/sidecars from: %s", dicomDir)

self.logger.info("Not running dcm2niix\n")
12 changes: 6 additions & 6 deletions dcm2bids/sidecar.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ def compare(name, pattern):
def compare_list(name, pattern):
try:
subResult = [
len(name) == len(pattern),
isinstance(pattern, list),
]
len(name) == len(pattern),
isinstance(pattern, list),
]
for subName, subPattern in zip(name, pattern):
subResult.append(compare(subName, subPattern))
except Exception:
Expand Down Expand Up @@ -436,8 +436,8 @@ def build_acquisitions(self, participant):
acquisitions.append(acq)

self.logger.info(
f"{acq.dstFile.replace(f'{acq.participant.prefix}-', '')}"
f" <- {sidecarName}")
f"{acq.dstFile.replace(f'{acq.participant.prefix}-', '')}"
f" <- {sidecarName}")

elif len(valid_descriptions) == 0:
self.logger.info(f"No Pairing <- {sidecarName}")
Expand Down Expand Up @@ -578,6 +578,6 @@ def duplicates(seq):
dup = dup[0:-1]

for runNum, acqInd in enumerate(dup):
runStr = templateDup.format(runNum+1)
runStr = templateDup.format(runNum + 1)
self.acquisitions[acqInd].custom_entities += runStr
self.acquisitions[acqInd].setDstFile()
Loading