def get_protocol(self):
        try:
            bval_scale = float(self.bvalScale.text())
        except:
            bval_scale = 1

        return load_bvec_bval(bvec=self.bvecFileInput.text(),
                              bval=self.bvalFileInput.text(),
                              bval_scale=bval_scale)
    def run(self, args):
        bvec = os.path.realpath(args.bvec)
        bval = os.path.realpath(args.bval)

        if args.output_file:
            output_prtcl = os.path.realpath(args.output_file)
        else:
            output_prtcl = os.path.join(
                os.path.dirname(bvec),
                os.path.splitext(os.path.basename(bvec))[0] + '.prtcl')

        if args.bval_scale_factor:
            bval_scale_factor = float(args.bval_scale_factor)
        else:
            bval_scale_factor = 'auto'

        protocol = load_bvec_bval(bvec=bvec,
                                  bval=bval,
                                  bval_scale=bval_scale_factor)

        if args.G is None and args.maxG is not None:
            if os.path.isfile(str(args.maxG)):
                protocol.add_column_from_file('maxG',
                                              os.path.realpath(str(args.maxG)),
                                              1)
            else:
                protocol.add_column('maxG', float(args.maxG))

        if args.Delta is not None:
            add_sequence_timing_column_to_protocol(protocol, 'Delta',
                                                   args.Delta,
                                                   args.sequence_timing_units)
        if args.delta is not None:
            add_sequence_timing_column_to_protocol(protocol, 'delta',
                                                   args.delta,
                                                   args.sequence_timing_units)
        if args.TE is not None:
            add_sequence_timing_column_to_protocol(protocol, 'TE', args.TE,
                                                   args.sequence_timing_units)
        if args.TR is not None:
            add_sequence_timing_column_to_protocol(protocol, 'TR', args.TR,
                                                   args.sequence_timing_units)
        if args.G is not None:
            add_column_to_protocol(protocol, 'G', args.G, 1)

        mdt.protocols.write_protocol(protocol, output_prtcl)