def qap_functional_temporal(
    func_motion_correct,
    func_brain_mask,
    coord_xfm_matrix,
    subject_id,
    session_id,
    scan_id,
    site_name=None,
    motion_threshold=1.0,
):

    import sys

    from qap.temporal_qc import (
        mean_dvars_wrapper,
        summarize_fd,
        mean_outlier_timepoints,
        mean_quality_timepoints,
        global_correlation,
    )

    # DVARS
    mean_dvars = mean_dvars_wrapper(func_motion_correct, func_brain_mask)

    # Mean FD (Jenkinson)
    (mean_fd, num_fd, percent_fd) = summarize_fd(coord_xfm_matrix, threshold=motion_threshold)

    # 3dTout
    mean_outlier = mean_outlier_timepoints(func_motion_correct, func_brain_mask)

    # 3dTqual
    mean_quality = mean_quality_timepoints(func_motion_correct)

    # new thing
    gcor = global_correlation(func_motion_correct, func_brain_mask)

    # Compile
    qc = {
        "subject": subject_id,
        "session": session_id,
        "scan": scan_id,
        "dvars": mean_dvars,
        "mean_fd": mean_fd,
        "num_fd": num_fd,
        "perc_fd": percent_fd,
        "outlier": mean_outlier,
        "quality": mean_quality,
        "gcor": gcor,
    }

    if site_name:
        qc["site"] = site_name

    return qc
示例#2
0
def test_summarize_fd_threshold_01():

    import os
    import pickle
    import pkg_resources as p

    from qap.temporal_qc import summarize_fd

    coord_xfm = p.resource_filename("qap", os.path.join(test_sub_dir, \
                                    "rest_1", \
                                    "coordinate_transformation", \
                                    "rest_calc_tshift_resample.aff12.1D"))

    out_tuple = summarize_fd(coord_xfm, threshold=0.1)

    assert out_tuple == (0.050015007171052638, 14.0, 9.15032679738562)
def test_summarize_fd_threshold_01():   

    import os
    import pickle
    import pkg_resources as p
    
    from qap.temporal_qc import summarize_fd

    coord_xfm = p.resource_filename("qap", os.path.join(test_sub_dir, \
                                    "rest_1", \
                                    "coordinate_transformation", \
                                    "rest_calc_tshift_resample.aff12.1D"))
         
    out_tuple = summarize_fd(coord_xfm, threshold=0.1)

    assert out_tuple == (0.050015007171052638, 14.0, 9.15032679738562)