Esempio n. 1
0
    def compute(self):

        if self.getVal('compute'):

            direction = self.getVal('direction')
            bm = self.getVal('bitmask')
            kspace = self.getData('input')

            # load up arguments list
            args = [base_path+'/cdf97']

            if direction != 0:
                args += ['-i']

            args += [str(bm)]

            in1 = IFilePath(cfl.writecfl, kspace, asuffix=['.cfl', '.hdr'])
            args += [in1]

            # setup file for getting data from external command
            out = OFilePath(cfl.readcfl, asuffix=['.cfl','.hdr'])
            args += [out]

            # run commandline
            print(Command(*args))

            self.setData('output', out.data())
            out.close()

        return 0
Esempio n. 2
0
    def compute(self):

        i = self.getVal('iterations')
        s = self.getVal('relative subspace size')

        kspace = self.getData('kspace')

        # load up arguments list
        args = [base_path+'/bart sake']
        args += [str(i)]
        args += [str(s)]

        # setup file for passing data to external command
        in1 = IFilePath(cfl.writecfl, kspace, asuffix=['.cfl','.hdr'])
        args += [in1]

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=['.cfl','.hdr'])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData('output', out.data())
        out.close()

        return 0
Esempio n. 3
0
    def compute(self):

        i = self.getVal('iterations')
        s = self.getVal('relative subspace size')

        kspace = self.getData('kspace')

        # load up arguments list
        args = [base_path + '/bart sake']
        args += [str(i)]
        args += [str(s)]

        # setup file for passing data to external command
        in1 = IFilePath(cfl.writecfl, kspace, asuffix=['.cfl', '.hdr'])
        args += [in1]

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=['.cfl', '.hdr'])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData('output', out.data())
        out.close()

        return 0
Esempio n. 4
0
    def compute(self):
        kspace = self.getData('kspace')

        # load up arguments list
        args = [base_path+'/bart homodyne']

        args += [str(self.getVal('dim'))]
        args += [str(self.getVal('fraction'))]

        # setup file for passing data to external command
        in1 = IFilePath(cfl.writecfl, kspace, asuffix=['.cfl','.hdr'])
        args += [in1]

        out1 = OFilePath(cfl.readcfl, asuffix=['.cfl','.hdr'])
        args += [out1]

        # run commandline
        print(Command(*args))

        self.setData('out', out1.data())

        in1.close()
        out1.close()

        return 0
Esempio n. 5
0
    def compute(self):
        # load up arguments list
        args = [base_path + '/bart poisson']
        args += ['-Y {}'.format(self.getVal('y size'))]
        args += ['-Z {}'.format(self.getVal('z size'))]
        args += ['-y {}'.format(self.getVal('y accel'))]
        args += ['-z {}'.format(self.getVal('z accel'))]
        args += ['-C {}'.format(self.getVal('cal size'))]

        if self.getVal('variable density'):
            args += ['-v']

        if self.getVal('elliptical'):
            args += ['-e']

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=['.cfl', '.hdr'])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData('out', out.data())
        out.close()

        return 0
Esempio n. 6
0
    def compute(self):

        if self.getVal('compute'):

            direction = self.getVal('direction')
            bm = self.getVal('bitmask')
            kspace = self.getData('input')

            # load up arguments list
            args = [base_path + '/cdf97']

            if direction != 0:
                args += ['-i']

            args += [str(bm)]

            in1 = IFilePath(cfl.writecfl, kspace, asuffix=['.cfl', '.hdr'])
            args += [in1]

            # setup file for getting data from external command
            out = OFilePath(cfl.readcfl, asuffix=['.cfl', '.hdr'])
            args += [out]

            # run commandline
            print(Command(*args))

            self.setData('output', out.data())
            out.close()

        return 0
Esempio n. 7
0
    def compute(self):

        k = self.getVal('kernel size')
        r = self.getVal('calibration region size')

        kspace = self.getData('kspace')

        # load up arguments list
        args = [base_path + '/bart calmat']
        args += ['-r ' + str(r)]
        args += ['-k ' + str(k)]

        # setup file for passing data to external command
        in1 = IFilePath(cfl.writecfl, kspace, asuffix=['.cfl', '.hdr'])
        args += [in1]

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=['.cfl', '.hdr'])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData('output', out.data())
        out.close()

        return 0
Esempio n. 8
0
    def compute(self):

        x = self.getVal('readout samples')
        y = self.getVal('phase encoding lines')
        a = self.getVal('acceleration')
        t = self.getVal('turns')
        r = self.getVal('radial')
        g = self.getVal('golden-ratio sampling')
        d = self.getVal('double base angle')

        # load up arguments list
        args = [base_path + '/bart traj']
        args += ['-x ' + str(x)]
        args += ['-y ' + str(y)]
        args += ['-a ' + str(a)]
        args += ['-t ' + str(t)]
        args += r * ['-r']
        args += g * ['-G']
        args += d * ['-D']

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=['.cfl', '.hdr'])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData('out1', out.data())
        out.close()

        return 0
