Commit 523174cd750832c457cd24becc7346d619dc0f49
1 parent
9fbad510
Exists in
master
and in
6 other branches
ADD: Surface data and GUI integration
Showing
7 changed files
with
166 additions
and
121 deletions
Show diff stats
invesalius/data/surface.py
... | ... | @@ -18,6 +18,7 @@ class Surface(): |
18 | 18 | self.polydata = None |
19 | 19 | self.colour = None |
20 | 20 | self.transparency = const.SURFACE_TRANSPARENCY |
21 | + self.volume = 0 | |
21 | 22 | self.is_shown = 1 |
22 | 23 | self.name = const.SURFACE_NAME_PATTERN %(Surface.general_index+1) |
23 | 24 | |
... | ... | @@ -45,6 +46,9 @@ class SurfaceManager(): |
45 | 46 | ps.Publisher().subscribe(self.SetActorColour, |
46 | 47 | 'Set surface colour') |
47 | 48 | |
49 | + ps.Publisher().subscribe(self.OnChangeSurfaceName, 'Change surface name') | |
50 | + ps.Publisher().subscribe(self.OnShowSurface, 'Show surface') | |
51 | + | |
48 | 52 | def AddNewActor(self, pubsub_evt): |
49 | 53 | """ |
50 | 54 | Create surface actor, save into project and send it to viewer. |
... | ... | @@ -144,13 +148,10 @@ class SurfaceManager(): |
144 | 148 | filled_polydata.SetInput(polydata) |
145 | 149 | filled_polydata.SetHoleSize(500) |
146 | 150 | filled_polydata.AddObserver("ProgressEvent", lambda obj, evt: |
147 | - UpdateProgress(filled_polydata, | |
148 | - "Filling polydata...")) | |
151 | + UpdateProgress(filled_polydata, | |
152 | + "Filling polydata...")) | |
149 | 153 | polydata = filled_polydata.GetOutput() |
150 | 154 | |
151 | - print "Area: %f mm2" % pu.CalculateSurfaceArea(polydata) | |
152 | - print "Volume: %f mm3" % pu.CalculateSurfaceVolume(polydata) | |
153 | - | |
154 | 155 | # Orient normals from inside to outside |
155 | 156 | normals = vtk.vtkPolyDataNormals() |
156 | 157 | normals.SetInput(polydata) |
... | ... | @@ -183,6 +184,7 @@ class SurfaceManager(): |
183 | 184 | surface = Surface() |
184 | 185 | surface.colour = colour |
185 | 186 | surface.polydata = polydata |
187 | + | |
186 | 188 | |
187 | 189 | # Set actor colour and transparency |
188 | 190 | actor.GetProperty().SetColor(colour) |
... | ... | @@ -201,9 +203,17 @@ class SurfaceManager(): |
201 | 203 | ps.Publisher().sendMessage('Update status text in GUI', |
202 | 204 | "Surface created.") |
203 | 205 | |
206 | + # The following lines have to be here, otherwise all volumes disappear | |
207 | + measured_polydata = vtk.vtkMassProperties() | |
208 | + measured_polydata.SetInput(polydata) | |
209 | + volume = measured_polydata.GetVolume() | |
210 | + surface.volume = volume | |
211 | + | |
204 | 212 | ps.Publisher().sendMessage('Update surface info in GUI', |
205 | 213 | (surface.index, surface.name, |
206 | - surface.colour, surface.transparency)) | |
214 | + surface.colour, surface.volume, | |
215 | + surface.transparency)) | |
216 | + | |
207 | 217 | |
208 | 218 | def RemoveActor(self, index): |
209 | 219 | """ |
... | ... | @@ -216,6 +226,16 @@ class SurfaceManager(): |
216 | 226 | proj.surface_dict.pop(index) |
217 | 227 | |
218 | 228 | |
229 | + def OnChangeSurfaceName(self, pubsub_evt): | |
230 | + index, name = pubsub_evt.data | |
231 | + proj = Project() | |
232 | + proj.surface_dict[index].name = name | |
233 | + | |
234 | + def OnShowSurface(self, pubsub_evt): | |
235 | + index, value = pubsub_evt.data | |
236 | + print "OnShowSurface", index, value | |
237 | + self.ShowActor(index, value) | |
238 | + | |
219 | 239 | def ShowActor(self, index, value): |
220 | 240 | """ |
221 | 241 | Show or hide actor, according to given actor index and value. |
... | ... | @@ -224,6 +244,7 @@ class SurfaceManager(): |
224 | 244 | # Update value in project's surface_dict |
225 | 245 | proj = Project() |
226 | 246 | proj.surface_dict[index].is_shown = value |
247 | + ps.Publisher().sendMessage('Render volume viewer') | |
227 | 248 | |
228 | 249 | def SetActorTransparency(self, pubsub_evt): |
229 | 250 | """ | ... | ... |
invesalius/data/viewer_volume.py
... | ... | @@ -81,15 +81,16 @@ class Viewer(wx.Panel): |
81 | 81 | self.UpdateRender() |
82 | 82 | |
83 | 83 | def LoadActor(self, pubsub_evt): |
84 | + print "****** Load actor" | |
84 | 85 | actor = pubsub_evt.data |
85 | 86 | |
86 | 87 | ren = self.ren |
87 | 88 | ren.AddActor(actor) |
88 | 89 | ren.ResetCamera() |
89 | - ren.GetActiveCamera().Elevation(90) | |
90 | - ren.GetActiveCamera().SetViewUp(0, 0, 1) | |
90 | + #ren.GetActiveCamera().Elevation(90) | |
91 | + #ren.GetActiveCamera().SetViewUp(0, 0, 1) | |
91 | 92 | |
92 | - ren.GetActiveCamera().Dolly(1.5) | |
93 | + #ren.GetActiveCamera().Dolly(1.5) | |
93 | 94 | ren.ResetCameraClippingRange() |
94 | 95 | |
95 | 96 | self.iren.Render() | ... | ... |
invesalius/gui/data_notebook.py
... | ... | @@ -120,7 +120,6 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
120 | 120 | self.image_gray = Image.open("../icons/object_colour.jpg") |
121 | 121 | |
122 | 122 | def OnEditLabel(self, evt): |
123 | - print "Editing label", evt.GetIndex(), evt.GetLabel() | |
124 | 123 | ps.Publisher().sendMessage('Change mask name', (evt.GetIndex(), evt.GetLabel())) |
125 | 124 | evt.Skip() |
126 | 125 | |
... | ... | @@ -128,7 +127,6 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
128 | 127 | self.ToggleItem(evt.m_itemIndex) |
129 | 128 | |
130 | 129 | def OnCheckItem(self, index, flag): |
131 | - | |
132 | 130 | if flag: |
133 | 131 | for key in self.mask_list_index.keys(): |
134 | 132 | if key != index: |
... | ... | @@ -183,13 +181,6 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
183 | 181 | self.imagelist.Replace(image_index, image) |
184 | 182 | self.Refresh() |
185 | 183 | |
186 | - def Populate(self): | |
187 | - dict = ((0,"Mask 1", "(1000,4500)"), | |
188 | - (1,"Mask 2", "(2000, 4500)"), | |
189 | - (2,"Background","(0,4500)")) | |
190 | - for data in dict: | |
191 | - self.InsertNewItem(data[0], data[1], data[2]) | |
192 | - | |
193 | 184 | class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
194 | 185 | |
195 | 186 | def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, |
... | ... | @@ -205,65 +196,87 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
205 | 196 | self.__init_columns() |
206 | 197 | self.__init_image_list() |
207 | 198 | self.__init_evt() |
208 | - | |
199 | + self.__bind_events_wx() | |
209 | 200 | self.surface_list_index = {} |
210 | 201 | self.surface_bmp_idx_to_name = {} |
211 | 202 | |
212 | 203 | def __init_evt(self): |
213 | - self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) | |
214 | 204 | ps.Publisher().subscribe(self.AddSurface, |
215 | 205 | 'Update surface info in GUI') |
206 | + ps.Publisher().subscribe(self.EditSurfaceTransparency, | |
207 | + 'Set surface transparency') | |
208 | + ps.Publisher().subscribe(self.EditSurfaceColour, | |
209 | + 'Set surface colour') | |
210 | + | |
211 | + def __bind_events_wx(self): | |
212 | + self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) | |
213 | + self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEditLabel) | |
216 | 214 | |
217 | 215 | def __init_columns(self): |
218 | 216 | |
219 | 217 | self.InsertColumn(0, "", wx.LIST_FORMAT_CENTER) |
220 | 218 | self.InsertColumn(1, "Name") |
221 | - self.InsertColumn(2, "Transparency", wx.LIST_FORMAT_RIGHT) | |
219 | + self.InsertColumn(2, "Volume (mm3)") | |
220 | + self.InsertColumn(3, "Transparency", wx.LIST_FORMAT_RIGHT) | |
222 | 221 | |
223 | 222 | self.SetColumnWidth(0, 20) |
224 | - self.SetColumnWidth(1, 120) | |
225 | - self.SetColumnWidth(2, 90) | |
223 | + self.SetColumnWidth(1, 85) | |
224 | + self.SetColumnWidth(2, 85) | |
225 | + self.SetColumnWidth(3, 80) | |
226 | 226 | |
227 | 227 | def __init_image_list(self): |
228 | 228 | self.imagelist = wx.ImageList(16, 16) |
229 | 229 | |
230 | - image = wx.Image("../icons//object_visible.jpg") | |
230 | + image = wx.Image("../icons/object_invisible.jpg") | |
231 | 231 | bitmap = wx.BitmapFromImage(image.Scale(16, 16)) |
232 | 232 | bitmap.SetWidth(16) |
233 | 233 | bitmap.SetHeight(16) |
234 | - img_check = self.imagelist.Add(bitmap) | |
235 | - | |
236 | - image = wx.Image("../icons/object_invisible.jpg") | |
234 | + img_null = self.imagelist.Add(bitmap) | |
235 | + | |
236 | + image = wx.Image("../icons//object_visible.jpg") | |
237 | 237 | bitmap = wx.BitmapFromImage(image.Scale(16, 16)) |
238 | 238 | bitmap.SetWidth(16) |
239 | 239 | bitmap.SetHeight(16) |
240 | - img_null = self.imagelist.Add(bitmap) | |
240 | + img_check = self.imagelist.Add(bitmap) | |
241 | 241 | |
242 | 242 | self.SetImageList(self.imagelist, wx.IMAGE_LIST_SMALL) |
243 | 243 | |
244 | 244 | self.image_gray = Image.open("../icons/object_colour.jpg") |
245 | 245 | |
246 | + | |
247 | + def OnEditLabel(self, evt): | |
248 | + ps.Publisher().sendMessage('Change surface name', (evt.GetIndex(), evt.GetLabel())) | |
249 | + evt.Skip() | |
250 | + | |
251 | + def OnItemActivated(self, evt): | |
252 | + self.ToggleItem(evt.m_itemIndex) | |
253 | + #ps.Publisher().sendMessage('Change surface selected',index) | |
254 | + | |
255 | + def OnCheckItem(self, index, flag): | |
256 | + ps.Publisher().sendMessage('Show surface', (index, flag)) | |
257 | + | |
246 | 258 | def AddSurface(self, pubsub_evt): |
247 | 259 | index = pubsub_evt.data[0] |
248 | 260 | name = pubsub_evt.data[1] |
249 | 261 | colour = pubsub_evt.data[2] |
250 | - transparency = "%d%%"%(int(100*pubsub_evt.data[3])) | |
262 | + volume = "%d"%(int(pubsub_evt.data[3])) | |
263 | + transparency = "%d%%"%(int(100*pubsub_evt.data[4])) | |
251 | 264 | |
252 | 265 | image = self.CreateColourBitmap(colour) |
253 | 266 | image_index = self.imagelist.Add(image) |
254 | 267 | self.surface_list_index[index] = image_index |
255 | 268 | |
256 | - self.InsertNewItem(index, name, str(transparency), colour) | |
269 | + self.InsertNewItem(index, name, volume, transparency, colour) | |
257 | 270 | |
258 | - def InsertNewItem(self, index=0, label="Surface 1", | |
259 | - transparency="(1000, 4500)", colour=None): | |
271 | + def InsertNewItem(self, index=0, label="Surface 1", volume="0 mm3", | |
272 | + transparency="0%%", colour=None): | |
260 | 273 | self.InsertStringItem(index, "") |
261 | 274 | self.SetStringItem(index, 1, label, |
262 | 275 | imageId = self.surface_list_index[index]) |
263 | - self.SetStringItem(index, 2, transparency) | |
276 | + self.SetStringItem(index, 2, volume) | |
277 | + self.SetStringItem(index, 3, transparency) | |
278 | + self.SetItemImage(index, 1) | |
264 | 279 | |
265 | - | |
266 | - | |
267 | 280 | def CreateColourBitmap(self, colour): |
268 | 281 | """ |
269 | 282 | Create a wx Image with a mask colour. |
... | ... | @@ -280,16 +293,27 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
280 | 293 | wx_image = wx.EmptyImage(new_image.size[0], |
281 | 294 | new_image.size[1]) |
282 | 295 | wx_image.SetData(new_image.tostring()) |
283 | - return wx.BitmapFromImage(wx_image.Scale(16, 16)) | |
284 | - | |
285 | - def OnItemActivated(self, evt): | |
286 | - self.ToggleItem(evt.m_itemIndex) | |
296 | + return wx.BitmapFromImage(wx_image.Scale(16, 16)) | |
297 | + | |
298 | + def EditSurfaceTransparency(self, pubsub_evt): | |
299 | + """ | |
300 | + Set actor transparency (oposite to opacity) according to given actor | |
301 | + index and value. | |
302 | + """ | |
303 | + index, value = pubsub_evt.data | |
304 | + print "EditSurfaceTransparency", index, value | |
305 | + self.SetStringItem(index, 3, "%d%%"%(int(value*100))) | |
287 | 306 | |
288 | - def OnCheckItem(self, index, flag): | |
289 | - ps.Publisher().sendMessage('Show surface', (index, not flag)) | |
307 | + def EditSurfaceColour(self, pubsub_evt): | |
308 | + """ | |
309 | + """ | |
310 | + index, colour = pubsub_evt.data | |
311 | + image = self.CreateColourBitmap(colour) | |
312 | + image_index = self.surface_list_index[index] | |
313 | + self.imagelist.Replace(image_index, image) | |
314 | + self.Refresh() | |
290 | 315 | |
291 | 316 | |
292 | - | |
293 | 317 | class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): |
294 | 318 | # TODO: Change edimixin to affect third column also |
295 | 319 | def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, | ... | ... |
invesalius/gui/frame.py
... | ... | @@ -27,14 +27,15 @@ import default_tasks as tasks |
27 | 27 | import default_viewers as viewers |
28 | 28 | |
29 | 29 | |
30 | -[ID_NEW, ID_OPEN, ID_FULLSCREEN] = [wx.NewId() for number in range(3)] | |
30 | + | |
31 | +[ID_FILE_IMPORT, ID_FILE_LOAD_INTERNET, ID_FILE_SAVE, ID_FILE_PRINT] = [wx.NewId() for number in range(4)] | |
31 | 32 | |
32 | 33 | class Frame(wx.Frame): |
33 | 34 | def __init__(self, prnt): |
34 | 35 | wx.Frame.__init__(self, id=-1, name='', parent=prnt, |
35 | 36 | pos=wx.Point(0, 0), |
36 | 37 | size=wx.Size(1024, 768), #size = wx.DisplaySize(), |
37 | - style=wx.DEFAULT_FRAME_STYLE, title='InVesalius 3.0') | |
38 | + style=wx.DEFAULT_FRAME_STYLE, title='InVesalius 3') | |
38 | 39 | self.Center(wx.BOTH) |
39 | 40 | self.SetIcon(wx.Icon("../icons/invesalius.ico", wx.BITMAP_TYPE_ICO)) |
40 | 41 | |
... | ... | @@ -84,17 +85,26 @@ class Frame(wx.Frame): |
84 | 85 | |
85 | 86 | # Add toolbars to manager |
86 | 87 | |
87 | - aui_manager.AddPane(ObjectToolBar(self), wx.aui.AuiPaneInfo(). | |
88 | + if sys.platform == 'win32': | |
89 | + t1 = ProjectToolBar(self) | |
90 | + t2 = LayoutToolBar(self) | |
91 | + t3 = ObjectToolBar(self) | |
92 | + else: | |
93 | + t3 = ProjectToolBar(self) | |
94 | + t2 = LayoutToolBar(self) | |
95 | + t1 = ObjectToolBar(self) | |
96 | + | |
97 | + aui_manager.AddPane(t1, wx.aui.AuiPaneInfo(). | |
88 | 98 | Name("General Features Toolbar"). |
89 | 99 | ToolbarPane().Top().Floatable(False). |
90 | 100 | LeftDockable(False).RightDockable(False)) |
91 | 101 | |
92 | - #aui_manager.AddPane(LayoutToolBar(self), wx.aui.AuiPaneInfo(). | |
93 | - # Name("Layout Toolbar"). | |
94 | - # ToolbarPane().Top().Floatable(False). | |
95 | - # LeftDockable(False).RightDockable(False)) | |
102 | + aui_manager.AddPane(t2, wx.aui.AuiPaneInfo(). | |
103 | + Name("Layout Toolbar"). | |
104 | + ToolbarPane().Top().Floatable(False). | |
105 | + LeftDockable(False).RightDockable(False)) | |
96 | 106 | |
97 | - aui_manager.AddPane(ProjectToolBar(self), wx.aui.AuiPaneInfo(). | |
107 | + aui_manager.AddPane(t3, wx.aui.AuiPaneInfo(). | |
98 | 108 | Name("Project Toolbar"). |
99 | 109 | ToolbarPane().Top().Floatable(False). |
100 | 110 | LeftDockable(False).RightDockable(False)) |
... | ... | @@ -137,12 +147,11 @@ class MenuBar(wx.MenuBar): |
137 | 147 | def __init_items(self): |
138 | 148 | |
139 | 149 | file_menu = wx.Menu() |
140 | - file_menu.Append(ID_NEW, "New") | |
141 | - file_menu.Append(ID_OPEN, "Open") | |
142 | - file_menu.Append(wx.ID_EXIT, "Exit") | |
150 | + file_menu.Append(ID_FILE_IMPORT, "Import...") | |
151 | + file_menu.Append(101, "Exit") | |
143 | 152 | |
144 | 153 | view_menu = wx.Menu() |
145 | - view_menu.Append(ID_FULLSCREEN, "Fullscreen") | |
154 | + view_menu.Append(101, "Fullscreen") | |
146 | 155 | |
147 | 156 | tools_menu = wx.Menu() |
148 | 157 | |
... | ... | @@ -169,8 +178,9 @@ class MenuBar(wx.MenuBar): |
169 | 178 | # events should be binded directly from wx.Menu / wx.MenuBar |
170 | 179 | # message "Binding events of wx.MenuBar" on [wxpython-users] |
171 | 180 | # mail list in Oct 20 2008 |
172 | - self.parent.Bind(wx.EVT_MENU, self.OnNew, id=ID_NEW) | |
173 | - self.parent.Bind(wx.EVT_MENU, self.OnOpen, id=ID_OPEN) | |
181 | + #self.parent.Bind(wx.EVT_MENU, self.OnNew, id=ID_NEW) | |
182 | + #self.parent.Bind(wx.EVT_MENU, self.OnOpen, id=ID_OPEN) | |
183 | + pass | |
174 | 184 | |
175 | 185 | def OnNew(self, event): |
176 | 186 | print "New" |
... | ... | @@ -215,7 +225,7 @@ class StatusBar(wx.StatusBar): |
215 | 225 | self.SetFieldsCount(3) |
216 | 226 | self.SetStatusWidths([-2,-2,-1]) |
217 | 227 | self.SetStatusText("Ready", 0) |
218 | - self.SetStatusText("Welcome to InVesalius 3.0", 1) | |
228 | + self.SetStatusText("", 1) | |
219 | 229 | self.SetStatusText("", 2) |
220 | 230 | |
221 | 231 | self.progress_bar = ProgressBar(self) |
... | ... | @@ -257,35 +267,36 @@ class TaskBarIcon(wx.TaskBarIcon): |
257 | 267 | # ------------------------------------------------------------------------------ |
258 | 268 | |
259 | 269 | class ProjectToolBar(wx.ToolBar): |
260 | - # TODO: what will appear in menubar? | |
261 | 270 | def __init__(self, parent): |
262 | - wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT|wx.TB_NODIVIDER) | |
271 | + wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, | |
272 | + wx.DefaultSize, wx.TB_FLAT|wx.TB_NODIVIDER) | |
263 | 273 | if sys.platform == 'darwin': |
264 | - self._size = 25 | |
265 | - else: | |
266 | - self._size = 16 | |
267 | - self.SetToolBitmapSize(wx.Size(self._size,self._size)) | |
274 | + self.SetToolBitmapSize(wx.Size(32,32)) | |
268 | 275 | self.parent = parent |
269 | 276 | self.__init_items() |
270 | 277 | self.__bind_events() |
271 | 278 | |
272 | 279 | def __init_items(self): |
273 | 280 | |
274 | - BMP_IMPORT = wx.Bitmap("../icons/file_import.png", wx.BITMAP_TYPE_PNG) | |
275 | - BMP_EXPORT = wx.Bitmap("../icons/file_export.png", wx.BITMAP_TYPE_PNG) | |
276 | - BMP_NET = wx.Bitmap("../icons/file_from_internet.png", wx.BITMAP_TYPE_PNG) | |
277 | - BMP_SAVE = wx.Bitmap("../icons/file_save.png", wx.BITMAP_TYPE_PNG) | |
278 | - | |
279 | - if sys.platform != 'darwin': | |
280 | - bmp_list = [BMP_IMPORT, BMP_EXPORT, BMP_NET, BMP_SAVE] | |
281 | - for bmp in bmp_list: | |
282 | - bmp.SetWidth(self._size) | |
283 | - bmp.SetHeight(self._size) | |
284 | 281 | |
285 | - self.AddLabelTool(101, "Import medical image...", BMP_IMPORT) | |
286 | - self.AddLabelTool(101, "Export data.", BMP_EXPORT) | |
287 | - self.AddLabelTool(101, "Load medical image...", BMP_NET) | |
288 | - self.AddLabelTool(101, "Save InVesalius project", BMP_SAVE) | |
282 | + if sys.platform == 'darwin': | |
283 | + BMP_IMPORT = wx.Bitmap("../icons/file_import_original.png", wx.BITMAP_TYPE_PNG) | |
284 | + BMP_NET = wx.Bitmap("../icons/file_from_internet_original.png", wx.BITMAP_TYPE_PNG) | |
285 | + BMP_SAVE = wx.Bitmap("../icons/file_save_original.png", wx.BITMAP_TYPE_PNG) | |
286 | + BMP_PRINT = wx.Bitmap("../icons/print_original.png", wx.BITMAP_TYPE_PNG) | |
287 | + BMP_PHOTO = wx.Bitmap("../icons/tool_photo_original.png", wx.BITMAP_TYPE_PNG) | |
288 | + else: | |
289 | + BMP_IMPORT = wx.Bitmap("../icons/file_import.png", wx.BITMAP_TYPE_PNG) | |
290 | + BMP_NET = wx.Bitmap("../icons/file_from_internet.png", wx.BITMAP_TYPE_PNG) | |
291 | + BMP_SAVE = wx.Bitmap("../icons/file_save.png", wx.BITMAP_TYPE_PNG) | |
292 | + BMP_PRINT = wx.Bitmap("../icons/print.png", wx.BITMAP_TYPE_PNG) | |
293 | + BMP_PHOTO = wx.Bitmap("../icons/tool_photo.png", wx.BITMAP_TYPE_PNG) | |
294 | + | |
295 | + self.AddLabelTool(ID_FILE_IMPORT, "Import medical image...", BMP_IMPORT) | |
296 | + self.AddLabelTool(ID_FILE_LOAD_INTERNET, "Load medical image...", BMP_NET) | |
297 | + self.AddLabelTool(ID_FILE_SAVE, "Save InVesalius project", BMP_SAVE) | |
298 | + self.AddLabelTool(101, "Take photo of screen", BMP_PHOTO) | |
299 | + self.AddLabelTool(ID_FILE_PRINT, "Print medical image...", BMP_PRINT) | |
289 | 300 | |
290 | 301 | self.Realize() |
291 | 302 | |
... | ... | @@ -297,10 +308,7 @@ class ObjectToolBar(wx.ToolBar): |
297 | 308 | def __init__(self, parent): |
298 | 309 | wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT|wx.TB_NODIVIDER) |
299 | 310 | if sys.platform == 'darwin': |
300 | - self._size = 25 | |
301 | - else: | |
302 | - self._size = 16 | |
303 | - self.SetToolBitmapSize(wx.Size(self._size,self._size)) | |
311 | + self.SetToolBitmapSize(wx.Size(32,32)) | |
304 | 312 | |
305 | 313 | self.parent = parent |
306 | 314 | self.__init_items() |
... | ... | @@ -308,24 +316,18 @@ class ObjectToolBar(wx.ToolBar): |
308 | 316 | |
309 | 317 | def __init_items(self): |
310 | 318 | |
311 | - #BMP_ROTATE = wx.Bitmap("../icons/tool_rotate.gif", wx.BITMAP_TYPE_GIF) | |
312 | - #BMP_TRANSLATE = wx.Bitmap("../icons/tool_translate.gif", wx.BITMAP_TYPE_GIF) | |
313 | - BMP_ZOOM = wx.Bitmap("../icons/tool_zoom.png", wx.BITMAP_TYPE_PNG) | |
314 | - BMP_PHOTO = wx.Bitmap("../icons/tool_photo.png", wx.BITMAP_TYPE_PNG) | |
315 | - BMP_PRINT = wx.Bitmap("../icons/tool_print.png", wx.BITMAP_TYPE_PNG) | |
316 | - | |
317 | - if sys.platform != 'darwin': | |
318 | - bmp_list = [BMP_ZOOM, BMP_PHOTO, BMP_PRINT] | |
319 | - for bmp in bmp_list: | |
320 | - bmp.SetWidth(self._size) | |
321 | - bmp.SetHeight(self._size) | |
322 | - | |
323 | - #self.AddLabelTool(101, "Rotate image", BMP_ROTATE) | |
324 | - #self.AddLabelTool(101, "Translate image", BMP_TRANSLATE) | |
325 | - self.AddLabelTool(101, "Zoom image", BMP_ZOOM) | |
326 | - self.AddLabelTool(101, "Take photo of screen", BMP_PHOTO) | |
327 | - self.AddLabelTool(101, "Print screen", BMP_PRINT) | |
328 | 319 | |
320 | + if sys.platform == 'darwin': | |
321 | + BMP_ROTATE = wx.Bitmap("../icons/tool_rotate_original.gif", wx.BITMAP_TYPE_GIF) | |
322 | + BMP_TRANSLATE = wx.Bitmap("../icons/tool_translate_original.png", wx.BITMAP_TYPE_PNG) | |
323 | + BMP_ZOOM_IN = wx.Bitmap("../icons/tool_zoom_in_original.png", wx.BITMAP_TYPE_PNG) | |
324 | + BMP_ZOOM_OUT = wx.Bitmap("../icons/tool_zoom_out_original.png", wx.BITMAP_TYPE_PNG) | |
325 | + | |
326 | + self.AddLabelTool(101, "Zoom in image", BMP_ZOOM_IN) | |
327 | + self.AddLabelTool(101, "Zoom out image", BMP_ZOOM_OUT) | |
328 | + self.AddLabelTool(101, "Rotate image", BMP_ROTATE) | |
329 | + self.AddLabelTool(101, "Translate image", BMP_TRANSLATE) | |
330 | + | |
329 | 331 | self.Realize() |
330 | 332 | |
331 | 333 | def __bind_events(self): |
... | ... | @@ -336,10 +338,7 @@ class LayoutToolBar(wx.ToolBar): |
336 | 338 | def __init__(self, parent): |
337 | 339 | wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT|wx.TB_NODIVIDER) |
338 | 340 | if sys.platform == 'darwin': |
339 | - self._size = 25 | |
340 | - else: | |
341 | - self._size = 16 | |
342 | - self.SetToolBitmapSize(wx.Size(self._size,self._size)) | |
341 | + self.SetToolBitmapSize(wx.Size(32,32)) | |
343 | 342 | |
344 | 343 | self.parent = parent |
345 | 344 | self.__init_items() |
... | ... | @@ -347,14 +346,9 @@ class LayoutToolBar(wx.ToolBar): |
347 | 346 | |
348 | 347 | def __init_items(self): |
349 | 348 | |
350 | - BMP_ROTATE = wx.Bitmap("../icons/layout_data_only.png", wx.BITMAP_TYPE_PNG) | |
351 | - BMP_TRANSLATE = wx.Bitmap("../icons/layout_full.png", wx.BITMAP_TYPE_PNG) | |
349 | + BMP_ROTATE = wx.Bitmap("../icons/layout_data_only_original.gif", wx.BITMAP_TYPE_GIF) | |
350 | + BMP_TRANSLATE = wx.Bitmap("../icons/layout_full_original.gif", wx.BITMAP_TYPE_GIF) | |
352 | 351 | |
353 | - if sys.platform != 'darwin': | |
354 | - bmp_list = [BMP_ROTATE, BMP_TRANSLATE] | |
355 | - for bmp in bmp_list: | |
356 | - bmp.SetWidth(self._size) | |
357 | - bmp.SetHeight(self._size) | |
358 | 352 | |
359 | 353 | #BMP_ZOOM = wx.Bitmap("../icons/tool_zoom.png", wx.BITMAP_TYPE_PNG) |
360 | 354 | #BMP_PHOTO = wx.Bitmap("../icons/tool_photo.png", wx.BITMAP_TYPE_PNG) | ... | ... |
invesalius/gui/task_importer.py
... | ... | @@ -58,8 +58,8 @@ class InnerTaskPanel(wx.Panel): |
58 | 58 | self.float_hyper_list = [] |
59 | 59 | |
60 | 60 | # Fixed hyperlink items |
61 | - tooltip = wx.ToolTip("Select DICOM files to be reconstructed") | |
62 | - link_import_local = hl.HyperLinkCtrl(self, -1, "Open DICOM files...") | |
61 | + tooltip = wx.ToolTip("Select DICOM or Analyze files to be reconstructed") | |
62 | + link_import_local = hl.HyperLinkCtrl(self, -1, "Import medical images...") | |
63 | 63 | link_import_local.SetUnderlines(False, False, False) |
64 | 64 | link_import_local.SetColours("BLACK", "BLACK", "BLACK") |
65 | 65 | link_import_local.SetToolTip(tooltip) |
... | ... | @@ -182,9 +182,9 @@ class InnerTaskPanel(wx.Panel): |
182 | 182 | self.OnLinkOpenProject() |
183 | 183 | |
184 | 184 | def TestLoadProjects(self): |
185 | - self.LoadProject("test1.inv") | |
186 | - self.LoadProject("test2.inv") | |
187 | - self.LoadProject("test3.inv") | |
185 | + self.LoadProject("test1.iv3") | |
186 | + self.LoadProject("test2.iv3") | |
187 | + self.LoadProject("test3.iv3") | |
188 | 188 | |
189 | 189 | def LoadProject(self, proj_name="Unnamed"): |
190 | 190 | """ | ... | ... |
invesalius/gui/task_slice.py
invesalius/gui/task_surface.py
... | ... | @@ -311,14 +311,14 @@ class SurfaceProperties(wx.Panel): |
311 | 311 | (slider_transparency, 1, flag_slider,4)]) |
312 | 312 | |
313 | 313 | # LINE 4 |
314 | - cb = wx.CheckBox(self, -1, "Fill largest surface holes") | |
315 | - cb.SetValue(True) | |
314 | + #cb = wx.CheckBox(self, -1, "Fill largest surface holes") | |
315 | + #cb.SetValue(True) | |
316 | 316 | |
317 | 317 | # Add all lines into main sizer |
318 | 318 | sizer = wx.BoxSizer(wx.VERTICAL) |
319 | 319 | sizer.Add(line1, 1, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) |
320 | 320 | sizer.Add(fixed_sizer, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) |
321 | - sizer.Add(cb, 0, wx.GROW|wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP|wx.BOTTOM, 5) | |
321 | + #sizer.Add(cb, 0, wx.GROW|wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP|wx.BOTTOM, 5) | |
322 | 322 | sizer.Fit(self) |
323 | 323 | |
324 | 324 | self.SetSizer(sizer) |
... | ... | @@ -328,17 +328,21 @@ class SurfaceProperties(wx.Panel): |
328 | 328 | self.__bind_events() |
329 | 329 | |
330 | 330 | def __bind_events(self): |
331 | - #ps.Publisher().sendMessage('Update surface info in GUI', | |
332 | - # (surface.name, surface.colour, | |
333 | - # surface.transparency)) | |
334 | 331 | ps.Publisher().subscribe(self.InsertNewSurface, |
335 | 332 | 'Update surface info in GUI') |
333 | + ps.Publisher().subscribe(self.ChangeMaskName, | |
334 | + 'Change surface name') | |
336 | 335 | |
337 | 336 | |
337 | + def ChangeMaskName(self, pubsub_evt): | |
338 | + index, name = pubsub_evt.data | |
339 | + self.combo_surface_name.SetString(index, name) | |
340 | + self.combo_surface_name.Refresh() | |
341 | + | |
338 | 342 | def InsertNewSurface(self, pubsub_evt): |
339 | 343 | name = pubsub_evt.data[1] |
340 | 344 | colour = [value*255 for value in pubsub_evt.data[2]] |
341 | - transparency = 100*pubsub_evt.data[3] | |
345 | + transparency = 100*pubsub_evt.data[4] | |
342 | 346 | index = self.combo_surface_name.Append(name) |
343 | 347 | self.combo_surface_name.SetSelection(index) |
344 | 348 | self.button_colour.SetColour(colour) | ... | ... |