processing_stream_-_scripted
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
processing_stream_-_scripted [2010/06/09 20:32] – added pre-processing information jochen | processing_stream_-_scripted [2010/06/09 21:06] – added PRT-creation from onset table jochen | ||
---|---|---|---|
Line 10: | Line 10: | ||
* location of subject data at the scanning facility (server) | * location of subject data at the scanning facility (server) | ||
* local folder and knowledge about desired structure | * local folder and knowledge about desired structure | ||
+ | * onsets in a tabular structure where one column codes the subject and negative differences between onset times code the run separation (for an example, see below) | ||
===== Sub components ===== | ===== Sub components ===== | ||
Line 20: | Line 21: | ||
* preprocessing (SPM5 or SPM8) | * preprocessing (SPM5 or SPM8) | ||
* conversion into BrainVoyager QX's VTC format | * conversion into BrainVoyager QX's VTC format | ||
- | * automatic logfile parsing (PRT generation) | + | * semi-automatic logfile parsing (PRT generation) |
* computing a RFX-GLM of all available subjects (upon request) | * computing a RFX-GLM of all available subjects (upon request) | ||
Line 165: | Line 166: | ||
vtc.SaveAs(sprintf(' | vtc.SaveAs(sprintf(' | ||
vtc.ClearObject; | vtc.ClearObject; | ||
+ | end | ||
+ | end</ | ||
+ | |||
+ | ===== Semi-automatic logfile parsing and PRT creation ===== | ||
+ | The onsets have supposedly already been transformed into a tabular structure (e.g. in Microsoft Excel), so that they look like this: | ||
+ | |||
+ | < | ||
+ | 20216 3 nan nan 5003 nan nan | ||
+ | 20216 nan 3003 nan nan 18003 nan | ||
+ | 20216 18000 nan nan 23000 nan nan | ||
+ | 20216 nan nan 21000 nan nan 26000 | ||
+ | 20216 74057 nan nan 79057 nan nan | ||
+ | 20216 nan 77057 nan nan 92057 nan | ||
+ | 20216 92068 nan nan 97068 nan nan | ||
+ | 20216 nan nan 95067 nan nan 100067 | ||
+ | 20216 148112 nan nan 153112 nan nan | ||
+ | 20216 nan 151112 nan nan 166112 nan | ||
+ | 20216 166122 nan nan 171122 nan nan | ||
+ | 20216 nan nan 169122 nan nan 174122 | ||
+ | 20216 1 nan nan 5001 nan nan | ||
+ | 20216 nan 3001 nan nan 18001 nan | ||
+ | 20216 17999 nan nan 22999 nan nan | ||
+ | 20216 nan nan 21011 nan nan 26011 | ||
+ | 20216 74056 nan nan 79056 nan nan | ||
+ | 20216 nan 77056 nan nan 92056 nan | ||
+ | 20216 92066 nan nan 97066 nan nan | ||
+ | 20216 nan nan 95065 nan nan 100065 | ||
+ | 20216 148110 nan nan 153110 nan nan | ||
+ | 20216 nan 151110 nan nan 166110 nan | ||
+ | 20216 166120 nan nan 171120 nan nan | ||
+ | 20216 nan nan 169120 nan nan 174120 </ | ||
+ | |||
+ | In this table, the first column codes for the subject ID (which is used to detect when next subject occurs, in this sample there is only one subject!). The next three columns code the onset and the final three columns the offset of the three conditions used in this experiment (INST = Instruction, | ||
+ | |||
+ | The following script will then create a set of PRT files out of this table (which can be copied into Matlab): | ||
+ | |||
+ | <code matlab SCANUnit_CPU_prtfromtable.m> | ||
+ | |||
+ | % configuration | ||
+ | conds = {' | ||
+ | condcol = [255, 0, 0; 0, 255, 0; 0, 0, 255]; | ||
+ | |||
+ | % find unique subject IDs | ||
+ | subjid = unique(ot(:, | ||
+ | |||
+ | % for each subject ID | ||
+ | for sc = 1: | ||
+ | |||
+ | % get this subject' | ||
+ | sot = ot(ot(:, 1) == subjid(sc), :); | ||
+ | | ||
+ | % set NaNs to zero (for now) | ||
+ | sot(isnan(sot)) = 0; | ||
+ | | ||
+ | % get onsets and offsets of any trial | ||
+ | onsets = sum(sot(:, 2: | ||
+ | | ||
+ | % get table with NaNs (again) for condition detection | ||
+ | sot = ot(ot(:, 1) == subjid(sc), :); | ||
+ | | ||
+ | % find run-separators | ||
+ | runseps = 1 + [0; find(diff(onsets) < 0)]; | ||
+ | runseps(end+1) = numel(onsets) + 1; | ||
+ | | ||
+ | % for each run | ||
+ | for rc = 1: | ||
+ | | ||
+ | % get part of table we need | ||
+ | rot = sot(runseps(rc): | ||
+ | | ||
+ | % create new PRT | ||
+ | prt = xff(' | ||
+ | | ||
+ | % for each condition | ||
+ | for cc = 1: | ||
+ | | ||
+ | % add to PRT | ||
+ | prt.AddCond(conds{cc}, | ||
+ | end | ||
+ | | ||
+ | % save PRT | ||
+ | prt.SaveAs(sprintf(' | ||
+ | | ||
+ | % clear object | ||
+ | prt.ClearObject; | ||
end | end | ||
end</ | end</ |
processing_stream_-_scripted.txt · Last modified: 2010/06/17 19:42 by jochen