コード例 #1
0
    def run_calculations(self):
        """Collect the settings and launch the calculation."""
        statusmsg = self.statusbar.showMessage
        button_ok = self.bb_ok_cancel.button(QtGui.QDialogButtonBox.Ok)
        button_ok.setEnabled(False)
        infile = str(self.le_infile.text())
        outfile = filehandle(str(self.le_outfile.text()), 'w')
        xmax = self.dsb_1.value()
        ymax = self.dsb_2.value()
        if (xmax + ymax) == 0:
            statusmsg('Input size required!')
            button_ok.setEnabled(True)
            return
        xtgt = self.sb_1.value()
        ytgt = self.sb_2.value()
        set_loglevel(self.sl_verbosity.value())

        statusmsg('Parsing XML file...')
        spots = StatisticsSpots(infile)
        spots.set_limits(xmax=xmax, ymax=ymax)
        statusmsg('Generating bitmap...')
        bitmap = spots.gen_bitmap((xtgt, ytgt), delta=50)
        statusmsg('Writing output file...')
        savetxt(outfile, bitmap, fmt='%i')
        statusmsg('Finished writing bitmap (%i x %i).' % (xtgt, ytgt))
        button_ok.setEnabled(True)
コード例 #2
0
def main():
    """Read Imaris export and generate bitmap."""
    args = parse_arguments()

    spots = StatisticsSpots(args.infile)
    if args.xmax is not None:
        spots.set_limits(xmax=args.xmax)
    if args.ymax is not None:
        spots.set_limits(ymax=args.ymax)
    matrix = spots.gen_bitmap((args.size, args.size), crop=args.crop, delta=50)
    np.savetxt(args.outfile, matrix, fmt='%i')