示例#1
0
 def seg_norm(self, in_prefix=''):
     def_tpms = np.zeros((3,1), dtype=np.object)
     spm_path = spm_info.spm_path
     def_tpms[0] = pjoin(spm_path, 'tpm', 'grey.nii'),
     def_tpms[1] = pjoin(spm_path, 'tpm', 'white.nii'),
     def_tpms[2] = pjoin(spm_path, 'tpm', 'csf.nii')
     data = np.zeros((1,), dtype=object)
     data[0] = self.data_def['anatomical']
     sninfo = make_job('spatial', 'preproc', {
             'data': data,
             'output':{
                 'GM':fltcols([0,0,1]),
                 'WM':fltcols([0,0,1]),
                 'CSF':fltcols([0,0,0]),
                 'biascor':1.0,
                 'cleanup':False,
                 },
             'opts':{
                 'tpm':def_tpms,
                 'ngaus':fltcols([2,2,2,4]),
                 'regtype':'mni',
                 'warpreg':1.0,
                 'warpco':25.0,
                 'biasreg':0.0001,
                 'biasfwhm':60.0,
                 'samp':3.0,
                 'msk':np.array([], dtype=object),
                 }
             })
     run_jobdef(sninfo)
     return in_prefix
示例#2
0
def segnorm(data_def):
    def_tpms = np.zeros((3,1), dtype=np.object)
    spm_path = spm_info.spm_path
    def_tpms[0] = pjoin(spm_path, 'tpm', 'grey.nii'),
    def_tpms[1] = pjoin(spm_path, 'tpm', 'white.nii'),
    def_tpms[2] = pjoin(spm_path, 'tpm', 'csf.nii')
    data = np.zeros((1,), dtype=object)
    data[0] = data_def['anatomical']
    sninfo = make_job('spatial', 'preproc', {
            'data': data,
            'output':{
                'GM':fltcols([0,0,1]),
                'WM':fltcols([0,0,1]),
                'CSF':fltcols([0,0,0]),
                'biascor':1.0,
                'cleanup':False,
                },
            'opts':{
                'tpm':def_tpms,
                'ngaus':fltcols([2,2,2,4]),
                'regtype':'mni',
                'warpreg':1.0,
                'warpco':25.0,
                'biasreg':0.0001,
                'biasfwhm':60.0,
                'samp':3.0,
                'msk':np.array([], dtype=object),
                }
            })
    run_jobdef(sninfo)
示例#3
0
 def seg_norm(self, in_prefix=""):
     def_tpms = np.zeros((3, 1), dtype=np.object)
     spm_path = spm_info.spm_path
     def_tpms[0] = (pjoin(spm_path, "tpm", "grey.nii"),)
     def_tpms[1] = (pjoin(spm_path, "tpm", "white.nii"),)
     def_tpms[2] = pjoin(spm_path, "tpm", "csf.nii")
     data = np.zeros((1,), dtype=object)
     data[0] = self.data_def["anatomical"]
     sninfo = make_job(
         "spatial",
         "preproc",
         {
             "data": data,
             "output": {
                 "GM": fltcols([0, 0, 1]),
                 "WM": fltcols([0, 0, 1]),
                 "CSF": fltcols([0, 0, 0]),
                 "biascor": 1.0,
                 "cleanup": False,
             },
             "opts": {
                 "tpm": def_tpms,
                 "ngaus": fltcols([2, 2, 2, 4]),
                 "regtype": "mni",
                 "warpreg": 1.0,
                 "warpco": 25.0,
                 "biasreg": 0.0001,
                 "biasfwhm": 60.0,
                 "samp": 3.0,
                 "msk": np.array([], dtype=object),
             },
         },
     )
     run_jobdef(sninfo)
     return in_prefix
示例#4
0
 def norm_write(self, in_prefix='', out_prefix='w'):
     sess_scans = scans_for_fnames(
         fnames_presuffix(self.data_def['functionals'], in_prefix))
     matname = fname_presuffix(self.data_def['anatomical'],
                             suffix='_seg_sn.mat',
                             use_ext=False)
     subj = {
         'matname': np.zeros((1,), dtype=object),
         'resample': np.vstack(sess_scans.flat),
         }
     subj['matname'][0] = matname
     roptions = {
         'preserve':False,
         'bb':np.array([[-78,-112, -50],[78,76,85.0]]),
         'vox':fltcols([2.0,2.0,2.0]),
         'interp':1.0,
         'wrap':[0.0,0.0,0.0],
         'prefix': out_prefix,
         }
     nwinfo = make_job('spatial', 'normalise', [{
             'write':{
                 'subj': subj,
                 'roptions': roptions,
                 }
             }])
     run_jobdef(nwinfo)
     # knock out the list of images, replacing with only one
     subj['resample'] = np.zeros((1,), dtype=object)
     subj['resample'][0] = self.data_def['anatomical']
     roptions['interp'] = 4.0
     run_jobdef(nwinfo)
     return out_prefix + in_prefix
示例#5
0
def norm_write(data_def):
    sess_scans = scans_for_fnames(fnames_presuffix(data_def['functionals'], 'a'))
    matname = fname_presuffix(data_def['anatomical'],
                              suffix='_seg_sn.mat',
                              use_ext=False)
    subj = {
        'matname': np.zeros((1,), dtype=object),
        'resample': np.vstack(sess_scans.flat),
        }
    subj['matname'][0] = matname
    roptions = {
        'preserve':False,
        'bb':np.array([[-78,-112, -50],[78,76,85.0]]),
        'vox':fltcols([2.0,2.0,2.0]),
        'interp':1.0,
        'wrap':[0.0,0.0,0.0],
        }
    nwinfo = make_job('spatial', 'normalise', [{
            'write':{
                'subj': subj,
                'roptions': roptions,
                }
            }])
    run_jobdef(nwinfo)
    # knock out the list of images, replacing with only one
    subj['resample'] = np.zeros((1,), dtype=object)
    subj['resample'][0] = data_def['anatomical']
    roptions['interp'] = 4.0
    run_jobdef(nwinfo)
示例#6
0
 def norm_write(self, in_prefix="", out_prefix="w"):
     sess_scans = scans_for_fnames(fnames_presuffix(self.data_def["functionals"], in_prefix))
     matname = fname_presuffix(self.data_def["anatomical"], suffix="_seg_sn.mat", use_ext=False)
     subj = {"matname": np.zeros((1,), dtype=object), "resample": np.vstack(sess_scans.flat)}
     subj["matname"][0] = matname
     roptions = {
         "preserve": False,
         "bb": np.array([[-78, -112, -50], [78, 76, 85.0]]),
         "vox": fltcols([2.0, 2.0, 2.0]),
         "interp": 1.0,
         "wrap": [0.0, 0.0, 0.0],
         "prefix": out_prefix,
     }
     nwinfo = make_job("spatial", "normalise", [{"write": {"subj": subj, "roptions": roptions}}])
     run_jobdef(nwinfo)
     # knock out the list of images, replacing with only one
     subj["resample"] = np.zeros((1,), dtype=object)
     subj["resample"][0] = self.data_def["anatomical"]
     roptions["interp"] = 4.0
     run_jobdef(nwinfo)
     return out_prefix + in_prefix