Skip to content

Commit

Permalink
handle when no odfs are plotted
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcieslak committed Nov 20, 2024
1 parent f530697 commit b1645e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions qsirecon/cli/recon_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ def recon_plot():
sys.exit(1)

LOGGER.info(f"Saved odfs image to {odfs_png_file}")
else:
LOGGER.info("Not plotting ODFs.")

display.stop()
sys.exit(0)
Expand Down
15 changes: 10 additions & 5 deletions qsirecon/interfaces/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,10 @@ class _ReconPeaksReportInputSpec(CommandLineInputSpec):

XVFB_ERROR = """
ODF/Peak Plotting did not produce the expected outputs.
This could be due to how QSIRecon was run as a container.
ODF/Peak Plotting did not produce the expected output:
{}
This could be due to how QSIRecon was run as a container.
If you ran Singularity/Apptainer with --containall, please also use --writable-tmpfs
Expand All @@ -299,16 +300,20 @@ def _list_outputs(self):
outputs = self.output_spec().get()
workdir = Path(".")

# There will always be a peak report
peaks_file = workdir / self.inputs.peak_report
if not peaks_file.exists():
raise Exception(XVFB_ERROR)
raise Exception(XVFB_ERROR.format(peaks_file))
outputs["peak_report"] = str(peaks_file.absolute())
if self.inputs.peaks_only:

# If there will be no ODF report, we are done
if self.inputs.peaks_only or not isdefined(self.inputs.odf_rois):
return outputs

# Find the ODF report
odfs_file = workdir / self.inputs.odf_report
if not odfs_file.exists():
raise Exception(XVFB_ERROR)
raise Exception(XVFB_ERROR.format(odfs_file))
outputs["odf_report"] = str(odfs_file.absolute())

return outputs
Expand Down

0 comments on commit b1645e4

Please sign in to comment.