diff --git a/requirements.txt b/requirements.txt index 2e1ab40..b5d31c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/voluba_mriwarp/logic.py b/voluba_mriwarp/logic.py index 093d156..d7e9290 100644 --- a/voluba_mriwarp/logic.py +++ b/voluba_mriwarp/logic.py @@ -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': @@ -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) diff --git a/voluba_mriwarp/reports.py b/voluba_mriwarp/reports.py index 27192b0..2e9cdc8 100644 --- a/voluba_mriwarp/reports.py +++ b/voluba_mriwarp/reports.py @@ -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 @@ -94,7 +96,7 @@ 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 @@ -102,6 +104,7 @@ def create_report( :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 @@ -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): @@ -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 @@ -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( @@ -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.',