Esempio n. 9
0
    def compute(self):
        kspace = self.getData('kspace')

        # load up arguments list
        args = [base_path+'/bart nlinv']

        if self.getVal('regularization') == 0:
            args += ['-l1']
        else:
            args += ['-l2']

        args += ['-i {}'.format(self.getVal('iterations'))]

        # setup file for passing data to external command
        in1 = IFilePath(cfl.writecfl, kspace, asuffix=['.cfl','.hdr'])
        args += [in1]

        out1 = OFilePath(cfl.readcfl, asuffix=['.cfl','.hdr'])
        args += [out1]
        out2 = OFilePath(cfl.readcfl, asuffix=['.cfl','.hdr'])
        args += [out2]

        # run commandline
        print(Command(*args))

        self.setData('out', out1.data())
        self.setData('sensitivities', out2.data())

        in1.close()
        out1.close()
        out2.close()

        return 0
Esempio n. 10
0
    def compute(self):

        x = self.getVal("readout samples")
        y = self.getVal("phase encoding lines")
        a = self.getVal("acceleration")
        t = self.getVal("turns")
        r = self.getVal("radial")
        g = self.getVal("golden-ratio sampling")
        d = self.getVal("double base angle")

        # load up arguments list
        args = [base_path + "/bart traj"]
        args += ["-x " + str(x)]
        args += ["-y " + str(y)]
        args += ["-a " + str(a)]
        args += ["-t " + str(t)]
        args += r * ["-r"]
        args += g * ["-G"]
        args += d * ["-D"]

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=[".cfl", ".hdr"])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData("out1", out.data())
        out.close()

        return 0
Esempio n. 11
0
    def compute(self):

        f = self.getVal("factor")
        indata = self.getData("in")

        # load up arguments list
        args = [base_path + "/bart scale"]
        args += [str(f)]

        # setup file for passing data to external command
        inp = IFilePath(cfl.writecfl, indata, asuffix=[".cfl", ".hdr"])
        args += [inp]

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=[".cfl", ".hdr"])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData("out", out.data())
        out.close()
        inp.close()

        return 0
Esempio n. 12
0
    def compute(self):

        j = self.getVal('thresholding bitmask')
        lamda = self.getVal('lambda')

        inp = self.getData('input')

        # load up arguments list
        args = [base_path + '/bart threshold']
        args += ['-j ' + str(j)]
        args += [str(lamda)]

        # setup file for passing data to external command
        in1 = IFilePath(cfl.writecfl, inp, asuffix=['.cfl', '.hdr'])
        args += [in1]

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=['.cfl', '.hdr'])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData('output', out.data())
        out.close()

        return 0
Esempio n. 13
0
    def compute(self):

        f = self.getVal('factor')
        indata = self.getData('in')

        # load up arguments list
        args = [base_path+'/bart scale']
        args += [str(f)]

        # setup file for passing data to external command
        inp = IFilePath(cfl.writecfl, indata, asuffix=['.cfl','.hdr'])
        args += [inp]

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=['.cfl','.hdr'])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData('out', out.data())
        out.close()
        inp.close()

        return 0
Esempio n. 14
0
    def compute(self):
        kspace = self.getData('kspace')

        # load up arguments list
        args = [base_path + '/bart homodyne']

        args += [str(self.getVal('dim'))]
        args += [str(self.getVal('fraction'))]

        # setup file for passing data to external command
        in1 = IFilePath(cfl.writecfl, kspace, asuffix=['.cfl', '.hdr'])
        args += [in1]

        out1 = OFilePath(cfl.readcfl, asuffix=['.cfl', '.hdr'])
        args += [out1]

        # run commandline
        print(Command(*args))

        self.setData('out', out1.data())

        in1.close()
        out1.close()

        return 0
Esempio n. 15
0
    def compute(self):

        j = self.getVal('thresholding bitmask')
        lamda = self.getVal('lambda')

        inp = self.getData('input')

        # load up arguments list
        args = [base_path+'/bart threshold']
        args += ['-j '+str(j)]
        args += [str(lamda)]

        # setup file for passing data to external command
        in1 = IFilePath(cfl.writecfl, inp, asuffix=['.cfl','.hdr'])
        args += [in1]

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=['.cfl','.hdr'])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData('output', out.data())
        out.close()

        return 0
