Skip to content

Commit c0c43f3

Browse files
authored
Merge pull request #239 from ACRF-Image-X-Institute/report_names
Report names
2 parents 5d9753c + 92201a3 commit c0c43f3

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

mri_distortion_toolkit/Reports.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def _get_template(self):
558558

559559
# public methods
560560

561-
def write_html_report(self, output_folder=None):
561+
def write_html_report(self, output_folder=None, report_name=None):
562562
"""
563563
Generates a html report encompassing available acquisition information, test results, and intercative
564564
plotly figures
@@ -572,6 +572,11 @@ def write_html_report(self, output_folder=None):
572572
self.output_folder = Path(output_folder)
573573
self._set_up_directory_structure()
574574

575+
if report_name is None:
576+
report_name = 'MR_QA_report.html'
577+
else:
578+
report_name = str(Path(report_name).with_suffix('html'))
579+
575580
# save plots and update jinja_dict
576581

577582
distortion_v_r_save_name = self._unique_name_generator(self.output_folder / 'plots', 'distortion_v_r.html')
@@ -596,7 +601,7 @@ def write_html_report(self, output_folder=None):
596601
# set up template
597602
self._jinja_dict['html_theme_loc'] = self._html_theme
598603
j2_template = self._get_template()
599-
report_name = self._unique_name_generator(self.output_folder, 'MR_QA_report.html', rel_path=False)
604+
report_name = self._unique_name_generator(self.output_folder, report_name, rel_path=False)
600605
report_code = os.path.split(report_name)[1] # for printing
601606
report_code = os.path.splitext(report_code)[0]
602607
report_code = report_code.replace('MR_QA_report_','')

mri_distortion_toolkit/utilities.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,8 @@ def plot_compressed_MarkerVolumes(MarkerVolumeList, p_max=20, p_min=-20, title=N
721721

722722
fig, axs = plt.subplots(figsize=[8, 8], ncols=1, nrows=1)
723723
if not isinstance(MarkerVolumeList, list):
724-
MarkerVolumeList = [MarkerVolumeList]
724+
MarkerVolumeList = list(MarkerVolumeList)
725+
725726
if not projection_direction in ['x', 'y', 'z']:
726727
warnings.warn(f'projection direction must be "x", "y", or "z", not {projection_direction}.'
727728
f'setting to z and continuing')

0 commit comments

Comments
 (0)