Commit 49584a7572b4c2642930318f3cc0a4506f767bac
1 parent
86e4d5cd
Exists in
master
and in
68 other branches
ENH: Import panel - ordering and selection (still working)
Showing
2 changed files
with
16 additions
and
8 deletions
Show diff stats
invesalius/gui/import_panel.py
... | ... | @@ -57,7 +57,7 @@ class TextPanel(wx.Panel): |
57 | 57 | | wx.TR_ROW_LINES |
58 | 58 | | wx.TR_COLUMN_LINES |
59 | 59 | | wx.TR_FULL_ROW_HIGHLIGHT |
60 | - | wx.TR_FULL_ROW_HIGHLIGHT | |
60 | + | wx.TR_SINGLE | |
61 | 61 | ) |
62 | 62 | |
63 | 63 | |
... | ... | @@ -87,7 +87,6 @@ class TextPanel(wx.Panel): |
87 | 87 | tree.SetColumnWidth(9, 100) # Date of birth |
88 | 88 | tree.SetColumnWidth(10, 140) # Accession Number |
89 | 89 | tree.SetColumnWidth(11, 160) # Referring physician |
90 | - | |
91 | 90 | |
92 | 91 | self.root = tree.AddRoot("InVesalius Database") |
93 | 92 | self.tree = tree |
... | ... | @@ -103,6 +102,7 @@ class TextPanel(wx.Panel): |
103 | 102 | dicom.acquisition.time) |
104 | 103 | |
105 | 104 | parent = tree.AppendItem(self.root, title) |
105 | + | |
106 | 106 | tree.SetItemText(parent, str(dicom.patient.id), 1) |
107 | 107 | tree.SetItemText(parent, str(dicom.patient.age), 2) |
108 | 108 | tree.SetItemText(parent, str(dicom.patient.gender), 3) |
... | ... | @@ -118,11 +118,11 @@ class TextPanel(wx.Panel): |
118 | 118 | group_list = patient.GetGroups() |
119 | 119 | for group in group_list: |
120 | 120 | dicom = group.GetDicomSample() |
121 | - group_title = dicom.acquisition.series_description | |
122 | 121 | |
123 | - child = self.tree.AppendItem(parent, group_title) | |
122 | + child = tree.AppendItem(parent, group.title) | |
123 | + tree.SetItemPyData(child, group) | |
124 | 124 | |
125 | - tree.SetItemText(child, str(group_title), 0) | |
125 | + tree.SetItemText(child, str(group.title), 0) | |
126 | 126 | tree.SetItemText(child, str(dicom.acquisition.protocol_name), 4) |
127 | 127 | tree.SetItemText(child, str(dicom.acquisition.modality), 5) |
128 | 128 | tree.SetItemText(child, str(date_time), 6) |
... | ... | @@ -134,7 +134,9 @@ class TextPanel(wx.Panel): |
134 | 134 | tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate) |
135 | 135 | |
136 | 136 | def OnActivate(self, evt): |
137 | - print 'OnActivate: %s' % self.tree.GetItemText(evt.GetItem()) | |
137 | + print "OnActivate" | |
138 | + item = evt.GetItem() | |
139 | + print self.tree.GetItemPyData(item) | |
138 | 140 | |
139 | 141 | |
140 | 142 | def OnRightUp(self, evt): | ... | ... |
invesalius/reader/dicom_grouper.py
... | ... | @@ -61,6 +61,7 @@ class DicomGroup: |
61 | 61 | # dicom.acquisition.series_number, |
62 | 62 | # dicom.image.orientation_label, index) |
63 | 63 | self.key = () |
64 | + self.title = "" | |
64 | 65 | self.slices_dict = {} # slice_position: Dicom.dicom |
65 | 66 | # IDEA (13/10): Represent internally as dictionary, |
66 | 67 | # externally as list |
... | ... | @@ -143,8 +144,10 @@ class PatientGroup: |
143 | 144 | # Does this group exist? Best case ;) |
144 | 145 | if group_key not in self.groups_dict.keys(): |
145 | 146 | group = DicomGroup() |
146 | - self.ngroups += 1 | |
147 | + group.key = group_key | |
148 | + group.title = dicom.acquisition.series_description | |
147 | 149 | group.AddSlice(dicom) |
150 | + self.ngroups += 1 | |
148 | 151 | self.groups_dict[group_key] = group |
149 | 152 | # Group exists... Lets try to add slice |
150 | 153 | else: |
... | ... | @@ -177,7 +180,10 @@ class PatientGroup: |
177 | 180 | self.groups_dict = self.FixProblem1(self.groups_dict) |
178 | 181 | |
179 | 182 | def GetGroups(self): |
180 | - return self.groups_dict.values() | |
183 | + glist = self.groups_dict.values() | |
184 | + glist = sorted(glist, key = lambda group:group.title, | |
185 | + reverse=True) | |
186 | + return glist | |
181 | 187 | |
182 | 188 | def GetDicomSample(self): |
183 | 189 | return self.dicom | ... | ... |