From 2dbf1a08789df9bf3d302917822135a0332edfaf Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 10 Jun 2020 09:51:13 -0400 Subject: [PATCH] ENH: Refactor logic to allow direct use of load_suggested_landmarks function See #36 --- Q3DC/Q3DC.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Q3DC/Q3DC.py b/Q3DC/Q3DC.py index 4ce4675..2a9bc5a 100644 --- a/Q3DC/Q3DC.py +++ b/Q3DC/Q3DC.py @@ -95,7 +95,8 @@ def setup(self): self.ui.surfaceDeplacementCheckBox.connect('stateChanged(int)', self.onSurfaceDeplacementStateChanged) # --------------- anatomical legend -------------- - self.suggested_landmarks = self.logic.load_suggested_landmarks() + self.suggested_landmarks = self.logic.load_suggested_landmarks( + self.resourcePath('Data/base_fiducial_legend.csv')) self.anatomical_legend_space = self.ui.landmarkModifLayout self.anatomical_radio_buttons_layout = qt.QHBoxLayout() self.anatomical_legend_space.addLayout(self.anatomical_radio_buttons_layout) @@ -654,11 +655,9 @@ def __init__(self, interface): self.comboboxdict = dict() @staticmethod - def load_suggested_landmarks(): + def load_suggested_landmarks(filepath): suggested_landmarks = defaultdict(list) - suggestions_path = \ - Path(__file__).parent / 'Resources' / 'Data' / 'base_fiducial_legend.csv' - with suggestions_path.open(newline='') as suggestions_file: + with open(filepath, newline='') as suggestions_file: reader = csv.DictReader(suggestions_file) for row in reader: region = row['Region'].title()