Skip to content

Commit

Permalink
Merge branch 'develop' into documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JThoennissen committed Jul 14, 2023
2 parents 30e2898 + a1b7694 commit 2770b91
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
git+https://github.com/MIC-DKFZ/HD-BET.git#egg=HD-BET
git+https://github.com/JThoennissen/siibra-explorer-toolsuite.git#egg=siibra-explorer-toolsuite
git+https://github.com/JThoennissen/siibra-explorer-toolsuite.git@v0.0.1#egg=siibra-explorer-toolsuite
siibra==0.4a59
tkfontawesome==0.2.0
matplotlib==3.7.2
Expand Down
2 changes: 2 additions & 0 deletions voluba_mriwarp/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ def export_assignments(
report = AssignmentReport(
parcellation=self.__parcellation, filter=filter,
progress=progress_indicator)
filename = os.path.basename(self.__in_path)

# Transfer points to siibra.Point objects.
if self.__image_type == 'unaligned':
Expand All @@ -602,5 +603,6 @@ def export_assignments(
subject_points=self.__saved_points,
mni_points=mni_points, labels=labels,
image=self.__nifti_image, features=features,
image_filename=filename,
receptors=receptors, cohorts=cohorts,
output_file=output_file)
13 changes: 8 additions & 5 deletions voluba_mriwarp/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def _filter_assignments(self, initial_assignments):
"""
mapping = {
'<': lambda column, value: column < value,
'<=': lambda column, value: column < value,
'>': lambda column, value: column > value,
'>=': lambda column, value: column > value,
'=': lambda column, value: column == value
}
column, sign, value = self.filter
Expand All @@ -94,14 +96,15 @@ def _filter_assignments(self, initial_assignments):

def create_report(
self, assignments, subject_points, mni_points, labels, image,
features, receptors, cohorts, output_file):
image_filename, features, receptors, cohorts, output_file):
"""Create a PDF report of assigned regions and linked features.
:param list assignments: region assignments for multiple points
:param list subject_points: points in subject's physical space
:param list mni_points: points in MNI152 space
:param list labels: labels for each point
:param nibabel.Nifti1Image image: input image
:param str image_filename: filename of the input image
:param list features: linked features to export for each region
:param list receptors: receptors to plot a ReceptorDensityProfile for
:param list cohorts: cohorts to plot connectivity plots for
Expand Down Expand Up @@ -156,7 +159,7 @@ def create_report(
# Build the PDF report.
self._build_pdf(
assignments, input_plot, pmap_plots, feature_plots, labels,
subject_points, mni_points, image, output_file)
subject_points, mni_points, image_filename, output_file)
matplotlib.use(backend)

def _plot_input(self, image):
Expand Down Expand Up @@ -276,7 +279,7 @@ def __plot_features(self, region, feature, selected_receptors, cohorts):

def _build_pdf(
self, assignments, input_plot, pmap_plots, feature_plots, labels,
subject_points, mni_points, image, output_file):
subject_points, mni_points, image_filename, output_file):
"""Actually create a PDF report of assigned regions and linked features.
:param list assignments: region assignments for multiple points
Expand All @@ -286,7 +289,7 @@ def _build_pdf(
:param list labels: labels for each point
:param list subject_points: points in subject's physical space
:param list mni_points: points in MNI152 space
:param nibabel.Nifti1Image image: input image
:param str image_filename: filename of the input image
:param str output_file: PDF file to export report to
"""
logging.getLogger(mriwarp_name).info(
Expand All @@ -308,7 +311,7 @@ def _build_pdf(
pdf.set_xy(left, top + 14)
pdf.multi_cell(
0, text_height, '\n'.join(
[f'Input scan: {os.path.basename(image.get_filename())}',
[f'Input scan: {image_filename}',
f'Parcellation: {self.pmaps.parcellation.name}', ' ',
f'For each point, regions with {self.filter[0]} '
f'{self.filter[1]} {self.filter[2]} are assigned.',
Expand Down

0 comments on commit 2770b91

Please sign in to comment.