def test_JistBrainMp2rageSkullStripping_outputs(): output_map = dict(outBrain=dict(), outMasked=dict(), outMasked2=dict(), outMasked3=dict(), ) outputs = JistBrainMp2rageSkullStripping.output_spec() for key, metadata in output_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(outputs.traits()[key], metakey), value
def test_JistBrainMp2rageSkullStripping_inputs(): input_map = dict( args=dict(argstr='%s', ), environ=dict( nohash=True, usedefault=True, ), ignore_exception=dict( nohash=True, usedefault=True, ), inFilter=dict(argstr='--inFilter %s', ), inSecond=dict(argstr='--inSecond %s', ), inSkip=dict(argstr='--inSkip %s', ), inT1=dict(argstr='--inT1 %s', ), inT1weighted=dict(argstr='--inT1weighted %s', ), null=dict(argstr='--null %s', ), outBrain=dict( argstr='--outBrain %s', hash_files=False, ), outMasked=dict( argstr='--outMasked %s', hash_files=False, ), outMasked2=dict( argstr='--outMasked2 %s', hash_files=False, ), outMasked3=dict( argstr='--outMasked3 %s', hash_files=False, ), terminal_output=dict( mandatory=True, nohash=True, ), xDefaultMem=dict(argstr='-xDefaultMem %d', ), xMaxProcess=dict( argstr='-xMaxProcess %d', usedefault=True, ), xPrefExt=dict(argstr='--xPrefExt %s', ), ) inputs = JistBrainMp2rageSkullStripping.input_spec() for key, metadata in input_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(inputs.traits()[key], metakey), value
def test_JistBrainMp2rageSkullStripping_inputs(): input_map = dict(args=dict(argstr='%s', ), environ=dict(nohash=True, usedefault=True, ), ignore_exception=dict(nohash=True, usedefault=True, ), inFilter=dict(argstr='--inFilter %s', ), inSecond=dict(argstr='--inSecond %s', ), inSkip=dict(argstr='--inSkip %s', ), inT1=dict(argstr='--inT1 %s', ), inT1weighted=dict(argstr='--inT1weighted %s', ), null=dict(argstr='--null %s', ), outBrain=dict(argstr='--outBrain %s', hash_files=False, ), outMasked=dict(argstr='--outMasked %s', hash_files=False, ), outMasked2=dict(argstr='--outMasked2 %s', hash_files=False, ), outMasked3=dict(argstr='--outMasked3 %s', hash_files=False, ), terminal_output=dict(mandatory=True, nohash=True, ), xDefaultMem=dict(argstr='-xDefaultMem %d', ), xMaxProcess=dict(argstr='-xMaxProcess %d', usedefault=True, ), xPrefExt=dict(argstr='--xPrefExt %s', ), ) inputs = JistBrainMp2rageSkullStripping.input_spec() for key, metadata in input_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(inputs.traits()[key], metakey), value
def create_mp2rage_pipeline(name='mp2rage'): # workflow mp2rage = Workflow('mp2rage') # inputnode inputnode=Node(util.IdentityInterface(fields=['inv2', 'uni', 't1map']), name='inputnode') # outputnode outputnode=Node(util.IdentityInterface(fields=['uni_masked', 'background_mask', 'uni_stripped', 'skullstrip_mask', ]), name='outputnode') #get filenames from list def return_list_element(x): x_file=x[0] return x_file get_uni= Node(util.Function(input_names=["x"], output_names=["x_file"], function = return_list_element), name="get_uni") get_t1= Node(util.Function(input_names=["x"], output_names=["x_file"], function = return_list_element), name="get_t1") get_inv2= Node(util.Function(input_names=["x"], output_names=["x_file"], function = return_list_element), name="get_inv2") # remove background noise background = Node(JistIntensityMp2rageMasking(outMasked=True, outMasked2=True, outSignal2=True), name='background') # skullstrip # strip = Node(MedicAlgorithmSPECTRE2010(outStripped=True, # outMask=True, # outOriginal=True, # inOutput='true', # inFind='true', # inMMC=4 # ), # name='strip') strip = Node(JistBrainMp2rageSkullStripping(outBrain=True, outMasked2=True),name='strip') # connections mp2rage.connect([(inputnode, get_uni, [('uni','x')]), (inputnode, get_t1, [('t1map','x')]), (inputnode, get_inv2, [('inv2','x')]), (get_inv2, background, [('x_file', 'inSecond')]), (get_t1, background, [('x_file', 'inQuantitative')]), (get_uni, background, [('x_file','inT1weighted')]), (background, strip, [('outMasked2','inT1weighted')]), (get_inv2, strip, [('x_file', 'inSecond')]), (background, outputnode, [('outMasked2','uni_masked'), ('outSignal2','background_mask')]), (strip, outputnode, [('outMasked2','uni_stripped'), ('outBrain', 'skullstrip_mask') ]) ]) return mp2rage