Last active
December 29, 2019 08:30
-
-
Save ofgulban/61489e95fd16ec6a1ac13c0d8be157e9 to your computer and use it in GitHub Desktop.
Brainvoyager batch fmr preprocessing scripting example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Brainvoyager batch script for functional MRI data (.fmr) preprocessing. | |
| // | |
| // For more information, check the scripting guide: | |
| // http://support.brainvoyager.com/automation-aamp-development/46-writing-scripts/133-scripting-reference-guide.html | |
| var bvqx = BrainVoyagerQX; | |
| bvqx.PrintToLog("---"); | |
| //---------------------------------------------------------------- | |
| // Enter the following values: | |
| var RunPrefix = "RUN_"; | |
| var NumberOfRuns = 4; | |
| // Enter fmr file paths | |
| var InFmrList = ["/path/to/your/subject/RUN_1/S01_RUN_01.fmr", | |
| "/path/to/your/subject/RUN_2/S01_RUN_02.fmr", | |
| "/path/to/your/subject/RUN_3/S01_RUN_03.fmr", | |
| "/path/to/your/subject/RUN_4/S01_RUN_04.fmr"] | |
| //Enter the reference fmr volume path. | |
| var TargetVolumeFile = "/path/to/your/subject/RUN_4/S01_RUN_04.fmr" | |
| //---------------------------------------------------------------- | |
| for(count = 1; count <= NumberOfRuns; count++){ | |
| var InFmrPath = InFmrList[count-1]; | |
| // Open the run | |
| var docFMR = bvqx.OpenDocument(InFmrPath); | |
| // Slice scan time correction | |
| docFMR.CorrectSliceTimingUsingTimeTable(2); // 0: trilinear, 1: cubic spline, 2: windowed sinc | |
| ResultFileName = docFMR.FileNameOfPreprocessdFMR; | |
| docFMR.Close(); | |
| docFMR = bvqx.OpenDocument(ResultFileName); | |
| // Motion Corection | |
| docFMR.CorrectMotionTargetVolumeInOtherRunEx(TargetVolumeFile, | |
| 1, // target volume number | |
| 2, // 0 and 1:trilin./trilin., 2:trilin/sinc, 3:sinc/sinc | |
| false, // use full data set(default: false) | |
| 150, // maximum number of iterations(default: 100) | |
| false, // generate movie | |
| true // motion estimation parameters in a text file | |
| ); | |
| ResultFileName = docFMR.FileNameOfPreprocessdFMR; | |
| docFMR.Close(); | |
| docFMR = bvqx.OpenDocument(ResultFileName); | |
| // High-pass filtering (note: BV first applies linear trend removal [LTR]) | |
| docFMR.TemporalHighPassFilterGLMFourier(6); | |
| ResultFileName = docFMR.FileNameOfPreprocessdFMR; | |
| docFMR.Close(); | |
| docFMR = bvqx.OpenDocument(ResultFileName); | |
| // Temporal smoothing | |
| docFMR.TemporalGaussianSmoothing(2, "TR"); | |
| ResultFileName = docFMR.FileNameOfPreprocessdFMR; | |
| docFMR.Close(); | |
| docFMR = bvqx.OpenDocument(ResultFileName); | |
| bvqx.PrintToLog(InFmrPath + " is done."); | |
| }; | |
| bvqx.PrintToLog("Finished."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment