Skip to content
Closed
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
21 changes: 13 additions & 8 deletions pypet2bids/pypet2bids/dcm2niix4pet.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def run_dcm2niix(self):
self.tempdir_location = tempdir_pathlike
# people use screwy paths, we do this before running dcm2niix to account for that
image_folder = helper_functions.sanitize_bad_path(self.image_folder)
cmd = f"{self.dcm2niix_path} -b y -w 1 -z y {file_format_args} -o {tempdir_pathlike} {image_folder}"
cmd = f"{self.dcm2niix_path} -b y -m Y -w 1 -z y -s y {file_format_args} -o {tempdir_pathlike} {image_folder}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, sure I think this is fine as it passes on the phantoms and the other CI. I'm still not certain what it is that -s is doing:

-s : single file mode, do not convert other images in folder (y/n, default n)

But again, it's not affecting our CI so I'm pretty okay with it.

convert = subprocess.run(cmd, shell=True, capture_output=True)
self.telemetry_data["dcm2niix"] = {
"returncode": convert.returncode,
Expand Down Expand Up @@ -671,13 +671,18 @@ def run_dcm2niix(self):
else:
# collect filter size
recon_filter_size = ""
if re.search(
r"\d+.\d+", sidecar_json.get("ConvolutionKernel")
):
recon_filter_size = re.search(
r"\d+.\d*", sidecar_json.get("ConvolutionKernel")
)[0]
recon_filter_size = float(recon_filter_size)
if re.search(r"\d+.\d+", sidecar_json.get("ConvolutionKernel")):
try:
recon_filter_size = re.search(
r"\d+.\d*", sidecar_json.get("ConvolutionKernel")
)[0]
recon_filter_size = float(recon_filter_size)
except ValueError:
# If float conversion fails, try splitting and take first part
match_str = re.search(
r"\d+.\d*", sidecar_json.get("ConvolutionKernel")
)[0]
recon_filter_size = float(match_str.split()[0])
sidecar_json.update(
{"ReconFilterSize": float(recon_filter_size)}
)
Expand Down
Loading