Ejemplo n.º 1
0
 def _fcn_grid_tupdate(self):
     """Update grid titles properties."""
     if hasattr(self, '_grid'):
         self._grid.font_size = float(self._grid_titles_fz.value())  # fz
         col = textline2color(str(self._grid_titles_color.text()))[1]
         self._grid.tcolor = col  # title color
         self._grid.tvisible = self._grid_titles.isChecked()  # title
Ejemplo n.º 2
0
 def _fcn_grid_tupdate(self):
     """Update grid titles properties."""
     if hasattr(self, '_grid'):
         self._grid.font_size = float(self._grid_titles_fz.value())  # fz
         col = textline2color(str(self._grid_titles_color.text()))[1]
         self._grid.tcolor = col  # title color
         self._grid.tvisible = self._grid_titles.isChecked()  # title
Ejemplo n.º 3
0
 def _fcn_source_proj(self, _, **kwargs):
     """Apply source projection."""
     project_on = str(self._s_proj_on.currentText())
     b_obj = self.atlas if project_on == 'brain' else self.roi
     radius = self._s_proj_radius.value()
     contribute = self._s_proj_contribute.isChecked()
     mask_color = textline2color(str(self._s_proj_mask_color.text()))[1]
     project = str(self._s_proj_type.currentText())
     self.sources.project_sources(b_obj, project=project, radius=radius,
                                  contribute=contribute,
                                  mask_color=mask_color, **kwargs)
     self.cbqt.setEnabled('roi', hasattr(self.roi, 'mesh'))
Ejemplo n.º 4
0
 def _fcn_annot_appear(self):
     """Control annotations appearance."""
     pos = self._signal._annot_mark._data['a_position']
     self._signal._annot_mark._data = np.array([])
     color = textline2color(self._annot_color.text())[1]
     self._signal._annot_text.font_size = self._annot_txtsz.value()
     self._signal._annot_text.color = color
     self._signal._annot_mark.set_data(pos=pos, face_color=color,
                                       size=self._annot_marksz.value(),
                                       edge_width=0.)
     self._signal._annot_text.update()
     self._signal._annot_text.visible = self._annot_viz.isChecked()
     self._signal._annot_mark.visible = self._annot_viz.isChecked()
Ejemplo n.º 5
0
 def _fcn_annot_appear(self):
     """Control annotations appearance."""
     pos = self._signal._annot_mark._data['a_position']
     self._signal._annot_mark._data = np.array([])
     color = textline2color(self._annot_color.text())[1]
     self._signal._annot_text.font_size = self._annot_txtsz.value()
     self._signal._annot_text.color = color
     self._signal._annot_mark.set_data(pos=pos,
                                       face_color=color,
                                       size=self._annot_marksz.value(),
                                       edge_width=0.)
     self._signal._annot_text.update()
     self._signal._annot_text.visible = self._annot_viz.isChecked()
     self._signal._annot_mark.visible = self._annot_viz.isChecked()
Ejemplo n.º 6
0
 def _fcn_source_proj(self, _, **kwargs):
     """Apply source projection."""
     project_on = str(self._s_proj_on.currentText())
     b_obj = self.atlas if project_on == 'brain' else self.roi
     radius = self._s_proj_radius.value()
     contribute = self._s_proj_contribute.isChecked()
     mask_color = textline2color(str(self._s_proj_mask_color.text()))[1]
     project = str(self._s_proj_type.currentText())
     self.sources.project_sources(b_obj,
                                  project=project,
                                  radius=radius,
                                  contribute=contribute,
                                  mask_color=mask_color,
                                  **kwargs)
     self.cbqt.setEnabled('roi', hasattr(self.roi, 'mesh'))
Ejemplo n.º 7
0
 def _fcn_set_bgcolor(self):
     """Change background color."""
     bgcolor = textline2color(str(self._set_bgcolor.text()))[1]
     self._grid_canvas.bgcolor = bgcolor
     self._signal_canvas.bgcolor = bgcolor
Ejemplo n.º 8
0
 def _fcn_source_edgecolor(self):
     """Update source edge color."""
     color = textline2color(str(self._s_edge_color.text()))[1]
     self._get_select_object().edge_color = color
Ejemplo n.º 9
0
 def _fcn_proj_mask_color(self):
     """Change the color for projected masked sources."""
     color = textline2color(str(self._s_proj_mask_color.text()))[1]
     self.atlas.mesh.mask_color = color
Ejemplo n.º 10
0
 def _fcn_text_color(self):
     """Update text color."""
     color = textline2color(str(self._st_color.text()))[1]
     self._get_select_object().text_color = color
Ejemplo n.º 11
0
 def _fcn_axis_color(self):
     """Set axis color."""
     col = textline2color(str(self._axis_color.text()))[1]
     self._signal_canvas.axis_color = col
     self._signal_canvas.cbar.txtcolor = col
