Esempio n. 1
0
    def OnLinkNewSurface(self, evt=None):
        
        is_pubsub = True

        try:
            evt = evt.data
            evt = None
        except:
            pass
        
        #import invesalius.gui.dialogs as dlg
        sl = slice_.Slice()

        if sl.current_mask == None:
            dlg.InexistentMask()
            return

        dialog = dlg.SurfaceCreationDialog(None, -1,
                            _('New surface'),
                            mask_edited=sl.current_mask.was_edited)

        try:
            if dialog.ShowModal() == wx.ID_OK:
                ok = 1
            else:
                ok = 0
        except(wx._core.PyAssertionError): #TODO FIX: win64
            ok = 1

        if (ok):
            ## Retrieve information from dialog
            #(mask_index, surface_name, surface_quality, fill_holes,\
            #keep_largest) = dialog.GetValue()

            ## Retrieve information from mask
            #proj = prj.Project()
            #mask = proj.mask_dict[mask_index]

            ## Send all information so surface can be created
            #surface_data = [proj.imagedata,
                            #mask.colour,
                            #mask.threshold_range,
                            #mask.edited_points,
                            #False, # overwrite
                            #surface_name,
                            #surface_quality,
                            #fill_holes,
                            #keep_largest]


            surface_options = dialog.GetValue()

            Publisher.sendMessage('Create surface from index',
                                  surface_parameters=surface_options)
        dialog.Destroy()
        if evt:
            evt.Skip()
Esempio n. 2
0
    def OnNew(self):
        sl = slice_.Slice()
        dialog = dlg.SurfaceCreationDialog(
            None, -1, _('New surface'), mask_edited=sl.current_mask.was_edited)
        try:
            if dialog.ShowModal() == wx.ID_OK:
                ok = 1
            else:
                ok = 0
        except (wx._core.PyAssertionError):  #TODO FIX: win64
            ok = 1

        if ok:
            surface_options = dialog.GetValue()

            Publisher.sendMessage('Create surface from index', surface_options)
        dialog.Destroy()