qx_mri.fc.fc_extract_trial_timeseries_masked(flist, roif, targetf, tevents, frames, scrubvar)#

fc_extract_trial_timeseries_masked(flist, roif, targetf, tevents, frames, scrubvar)

Extracts trial timeseries for each of the specified ROI.


--flist (str):

File list with information on .conc, .fidl, and individual roi (segmentation) files, or a well strucutured string (see general_read_file_list).

--roif (str):

Region "names" file that specifies the ROI to extract trial timeseries for.

--targetf (str):

The target matlab file with results.

--tevents (cell array):

The indeces of the events for which to extract timeseries, can be a cell array of combinations of event indeces.

--frames (vector):

Limits of frames to include in the extracted timeseries.

--scrubvar (str, default ''):

Critera to use for scrubbing data - scrub based on:

  • [] do not scrub

  • 'mov' - overall movement displacement

  • 'dvars' - frame-to-frame variability

  • 'dvarsme' - median normalized dvars

  • 'idvars' - mov AND dvars

  • 'idvarsme' - mov AND dvarsme

  • 'udvars' - mov OR dvars

  • 'udvarsme' - mov OR dvarsme.



A structure with extracted trial timeseries for each session:

  • .session

    Subject id.

  • .set(n)

    Extracted datasets for the session.

    • .fevents.event

      A list of events processed.

    • .fevents.frame

      Start frames of the events processed.

    • .fevents.events

      List of event names included.

    • .nevents

      Number of events processed.

    • .frames

      A list of frames processed.

    • .timeseries
      A 3D matrix with the dimensions:
      • number of events (trials)

      • number of frames extracted for each trial

      • number of regions to extract data from.

    • .scrub

      A matrix of scrub markers (nevents x n event frames).

    • .baseline

      A matrix of baseline data for each ROI for each run (nrun x nroi).

    • .eventbaseline

      A matrix of baseline for each event (trial) for each ROI (nevents x nroi).

    • .run

      A record of which run each event (trial) comes from.


The function is used to extract per trial data from each session for the specified events. The data is returned in a data structure described above, as well as saved to a matlab data file.


The call below would extract three sets of timeseries for:

  1. event coded as 0,

  2. events coded as 1 or 2 and

  3. events coded as 3 and 4 in the fidl file.

For each matching event in the fidl file, it would extract for each of the regions specified in the ccroi.names frames 2, 3, and 4. It would save the results in a file 'ccroits.mat'. At extraction it would ignore all frames that were marked bad using the 'udvarsme' criterion.

qunex fc_extract_trial_timeseries_masked \
    --flist='scz+con.list' \
    --roif='ccroi.names' \
    --targetf='ccroits' \
    --tevents='{[0], [1 2], [3 4]}' \
    --frames='[2 4]' \