Ejemplo n.º 12
0
    def _fcn_set_signal(self, *args, force=False):
        """Set signal."""
        # =================== FORM AND COLOR ===================
        form_bck = self._signal.form
        form = str(self._sig_form.currentText())
        form_index = int(self._sig_form.currentIndex())
        self._PlottingForm.setCurrentIndex(form_index)
        color = textline2color(str(self._sig_color.text()))[0]
        # Enable amplitude control only for line // marker :
        self._sig_amp.setEnabled(form in ['line', 'marker'])

        # ================== LINE / MARKER / HISTOGRAM / TF ==================
        lw = float(self._sig_lw.value())
        nbins = int(self._sig_nbins.value())
        size = float(self._sig_size.value())
        symbol = str(self._sig_symbol.currentText())
        norm = int(self._sig_norm.currentIndex())
        is_baseline = self._sig_baseline.isChecked()
        _baseline = (int(self._sig_base_start.value()),
                     int(self._sig_base_end.value()))
        baseline = None if not is_baseline else _baseline
        is_averaging = self._sig_averaging.isChecked()
        window = None if not is_averaging else self._sig_av_win.value()
        overlap = float(self._sig_av_overlap.value())
        is_clim = self._sig_tf_clim.isChecked()
        _clim = (self._sig_climin.value(), self._sig_climax.value())
        clim = _clim if is_clim else None
        cmap = str(self._sig_tf_cmap.currentText())
        cmap += '_r' * self._sig_tf_rev.isChecked()
        interpolation = str(self._sig_tf_interp.currentText())
        nperseg = int(self._sig_nperseg.value())
        noverlap = int(self._sig_noverlap.value())

        # =================== THRESHOLD ===================
        thm = (self._sig_th_min.value(), self._sig_th_max.value())
        th = thm if self._sig_th.isChecked() else None

        # =================== SET DATA // TEXT===================
        index = int(self._sig_index.value())
        self._signal.set_data(self._data, index, color, lw, nbins, symbol,
                              size, form, th, norm, window, overlap, baseline,
                              clim, cmap, interpolation, nperseg, noverlap)
        self._txt_shape.setText(str(self._signal))

        # =================== CAMERA ===================
        if force or (form != form_bck):
            self._sig_amp.setChecked(False)
            self.update_cameras(update='signal')
        self._sig_tf_apply.setEnabled(False)

        # =================== RESIZE ===================
        main = self._signal_canvas.wc
        cbar = self._signal_canvas.wc_cbar
        title = self._signal_canvas._titleObj
        xaxis = self._signal_canvas.xaxis
        is_form = form in ['tf']
        if is_form and (self._previous_form != form):
            self._signal_canvas.grid.add_widget(cbar, row=1, col=2)
            self._signal_canvas.grid.resize_widget(main, 1, 1)
            self._signal_canvas.grid.resize_widget(xaxis, 1, 1)
            self._signal_canvas.grid.resize_widget(title, 1, 2)
        elif not is_form:
            self._signal_canvas.grid.remove_widget(cbar)
            self._signal_canvas.grid.resize_widget(main, 1, 2)
            self._signal_canvas.grid.resize_widget(xaxis, 1, 2)
            self._signal_canvas.grid.resize_widget(title, 1, 3)

        # =================== CLIM // CBAR ===================
        self._signal_canvas.wc_cbar.visible = is_form
        if form == 'tf':
            # Fix clim (min, max):
            clim_max = abs(np.max(self._signal._tf._clim))
            self._sig_climin.setMinimum(-clim_max)
            self._sig_climin.setMaximum(clim_max)
            self._sig_climax.setMinimum(-clim_max)
            self._sig_climax.setMaximum(clim_max)
            # Colorbar upate :
            self._cbar_update(self._signal._tf)
        self._signal_canvas.update()
        self._previous_form = form
Ejemplo n.º 13
0
 def _fcn_ts_color(self):
     """Time series color."""
     color = textline2color(str(self._ts_color.text()))[1]
     self._get_select_object().color = color
Ejemplo n.º 14
0
 def _fcn_ts_color(self):
     """Time series color."""
     color = textline2color(str(self._ts_color.text()))[1]
     self._get_select_object().color = color
Ejemplo n.º 15
0
 def _fcn_proj_mask_color(self):
     """Change the color for projected masked sources."""
     color = textline2color(str(self._s_proj_mask_color.text()))[1]
     self.atlas.mesh.mask_color = color
Ejemplo n.º 16
0
 def _fcn_text_color(self):
     """Update text color."""
     color = textline2color(str(self._st_color.text()))[1]
     self._get_select_object().text_color = color
Ejemplo n.º 17
0
 def _fcn_source_edgecolor(self):
     """Update source edge color."""
     color = textline2color(str(self._s_edge_color.text()))[1]
     self._get_select_object().edge_color = color