Esempio n. 16
0
    def compute(self):

        reg = self.getVal('Regularization:')
        alpha = self.getVal('regularization parameter')
        kspace = self.getData('kspace')
        inmaps = self.getData('sensitivities')

        # load up arguments list
        args = [base_path + '/bart pocsense']
        if reg == 0:
            args += ['-l1']
        else:
            args += ['-l2']
        args += ['-r ' + str(alpha)]

        # setup file for passing data to external command
        coords = IFilePath(cfl.writecfl, kspace, asuffix=['.cfl', '.hdr'])
        args += [coords]
        sens = IFilePath(cfl.writecfl, inmaps, asuffix=['.cfl', '.hdr'])
        args += [sens]

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=['.cfl', '.hdr'])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData('output', out.data())
        out.close()

        return 0
Esempio n. 17
0
    def compute(self):

        reg = self.getVal('Regularization:')
        alpha = self.getVal('regularization parameter')
        kspace = self.getData('kspace')
        inmaps = self.getData('sensitivities')

        # load up arguments list
        args = [base_path+'/bart pocsense']
        if reg == 0:
            args += ['-l1']
        else:
            args += ['-l2']
        args += ['-r '+str(alpha)]

        # setup file for passing data to external command
        coords = IFilePath(cfl.writecfl, kspace, asuffix=['.cfl','.hdr'])
        args += [coords]
        sens = IFilePath(cfl.writecfl, inmaps, asuffix=['.cfl','.hdr'])
        args += [sens]

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=['.cfl','.hdr'])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData('output', out.data())
        out.close()

        return 0
Esempio n. 18
0
    def compute(self):

        adjoint = self.getVal('adjoint')
        inverse = self.getVal('inverse')
        dimensions = self.getVal('dimensions')
        toeplitz = self.getVal('toeplitz')
        lmbda = self.getVal('lambda')

        kspace = self.getData('input')
        traj = self.getData('traj')

        # load up arguments list
        args = [base_path + '/bart nufft']

        args += ['-l ' + str(lmbda)]
        if adjoint:
            args += ['-a']
        if inverse:
            args += ['-i']
        if toeplitz:
            args += ['-t']
        if dimensions != '':
            try:
                dims = re.search('^([0-9]*):([0-9]*):([0-9]*)$',
                                 dimensions).groups()
                args += ['-d ' + ':'.join(dims)]
            except:
                self.log.warn(
                    '\'dimensions\' must be a list of positive integers delimited by colons (i.e. int:int:int), skipping...'
                )

        # setup file for passing data to external command
        in_traj = IFilePath(cfl.writecfl, traj, asuffix=['.cfl', '.hdr'])
        in_kspc = IFilePath(cfl.writecfl, kspace, asuffix=['.cfl', '.hdr'])
        args += [in_traj, in_kspc]

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=['.cfl', '.hdr'])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData('output', out.data())
        out.close()
        in_traj.close()
        in_kspc.close()

        return 0
Esempio n. 19
0
    def compute(self):

        adjoint = self.getVal('adjoint')
        inverse = self.getVal('inverse')
        dimensions = self.getVal('dimensions')
        toeplitz = self.getVal('toeplitz')
        lmbda = self.getVal('lambda')

        kspace = self.getData('input')
        traj = self.getData('traj')

        # load up arguments list
        args = [base_path+'/bart nufft']

        args += ['-l '+str(lmbda)]
        if adjoint:
            args += ['-a']
        if inverse:
            args += ['-i']
        if toeplitz:
            args += ['-t']
        if dimensions != '':
            try:
                dims = re.search('^([0-9]*):([0-9]*):([0-9]*)$', dimensions).groups()
                args += ['-d '+':'.join(dims)]
            except:
                self.log.warn('\'dimensions\' must be a list of positive integers delimited by colons (i.e. int:int:int), skipping...')

        # setup file for passing data to external command
        in_traj = IFilePath(cfl.writecfl, traj, asuffix=['.cfl','.hdr'])
        in_kspc = IFilePath(cfl.writecfl, kspace, asuffix=['.cfl','.hdr'])
        args += [in_traj, in_kspc]

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=['.cfl','.hdr'])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData('output', out.data())
        out.close()
        in_traj.close()
        in_kspc.close()

        return 0
