Beispiel #1
0
def add_raw2connectome(connectome, type):
    
    log.info("Adding raw data to connectome (%s)..." % type)
    
    nifti_dir = op.join(gconf.get_nifti())
    cvol = None
    
    if type == 'rawdiffusion':
        if gconf.diffusion_imaging_model == 'DSI':
            if op.exists(op.join(nifti_dir, 'DSI.nii.gz')):
                cvol = cf.CVolume(name="Raw Diffusion",
                               src=op.join(nifti_dir, 'DSI.nii.gz'),
                               fileformat='Nifti1GZ',
                               dtype='DSI')    
                
        elif gconf.diffusion_imaging_model == 'DTI':
            if op.exists(op.join(nifti_dir, 'DTI.nii.gz')):
                cvol = cf.CVolume(name="Raw Diffusion",
                               src=op.join(nifti_dir, 'DTI.nii.gz'),
                               fileformat='Nifti1GZ',
                               dtype='DTI')
        elif gconf.diffusion_imaging_model == 'QBALL':
            if op.exists(op.join(nifti_dir, 'QBALL.nii.gz')):
                cvol = cf.CVolume(name="Raw Diffusion",
                               src=op.join(nifti_dir, 'QBALL.nii.gz'),
                               fileformat='Nifti1GZ',
                               dtype='QBALL')

    elif type == 'rawT1':
        if op.exists(op.join(nifti_dir, 'T1.nii.gz')):
            cvol = cf.CVolume(name="Raw T1 image",
                           src=op.join(nifti_dir, 'T1.nii.gz'),
                           fileformat='Nifti1GZ',
                           dtype='T1-weighted')
    elif type == 'rawT2':
        if op.exists(op.join(nifti_dir, 'T2.nii.gz')):
            cvol = cf.CVolume(name="Raw T2 image",
                           src=op.join(nifti_dir, 'T2.nii.gz'),
                           fileformat='Nifti1GZ',
                           dtype='T2-weighted')
    
    if not cvol is None:
        connectome.add_connectome_volume(cvol)    
Beispiel #2
0
def add_scalars2connectome(connectome, type):
    
    log.info("Adding scalar fields to connectome...")
    
    scalarpath = gconf.get_cmp_scalars()

    import gzip
    
    if type == 'gfa':
        if gconf.diffusion_imaging_model == 'DSI':
            if op.exists(op.join(scalarpath, 'dsi_gfa.nii.gz')):
                cvol = cf.CVolume(name="GFA Scalar Map",
                               src=op.join(scalarpath, 'dsi_gfa.nii.gz'),
                               fileformat='Nifti1GZ',
                               dtype='GFA')
                connectome.add_connectome_volume(cvol)
    elif type == 'skewness':
        if gconf.diffusion_imaging_model == 'DSI':
            if op.exists(op.join(scalarpath, 'dsi_skewness.nii.gz')):
                cvol = cf.CVolume(name="Skewness Scalar Map",
                               src=op.join(scalarpath, 'dsi_skewness.nii.gz'),
                               fileformat='Nifti1GZ',
                               dtype='GFA')
                connectome.add_connectome_volume(cvol)
    elif type == 'kurtosis':
        if gconf.diffusion_imaging_model == 'DSI':
            if op.exists(op.join(scalarpath, 'dsi_kurtosis.nii.gz')):
                cvol = cf.CVolume(name="Kurtosis Scalar Map",
                               src=op.join(scalarpath, 'dsi_kurtosis.nii.gz'),
                               fileformat='Nifti1GZ',
                               dtype='GFA')
                connectome.add_connectome_volume(cvol)
    elif type == 'P0':
        if gconf.diffusion_imaging_model == 'DSI':
            if op.exists(op.join(scalarpath, 'dsi_P0.nii.gz')):
                cvol = cf.CVolume(name="P0 Scalar Map",
                               src=op.join(scalarpath, 'dsi_P0.nii.gz'),
                               fileformat='Nifti1GZ',
                               dtype='P0')
                connectome.add_connectome_volume(cvol)
Beispiel #3
0
def add_roiseg2connectome(connectome):
    
    log.info("Adding ROI segmentation to connectome...")

    # add about everything
    reg_path = gconf.get_cmp_tracto_mask()
        
    asegf = op.join(reg_path, 'aseg.nii.gz')
    ribbonf = op.join(reg_path, 'ribbon.nii.gz')    
    fsmaskf = op.join(reg_path, 'fsmask_1mm.nii.gz')
    unkf = op.join(reg_path, 'cc_unknown.nii.gz')
    
    if op.exists(asegf):
        cvol = cf.CVolume(name="Aseg segmentation volume",
                       src=asegf,
                       fileformat='Nifti1GZ',
                       dtype='Segmentation')
        connectome.add_connectome_volume(cvol)
                
    if op.exists(ribbonf):
        cvol = cf.CVolume(name="Ribbon segmentation volume",
                       src=ribbonf,
                       fileformat='Nifti1GZ',
                       dtype='Segmentation')
        connectome.add_connectome_volume(cvol)
                
    if op.exists(fsmaskf):
        cvol = cf.CVolume(name="White matter mask",
                       src=fsmaskf,
                       fileformat='Nifti1GZ',
                       dtype='Segmentation')
        connectome.add_connectome_volume(cvol)
        
    if op.exists(unkf):
        cvol = cf.CVolume(name="CC and Unknown",
                       src=unkf,
                       fileformat='Nifti1GZ',
                       dtype='Segmentation')
        connectome.add_connectome_volume(cvol)
                
    # is original T1 space
    for p in gconf.parcellation.keys():
        log.info("Adding volume ROI for resolution (original space): %s" % p)
        file = op.join(op.join(reg_path, p), 'ROI_HR_th.nii.gz')
        
        if op.exists(file):
            cvol = cf.CVolume(name="ROI Volume %s" % p,
                           src=file,
                           fileformat='Nifti1GZ',
                           dtype='Segmentation')
            connectome.add_connectome_volume(cvol)
    
    # in space registred to b0
    reg_path = gconf.get_cmp_tracto_mask_tob0()
    for p in gconf.parcellation.keys():
        log.info("Adding volume ROI for resolution (in b0 space): %s" % p)
        file = op.join(op.join(reg_path, p), 'ROI_HR_th.nii.gz')
        
        if op.exists(file):
            cvol = cf.CVolume(name="ROI Scale %s (b0 space)" % p,
                           src=file,
                           fileformat='Nifti1GZ',
                           dtype='Segmentation')
            connectome.add_connectome_volume(cvol)