コード例 #1
0
 def _newFilter(self):
     '''Add a new filter to the stack'''
     self.filterStack.append(filt.makeLPF(Window='hanning',
                                          Dim=self.dim,
                                          Radius=max(self.dim),
                                          Outer=False,
                                          Cont=False))
     self._enableSP(True)
     self.filterList.setCurrentRow(self.filterList.count()-1)
     self._updateList()
コード例 #2
0
    def _updateFilter(self):
        """Update the filter in the stack and redisplay"""
        if self.filterStack == []:
            return
        window = self.FILTER_NAMES[str(self.windowCB.currentText())]
        if (window == 'chebwin') or (window == 'gaussian') or \
                (window == 'kaiser') or (window == 'slepian'):
            window = (window, self.shapeSB.value())

        if window == 'DC Offset':
            workingFilter = filt.makeDCO()

        elif self.lowpassRB.isChecked():
            workingFilter = \
                filt.makeLPF(Window=window,
                             Dim=self.dim,
                             Diameter=self.diameterSB.value(),
                             Outer=self.outerRB.isChecked(),
                             Cont=self.percentRB.isChecked())
        elif self.highpassRB.isChecked():
            workingFilter = \
                filt.makeHPF(Window=window,
                             Dim=self.dim,
                             Diameter=self.diameterSB.value(),
                             Outer=self.outerRB.isChecked(),
                             Cont=self.percentRB.isChecked())

        elif self.cbandstopRB.isChecked():
            workingFilter = \
                filt.makeBSF(Window=window,
                             Dim=self.dim,
                             Radius=self.diameterSB.value(),
                             Diameter=self.widthSB.value(),
                             Cont=self.percentRB.isChecked())

        elif self.vbandstopRB.isChecked():
            workingFilter = \
                filt.makeVBSF(Window=window,
                              Dim=self.dim,
                              Center=self.hcenterSB.value(),
                              Width=self.widthSB.value())

        elif self.hbandstopRB.isChecked():
            workingFilter = \
                filt.makeHBSF(Window=window,
                              Dim=self.dim,
                              Center=self.vcenterSB.value(),
                              Width=self.widthSB.value())

        elif self.notchRB.isChecked():
            center = (self.vcenterSB.value(), self.hcenterSB.value())
            workingFilter = filt.makeNF(Window=window,
                                        Dim=self.dim,
                                        Center=center,
                                        Width=self.widthSB.value())

        self.filterDisplay.imshow(workingFilter.function(np.ones(self.dim)))
        index = self.filterList.currentRow()
        self.filterStack[index] = workingFilter
        self._updateList()
        self.filterList.setCurrentRow(index)