def create_dwi_preprocess_pipeline(name="preprocess"):
    inputnode = pe.Node(interface=util.IdentityInterface(fields=['dwi']), name="inputnode")
    
    preprocess = pe.Workflow(name=name)

    """
    extract the volume with b=0 (nodif_brain)
    """
    
    fslroi = pe.Node(interface=fsl.ExtractROI(),name='fslroi')
    fslroi.inputs.t_min=0
    fslroi.inputs.t_size=1
    
    """
    create a brain mask from the nodif_brain
    """
    
    bet = pe.Node(interface=fsl.BET(),name='bet')
    bet.inputs.mask=True
    bet.inputs.frac=0.34
    
    """
    correct the diffusion weighted images for eddy_currents
    """
    
    eddycorrect = create_eddy_correct_pipeline("eddycorrect")
    eddycorrect.inputs.inputnode.ref_num=0
    
    preprocess.connect([(inputnode, fslroi,[('dwi','in_file')]),
                           (inputnode, eddycorrect, [('dwi','inputnode.in_file')]),
                           (fslroi,bet,[('roi_file','in_file')]),
                        ])
    return preprocess
예제 #2
0
def test_create_eddy_correct_pipeline():
    fsl_course_dir = os.environ["FSL_COURSE_DATA"]

    dwi_file = os.path.join(fsl_course_dir, "fsl_course_data/fdt/subj1/data.nii.gz")

    nipype_eddycorrect = fsl_wf.create_eddy_correct_pipeline("nipype_eddycorrect")
    nipype_eddycorrect.inputs.inputnode.in_file = dwi_file
    nipype_eddycorrect.inputs.inputnode.ref_num = 0

    with warnings.catch_warnings():
        warnings.simplefilter("ignore")
        original_eddycorrect = pe.Node(interface = fsl.EddyCorrect(), name="original_eddycorrect")
    original_eddycorrect.inputs.in_file = dwi_file
    original_eddycorrect.inputs.ref_num = 0

    test = pe.Node(util.AssertEqual(), name="eddy_corrected_dwi_test")

    pipeline = pe.Workflow(name="test_eddycorrect")
    pipeline.base_dir = test_dir

    pipeline.connect([(nipype_eddycorrect, test, [("outputnode.eddy_corrected", "inputnode.volume1")]),
                      (original_eddycorrect, test, [("eddy_corrected", "inputnode.volume2")]),
                      ])

    pipeline.run(inseries=True)
예제 #3
0
fslroi.inputs.t_min=0
fslroi.inputs.t_size=1

"""
create a brain mask from the nodif_brain
"""

bet = pe.Node(interface=fsl.BET(),name='bet')
bet.inputs.mask=True
bet.inputs.frac=0.34

"""
correct the diffusion weighted images for eddy_currents
"""

eddycorrect = fsl_wf.create_eddy_correct_pipeline('eddycorrect')
eddycorrect.inputs.inputnode.ref_num=0


hardi_mat = pe.Node(interface=dtk.HARDIMat(),name='hardi_mat')

odf_recon = pe.Node(interface=dtk.ODFRecon(),name='odf_recon')

"""
connect all the nodes for this workflow
"""

compute_ODF.connect([
                        (fslroi,bet,[('roi_file','in_file')]),
                        (eddycorrect, odf_recon,[('outputnode.eddy_corrected','DWI')]),
                        (eddycorrect, hardi_mat,[('outputnode.eddy_corrected','reference_file')]),
예제 #4
0
fslroi.inputs.t_min = 0
fslroi.inputs.t_size = 1

"""
create a brain mask from the nodif_brain
"""

bet = pe.Node(interface=fsl.BET(), name="bet")
bet.inputs.mask = True
bet.inputs.frac = 0.34

"""
correct the diffusion weighted images for eddy_currents
"""

eddycorrect = fsl_wf.create_eddy_correct_pipeline("eddycorrect")
eddycorrect.inputs.inputnode.ref_num = 0


hardi_mat = pe.Node(interface=dtk.HARDIMat(), name="hardi_mat")

odf_recon = pe.Node(interface=dtk.ODFRecon(), name="odf_recon")

"""
connect all the nodes for this workflow
"""

compute_ODF.connect(
    [
        (fslroi, bet, [("roi_file", "in_file")]),
        (eddycorrect, odf_recon, [("outputnode.eddy_corrected", "DWI")]),