Beispiel #1
0
def demo_fsl_feeds(data_dir="/tmp/fsl-feeds-data", output_dir="/tmp/fsl_feeds_mrimc_output"):
    """Demo for FSL Feeds data.

    Parameters
    ----------
    data_dir: string, optional
        where the data is located on your disk, where it will be
        downloaded to
    output_dir: string, optional
        where output will be written to

    """

    # fetch data
    fsl_feeds_data = fetch_fsl_feeds_data(data_dir=data_dir)

    # subject data factory
    def subject_factory():
        subject_id = "sub001"

        yield SubjectData(
            subject_id=subject_id, func=fsl_feeds_data.func, output_dir=os.path.join(output_dir, subject_id)
        )

    # invoke demon to run de demo
    _demo_runner(subject_factory(), "FSL FEEDS")
onset = list(EV1_onset) + list(EV2_onset)
duration = [EV1_on] * EV1_epochs + [EV2_on] * EV2_epochs
paradigm = BlockParadigm(con_id=conditions, onset=onset, duration=duration)
frametimes = np.linspace(0, (n_scans - 1) * TR, n_scans)
maximum_epoch_duration = max(EV1_epoch_duration, EV2_epoch_duration)
hfcut = 1.5 * maximum_epoch_duration  # why ?

"""construct design matrix"""
drift_model = 'Cosine'
hrf_model = 'Canonical With Derivative'
design_matrix = make_dmtx(frametimes,
                          paradigm, hrf_model=hrf_model,
                          drift_model=drift_model, hfcut=hfcut)

"""fetch input data"""
_subject_data = fetch_fsl_feeds_data(data_dir)
subject_data = SubjectData()
subject_data.subject_id = "sub001"
subject_data.func = _subject_data.func
subject_data.anat = _subject_data.anat
subject_data.output_dir = os.path.join(
    output_dir, subject_data.subject_id)

"""preprocess the data"""
results = do_subjects_preproc(
    [subject_data],
    output_dir=output_dir,
    fwhm=8,
    dataset_id="FSL FEEDS single-subject",
    dataset_description=DATASET_DESCRIPTION,
    do_shutdown_reloaders=False,