Esempio n. 20
0
    def compute(self):

        kspace = self.getData('kspace')
        coil_maps = self.getData('coil_maps')
        trajectory = self.getData('traj')

        reg = self.getVal('regularization')
        lamb = self.getVal('lamb')

        # load up arguments list
        args = [base_path + '/bart pics']

        if reg == 0:
            args += ['-l1']
        else:
            args += ['-l2']

        args += ['-r {}'.format(lamb)]
        args += ['-e -i 100']

        # setup file for getting data from external command
        if trajectory is not None:
            traj = IFilePath(cfl.writecfl,
                             trajectory,
                             asuffix=['.cfl', '.hdr'])
            args += ['-t', traj]

        kspace = IFilePath(cfl.writecfl, kspace, asuffix=['.cfl', '.hdr'])
        coil_maps = IFilePath(cfl.writecfl,
                              coil_maps,
                              asuffix=['.cfl', '.hdr'])
        output = OFilePath(cfl.readcfl, asuffix=['.cfl', '.hdr'])
        args += [kspace, coil_maps, output]

        print(Command(*args))

        self.setData('output', output.data())

        if trajectory is not None:
            traj.close()
        kspace.close()
        coil_maps.close()
        output.close()

        return 0
Esempio n. 21
0
    def compute(self):
        # load up arguments list
        args = [base_path + '/bart phantom']
        args += ['-s {}'.format(self.getVal('num_coils'))]

        if self.getVal('kspace'):
            args += ['-k']

        traj = self.getData('traj')
        if traj is not None:
            traj_file = IFilePath(cfl.writecfl, traj, asuffix=['.cfl', '.hdr'])
            args += ['-t', traj_file]

        # setup file for getting data from external command
        out = OFilePath(cfl.readcfl, asuffix=['.cfl', '.hdr'])
        args += [out]

        # run commandline
        print(Command(*args))

        self.setData('out1', out.data())
        out.close()

        return 0
Esempio n. 22
0
    def compute(self):

        t = self.getVal('threshold')
        c = self.getVal('crop value')
        k = self.getVal('kernel size')
        r = self.getVal('calibration size')
        m = self.getVal('number maps')
        I = self.getVal('intensity correction')
        first = self.getVal('1st part only')

        kspace = self.getData('kspace')

        # load up arguments list
        args = [base_path+'/bart ecalib']
        args += ['-t '+str(t)]
        args += ['-c '+str(c)]
        args += ['-k '+str(k)]
        args += ['-r '+str(r)]
        args += ['-m '+str(m)]
        if I:
            args += ['-I']
        if first:
            args += ['-1']

        # setup file for passing data to external command
        in1 = IFilePath(cfl.writecfl, kspace, asuffix=['.cfl','.hdr'])
        args += [in1]


        out1 = OFilePath(cfl.readcfl, asuffix=['.cfl','.hdr'])
        args += [out1]

        if not first:
            out2 = OFilePath(cfl.readcfl, asuffix=['.cfl','.hdr'])
            args += [out2]

        # run commandline
        print(Command(*args))

        if first:
            self.setData('imgcov', out1.data())
        else:
            self.setData('sensitivities', out1.data())
        out1.close()

        if not first:
            self.setData('ev_maps', out2.data())
            out2.close()

        in1.close()

        return 0
Esempio n. 23
0
    def compute(self):

        e = self.getVal('SVD Econ')
        inp = self.getData('input')

        # load up arguments list
        args = [base_path + '/bart svd']
        if e:
            args += ['-e']

        # setup file for passing data to external command
        in1 = IFilePath(cfl.writecfl, inp, asuffix=['.cfl', '.hdr'])
        args += [in1]

        # setup file for getting data from external command
        out1 = OFilePath(cfl.readcfl, asuffix=['.cfl', '.hdr'])
        args += [out1]
        out2 = OFilePath(cfl.readcfl, asuffix=['.cfl', '.hdr'])
        args += [out2]
        out3 = OFilePath(cfl.readcfl, asuffix=['.cfl', '.hdr'])
        args += [out3]

        # run commandline
        print(Command(*args))

        self.setData('U', out1.data())
        self.setData('S', out2.data())
        self.setData('VH', out3.data())
        out1.close()
        out2.close()
        out3.close()

        return 0
Esempio n. 24
0
File: SVD_GPI.py Progetto: nckz/bart
    def compute(self):

        e = self.getVal('SVD Econ')
        inp = self.getData('input')

        # load up arguments list
        args = [base_path+'/bart svd']
        if e:
            args += ['-e']

        # setup file for passing data to external command
        in1 = IFilePath(cfl.writecfl, inp, asuffix=['.cfl','.hdr'])
        args += [in1]

        # setup file for getting data from external command
        out1 = OFilePath(cfl.readcfl, asuffix=['.cfl','.hdr'])
        args += [out1]
        out2 = OFilePath(cfl.readcfl, asuffix=['.cfl','.hdr'])
        args += [out2]
        out3 = OFilePath(cfl.readcfl, asuffix=['.cfl','.hdr'])
        args += [out3]

        # run commandline
        print(Command(*args))

        self.setData('U', out1.data())
        self.setData('S', out2.data())
        self.setData('VH', out3.data())
        out1.close()
        out2.close()
        out3.close()

        return 0