Example #1
0
    def loadmod(self):

        cmd = '%s modlist ; mv mod.xml %s' % (self.Jcall, workspace())

        proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                                stderr=subprocess.PIPE, shell=True)
        out, err = proc.communicate()

        fname = os.path.join(workspace(), 'mod.xml')

        mod(fname)

        return fname
Example #2
0
    def __init__(self, fname):

        # = DxDy (sometimes given as scalar)
        self.RES = np.array([1., 1., 1.])[:, None]
        # is a shift in each dimension
        self.OFF = np.array([0., 0., 0.])[:, None]

        self.labelPhantom = dict()
        self.labelPhantom['active'] = False
        self.labelMatrix = dict()
        self.labelMatrix['active'] = False
        self.mapsComputed = False

        self.sfacs = dict()     # scaling factors
        for key in ['M0', 'T1', 'T2', 'T2s', 'CS', 'Xi']:
            self.sfacs[key] = 1

        if fname is not None:
            self.rename(fname)
        else:
            self.rename(os.path.join(workspace(), 'new_phantom.h5'))
            self.tmpname = True

        self.geometricPhantoms = ['Sphere', 'Spheres', 'Cylinder', 'Revolver']

        print('init', fname)
Example #3
0
    def __init__(self, fname):

        # Defaults.
        model = {'name':    'Bloch',
                 'type':    'CVODE'}

        parameter = {'ConcomitantFields':   '0',
                     'EvolutionPrefix':     'evol',
                     'EvolutionSteps':      '0',
                     'RandomNoise':         '0'}

#        self.sim = dict()
        self.sim = {'sample':       dict(),
                    'sequence':     dict(),
                    'RXcoilarray':  dict(),
                    'TXcoilarray':  dict(),
                    'model':        model,
                    'parameter':    parameter}

        self.data = None
        self.channels = []

        if fname is not None:
            self.rename(fname)
        else:
            self.rename(os.path.join(workspace(), 'new_simulation.xml'))
            self.tmpname = True
            self.setSequence('')
            self.setSample('')
            self.setTxCoilArray('')
            self.setRxCoilArray('')
Example #4
0
    def updateXML(self):

        Instance = self.Instance

        tmp = Instance.fname
        Instance.rename(os.path.join(workspace(), 'tmp.xml'))
        Instance.save()
        self.readXML()
        Instance.rename(tmp)
Example #5
0
    def __init__(self, attr, fname=None):

        self.attr = attr
        self.data = None

        if fname is not None:
            self.rename(fname)
        else:
            self.rename(os.path.join(workspace(), 'new_array.xml'))
            self.tmpname = True
Example #6
0
    def __init__(self, attr, fname=None):

        self.attr = attr
        self.data = None

        if fname is not None:
            self.rename(fname)
        else:
            self.rename(os.path.join(workspace(), 'new_sequence.xml'))
            self.tmpname = True
            self.xml = Element(self.attr, None)