41
41
# check to see that the output file exists.
42
42
self.outputs['subj_id'] = self.inputs['subj_id']
44
class MITsink(nif.InterfaceBase):
46
super(MITsink,self).__init__()
47
self.diskbased = False
49
self.parameterization = ''
51
self.inputs['use_parameterization'] = False
52
self.inputs['base_dir'] = None
53
self.inputs['subj_id'] = None
54
self.inputs['subj_template'] = None
56
def pre_execute(self):
60
# check to see that the output file exists.
61
if not os.path.exists(self.inputs['base_dir']):
62
os.mkdir(self.inputs['base_dir'])
63
outdir = self.inputs['base_dir']
64
if self.inputs['subj_id'] is not None:
65
outdir = os.path.join(outdir,self.inputs['subj_template'] % self.inputs['subj_id'])
66
if not os.path.exists(outdir):
68
if self.inputs['use_parameterization'] and self.parameterization is not '':
69
outdir = os.path.join(outdir,self.parameterization)
70
if not os.path.exists(outdir):
73
for k,v in self.inputs.items():
74
if type(v) is type([]):
76
dirnames = k.split('.')
78
for d in k.split('.'):
79
tempoutdir = os.path.join(tempoutdir,d)
80
if not os.path.exists(tempoutdir):
82
nif.copyfiles_to_cwd(self.inputs,[k],tempoutdir,hashnames=False,symlink=False)
84
def post_execute(self):
87
class MITL2source(nif.InterfaceBase):
89
super(MITL2source,self).__init__()
90
self.diskbased = False
91
self.name = 'FBIRNsource'
93
self.inputs['base_dir'] = None
94
self.inputs['subject_id'] = None
95
self.inputs['contrast_id'] = None
96
self.outputs['conimages'] = None
98
def pre_execute(self):
104
self.log['returncode'] = 0
105
self.outputs['conimages'] = []
106
for subj in self.inputs['subject_id']:
107
subjdir = '_subject_id_%s' % subj
108
conimg = 'con_%04d.img' % self.inputs['contrast_id']
109
con_path = os.path.join(self.inputs['base_dir'],subjdir,conimg)
110
self.outputs['conimages'].extend(glob.glob(con_path))
112
def post_execute(self):
113
# check to see that the output file exists.