From 52704ab2a880c2c94ee7d41daabf3edd51f4683e Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Tue, 28 Jun 2022 12:46:15 +0200 Subject: [PATCH 01/12] add warning in case of creating empty roi --- src/roi/keepHemisphere.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/roi/keepHemisphere.m b/src/roi/keepHemisphere.m index 187b8a0..80c87f6 100644 --- a/src/roi/keepHemisphere.m +++ b/src/roi/keepHemisphere.m @@ -45,6 +45,10 @@ hdr.fname = spm_file(inputImage, 'filename', bf.filename); + if not(any(vol(:))) + warning('This image will be empty:\n\t%s\n'); + end + spm_write_vol(hdr, vol); outputImage = hdr.fname; From 88b2f220e937085c4b1a0926cd81ed9a2be83321 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 11 Jul 2022 20:39:12 +0200 Subject: [PATCH 02/12] add AAL3 atlas --- atlas/AAL3/AAL3v1.nii.gz | Bin 0 -> 38939 bytes atlas/AAL3/AAL3v1_1mm.nii.gz | Bin 0 -> 118034 bytes atlas/AAL3/LUT.csv | 167 ++++++++++++++++++++++++++++++++++ src/atlas/copyAtlasToSpmDir.m | 54 +++++++++++ 4 files changed, 221 insertions(+) create mode 100644 atlas/AAL3/AAL3v1.nii.gz create mode 100644 atlas/AAL3/AAL3v1_1mm.nii.gz create mode 100755 atlas/AAL3/LUT.csv create mode 100644 src/atlas/copyAtlasToSpmDir.m diff --git a/atlas/AAL3/AAL3v1.nii.gz b/atlas/AAL3/AAL3v1.nii.gz new file mode 100644 index 0000000000000000000000000000000000000000..edbea31e0a65ec4884ea32172b5d4f08a4de37d4 GIT binary patch literal 38939 zcmdqIXH?T$*Y>*=1QAe>El5BS=}4%dH>D$OD}qu(4a88S7z6@Hks`eldPixY1q39B zXlS8E2!y6mBUKVgK;Yya&;6cr#`BzWzu(_EMn=9QV<+U;gXAVsrik zUucoJOJx17$=3?XxGMX=gSl+`W8%}I^NAr~-`^u|YR;Yeib&^2wKC^B=bkvTr{~UR zsG||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?!v0w7$^6poVCM z)dH5VaVgf_T6$P30Xev^C#Aj4$(u0IV%kBDBtbh*9o*wz+14x9z7m(^5OsCU49S(= zJzizW74nQWxG9yJ1D606w^}J)74Cz;y(91-YY+!;IUmtDm@;n10aa0(Uo2|Js)_|JMYkVXe-sd;riR9lb4jaNz^%UyTH_F!0l8r> z5U*04E1zhc$>X=FLS2~qY#)gCHOWU6NnVf#eTJeznPcA%xx_G`fZhaAGbT(oLCR~cJZwgeRFQ09QlqdBm-T&2KgG@)QMM@mdj#Olp& ze49n>_|3v*ZUsbD2pA(WSX@$_ec2m8weuuOG>=deK`-hUayLmq9LC7@U5zR6 zja^;>y()1F61)xKj;RkF2GBK6&W$?F9u9g(C|LDzLsN$pgYq3}bElAp%ymAETkMmWN0u30gg!qtbEWvmr#8d6EjCvboXgygGeX8!k-@@}lV67B25$O# zJ>e5Ub0Y-^+5h>H{pZ#HT!H_`SAh1VQC@!868L35*UZ`={o+5r{&NNXf4Bl+$@i3Q KpGt^W@_zt43R8jr literal 0 HcmV?d00001 diff --git a/atlas/AAL3/LUT.csv b/atlas/AAL3/LUT.csv new file mode 100755 index 0000000..492bd38 --- /dev/null +++ b/atlas/AAL3/LUT.csv @@ -0,0 +1,167 @@ +label,ROI,hemi +1,Precentral,L +2,Precentral,R +3,Frontal_Sup_2,L +4,Frontal_Sup_2,R +5,Frontal_Mid_2,L +6,Frontal_Mid_2,R +7,Frontal_Inf_Oper,L +8,Frontal_Inf_Oper,R +9,Frontal_Inf_Tri,L +10,Frontal_Inf_Tri,R +11,Frontal_Inf_Orb_2,L +12,Frontal_Inf_Orb_2,R +13,Rolandic_Oper,L +14,Rolandic_Oper,R +15,Supp_Motor_Area,L +16,Supp_Motor_Area,R +17,Olfactory,L +18,Olfactory,R +19,Frontal_Sup_Medial,L +20,Frontal_Sup_Medial,R +21,Frontal_Med_Orb,L +22,Frontal_Med_Orb,R +23,Rectus,L +24,Rectus,R +25,OFCmed,L +26,OFCmed,R +27,OFCant,L +28,OFCant,R +29,OFCpost,L +30,OFCpost,R +31,OFClat,L +32,OFClat,R +33,Insula,L +34,Insula,R +37,Cingulate_Mid,L +38,Cingulate_Mid,R +39,Cingulate_Post,L +40,Cingulate_Post,R +41,Hippocampus,L +42,Hippocampus,R +43,ParaHippocampal,L +44,ParaHippocampal,R +45,Amygdala,L +46,Amygdala,R +47,Calcarine,L +48,Calcarine,R +49,Cuneus,L +50,Cuneus,R +51,Lingual,L +52,Lingual,R +53,Occipital_Sup,L +54,Occipital_Sup,R +55,Occipital_Mid,L +56,Occipital_Mid,R +57,Occipital_Inf,L +58,Occipital_Inf,R +59,Fusiform,L +60,Fusiform,R +61,Postcentral,L +62,Postcentral,R +63,Parietal_Sup,L +64,Parietal_Sup,R +65,Parietal_Inf,L +66,Parietal_Inf,R +67,SupraMarginal,L +68,SupraMarginal,R +69,Angular,L +70,Angular,R +71,Precuneus,L +72,Precuneus,R +73,Paracentral,Lobule,L +74,Paracentral,Lobule,R +75,Caudate,L +76,Caudate,R +77,Putamen,L +78,Putamen,R +79,Pallidum,L +80,Pallidum,R +83,Heschl,L +84,Heschl,R +85,Temporal_Sup,L +86,Temporal_Sup,R +87,Temporal_Pole_Sup,L +88,Temporal_Pole_Sup,R +89,Temporal_Mid,L +90,Temporal_Mid,R +91,Temporal_Pole_Mid,L +92,Temporal_Pole_Mid,R +93,Temporal_Inf,L +94,Temporal_Inf,R +95,Cerebellum_Crus1,L +96,Cerebellum_Crus1,R +97,Cerebellum_Crus2,L +98,Cerebellum_Crus2,R +99,Cerebellum_3,L +100,Cerebellum_3,R +101,Cerebellum_4_5,L +102,Cerebellum_4_5,R +103,Cerebellum_6,L +104,Cerebellum_6,R +105,Cerebellum_7b,L +106,Cerebellum_7b,R +107,Cerebellum_8,L +108,Cerebellum_8,R +109,Cerebellum_9,L +110,Cerebellum_9,R +111,Cerebellum_10,L +112,Cerebellum_10,R +113,Vermis_1_2 +114,Vermis_3 +115,Vermis_4_5 +116,Vermis_6 +117,Vermis_7 +118,Vermis_8 +119,Vermis_9 +120,Vermis_10 +121,Thal_AV,L +122,Thal_AV,R +123,Thal,LP,L +124,Thal,LP,R +125,Thal_VA,L +126,Thal_VA,R +127,Thal_VL,L +128,Thal_VL,R +129,Thal_VPL,L +130,Thal_VPL,R +131,Thal_IL,L +132,Thal_IL,R +133,Thal,Re,L +134,Thal,Re,R +135,Thal_MDm,L +136,Thal_MDm,R +137,Thal_MDl,L +138,Thal_MDl,R +139,Thal,LGN,L +140,Thal,LGN,R +141,Thal_MGN,L +142,Thal_MGN,R +143,Thal_PuI,L +144,Thal_PuI,R +145,Thal_PuM,L +146,Thal_PuM,R +147,Thal_PuA,L +148,Thal_PuA,R +149,Thal_PuL,L +150,Thal_PuL,R +151,ACC_sub,L +152,ACC_sub,R +153,ACC_pre,L +154,ACC_pre,R +155,ACC_sup,L +156,ACC_sup,R +157,N_Acc,L +158,N_Acc,R +159,VTA,L +160,VTA,R +161,SN_pc,L +162,SN_pc,R +163,SN_pr,L +164,SN_pr,R +165,Red_N,L +166,Red_N,R +167,LC,L +168,LC,R +169,Raphe_D,n/a +170,Raphe_M,n/a diff --git a/src/atlas/copyAtlasToSpmDir.m b/src/atlas/copyAtlasToSpmDir.m new file mode 100644 index 0000000..b13edc3 --- /dev/null +++ b/src/atlas/copyAtlasToSpmDir.m @@ -0,0 +1,54 @@ +function copyAtlasToSpmDir(atlas) + % + % copies a given atlas to the SPM atlas dir + % + % USAGE:: + % + % copyAtlasToSpmDir(atlas) + % + % :param atlas: Any of ``{'AAL'}``. Defaults to ``'AAL'`` + % :type atlas: char + % + % (C) Copyright 2022 CPP_SPM developers + + if nargin < 1 + atlas = 'AAL'; + end + + spmAtlasDir = fullfile(spm('dir'), 'atlas'); + cppRoiAtlasDir = returnAtlasDir(); + + switch lower(atlas) + + case 'aal' + sourceAtlasImage = fullfile(cppRoiAtlasDir, 'AAL3', 'AAL3v1_1mm.nii.gz'); + sourceAtlasXml = fullfile(cppRoiAtlasDir, 'AAL3', 'AAL3v1_1mm.xml'); + end + + targetAtlasImage = fullfile(spmAtlasDir, spm_file(sourceAtlasImage, 'filename')); + targetAtlasXml = fullfile(spmAtlasDir, spm_file(sourceAtlasXml, 'filename')); + + atlasPresent = isdir(spmAtlasDir) && ... + exist(targetAtlasImage(1:end-3), 'file') && ... + exist(targetAtlasXml, 'file'); + + if ~atlasPresent + fprintf('\nCopying atlas "%s" to spm atlas directory:\n\t%s\n', ... + atlas, ... + spmAtlasDir) + spm_mkdir(spmAtlasDir); + + copyfile(sourceAtlasImage, spmAtlasDir); + gunzip(fullfile(spmAtlasDir, '*.nii.gz')) + delete(fullfile(spmAtlasDir, '*.nii.gz')) + + copyfile(sourceAtlasXml, spmAtlasDir); + + else + fprintf('\nAtlas "%s" already in spm atlas directory:\n\t%s\n', ... + atlas, ... + spmAtlasDir) + + end + +end \ No newline at end of file From 0579645ab8bd7fb8528b5d53df079566a716716a Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 11 Jul 2022 20:56:33 +0200 Subject: [PATCH 03/12] make the copy atlas functional optionally verbose --- docs/source/atlas.rst | 1 + src/atlas/copyAtlasToSpmDir.m | 72 +++++++++++++++++++++-------------- 2 files changed, 44 insertions(+), 29 deletions(-) diff --git a/docs/source/atlas.rst b/docs/source/atlas.rst index 58561ae..4d10f91 100644 --- a/docs/source/atlas.rst +++ b/docs/source/atlas.rst @@ -6,3 +6,4 @@ Atlas .. autofunction:: extractRoiFromAtlas .. autofunction:: extractRoiByLabel .. autofunction:: labelClusters +.. autofunction:: copyAtlasToSpmDir diff --git a/src/atlas/copyAtlasToSpmDir.m b/src/atlas/copyAtlasToSpmDir.m index b13edc3..204f6f2 100644 --- a/src/atlas/copyAtlasToSpmDir.m +++ b/src/atlas/copyAtlasToSpmDir.m @@ -1,54 +1,68 @@ -function copyAtlasToSpmDir(atlas) +function copyAtlasToSpmDir(varargin) % - % copies a given atlas to the SPM atlas dir + % Copies a given atlas to the SPM atlas directory. % % USAGE:: % - % copyAtlasToSpmDir(atlas) + % copyAtlasToSpmDir(atlas, 'verbose', false) % % :param atlas: Any of ``{'AAL'}``. Defaults to ``'AAL'`` % :type atlas: char % - % (C) Copyright 2022 CPP_SPM developers - - if nargin < 1 - atlas = 'AAL'; - end - + % :param verbose: Defaults to ``false`` + % :type verbose: boolean + % + % + % (C) Copyright 2022 CPP ROI developers + + args = inputParser; + + addOptional(args, 'atlas', 'AAL', @ischar); + addParameter(args, 'verbose', false, @islogical); + + parse(args, varargin{:}); + + atlas = args.Results.atlas; + verbose = args.Results.verbose; + spmAtlasDir = fullfile(spm('dir'), 'atlas'); cppRoiAtlasDir = returnAtlasDir(); - + switch lower(atlas) - + case 'aal' sourceAtlasImage = fullfile(cppRoiAtlasDir, 'AAL3', 'AAL3v1_1mm.nii.gz'); sourceAtlasXml = fullfile(cppRoiAtlasDir, 'AAL3', 'AAL3v1_1mm.xml'); end - + targetAtlasImage = fullfile(spmAtlasDir, spm_file(sourceAtlasImage, 'filename')); targetAtlasXml = fullfile(spmAtlasDir, spm_file(sourceAtlasXml, 'filename')); - + atlasPresent = isdir(spmAtlasDir) && ... - exist(targetAtlasImage(1:end-3), 'file') && ... + exist(targetAtlasImage(1:end - 3), 'file') && ... exist(targetAtlasXml, 'file'); - + if ~atlasPresent - fprintf('\nCopying atlas "%s" to spm atlas directory:\n\t%s\n', ... - atlas, ... - spmAtlasDir) + if verbose + fprintf('\nCopying atlas "%s" to spm atlas directory:\n\t%s\n', ... + atlas, ... + spmAtlasDir); + end spm_mkdir(spmAtlasDir); - + copyfile(sourceAtlasImage, spmAtlasDir); - gunzip(fullfile(spmAtlasDir, '*.nii.gz')) - delete(fullfile(spmAtlasDir, '*.nii.gz')) - + gunzip(fullfile(spmAtlasDir, '*.nii.gz')); + delete(fullfile(spmAtlasDir, '*.nii.gz')); + copyfile(sourceAtlasXml, spmAtlasDir); - + else - fprintf('\nAtlas "%s" already in spm atlas directory:\n\t%s\n', ... - atlas, ... - spmAtlasDir) - + if verbose + fprintf('\nAtlas "%s" already in spm atlas directory:\n\t%s\n', ... + atlas, ... + spmAtlasDir); + end + end - -end \ No newline at end of file + +end From d693a722ad6c92b445ef1f5862e096e6fa354a10 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 11 Jul 2022 21:00:19 +0200 Subject: [PATCH 04/12] add tests for copy atlas function --- tests/test_copyAtlasToSpmDir.m | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/test_copyAtlasToSpmDir.m diff --git a/tests/test_copyAtlasToSpmDir.m b/tests/test_copyAtlasToSpmDir.m new file mode 100644 index 0000000..af83353 --- /dev/null +++ b/tests/test_copyAtlasToSpmDir.m @@ -0,0 +1,22 @@ +function test_suite = test_copyAtlasToSpmDir %#ok<*STOUT> + % (C) Copyright 2022 CPP ROI developers + try % assignment of 'localfunctions' is necessary in Matlab >= 2016 + test_functions = localfunctions(); %#ok<*NASGU> + catch % no problem; early Matlab versions can use initTestSuite fine + end + initTestSuite; +end + +function test_copyAtlasToSpmDir_basic() + + copyAtlasToSpmDir('AAL', 'verbose', false); + + spmAtlasDir = fullfile(spm('dir'), 'atlas'); + + targetAtlasImage = fullfile(spmAtlasDir, 'AAL3v1_1mm.nii'); + targetAtlasXml = fullfile(spmAtlasDir, 'AAL3v1_1mm.xml'); + + assertEqual(exist(targetAtlasImage, 'file'), 2); + assertEqual(exist(targetAtlasXml, 'file'), 2); + +end From 63f3c1ee0abbea80ec8792cfbb54421ee4a6baef Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 11 Jul 2022 21:18:46 +0200 Subject: [PATCH 05/12] silence test in CI --- tests/test_copyAtlasToSpmDir.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_copyAtlasToSpmDir.m b/tests/test_copyAtlasToSpmDir.m index af83353..7f6634e 100644 --- a/tests/test_copyAtlasToSpmDir.m +++ b/tests/test_copyAtlasToSpmDir.m @@ -9,6 +9,10 @@ function test_copyAtlasToSpmDir_basic() + if isGithubCi() + return + end + copyAtlasToSpmDir('AAL', 'verbose', false); spmAtlasDir = fullfile(spm('dir'), 'atlas'); From 5af848e4a23a668cae0d646b456e66f55bb4a142 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 11 Jul 2022 21:19:26 +0200 Subject: [PATCH 06/12] FCI --- .github/workflows/run_tests_matlab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tests_matlab.yml b/.github/workflows/run_tests_matlab.yml index d6c1f34..cefaced 100644 --- a/.github/workflows/run_tests_matlab.yml +++ b/.github/workflows/run_tests_matlab.yml @@ -20,7 +20,7 @@ on: workflow_dispatch: jobs: - build: + tests_matlab: runs-on: ubuntu-20.04 steps: From d20014bf639cb98447e61b67b667f817c463ad2f Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Tue, 20 Sep 2022 18:12:48 +0200 Subject: [PATCH 07/12] add AAL xml atlas --- .gitignore | 1 - atlas/AAL3/AAL3v1_1mm.xml | 183 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 atlas/AAL3/AAL3v1_1mm.xml diff --git a/.gitignore b/.gitignore index 34bafd1..19db602 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ *.nii *.json -*.xml *.log *.mat *.html diff --git a/atlas/AAL3/AAL3v1_1mm.xml b/atlas/AAL3/AAL3v1_1mm.xml new file mode 100644 index 0000000..c923bad --- /dev/null +++ b/atlas/AAL3/AAL3v1_1mm.xml @@ -0,0 +1,183 @@ + + +

+ AAL3v1_1mm + 3.0 + AAL3v1_1mm + + + MNI + Label + + AAL3v1_1mm.nii + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 3fe37d2b2278c8799e34eeec6e21e423e02f990e Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Wed, 2 Nov 2022 12:10:51 +0100 Subject: [PATCH 08/12] update copyright in help and simplify CI --- .github/workflows/miss_hit.yml | 45 ------------------- .github/workflows/update-contributors.yml | 53 ----------------------- .tributors | 33 -------------- requirements.txt | 2 +- src/atlas/copyAtlasToSpmDir.m | 1 + src/atlas/extractRoiByLabel.m | 1 + src/atlas/extractRoiFromAtlas.m | 1 + src/atlas/getAtlasAndLut.m | 1 + src/atlas/getAtlasFilename.m | 1 + src/atlas/getLookUpTable.m | 1 + src/atlas/labelClusters.m | 1 + src/atlas/unzipAtlas.m | 1 + src/roi/checkRoiOrientation.m | 1 + src/roi/createRoi.m | 1 + src/roi/createRoiName.m | 1 + src/roi/getPeakCoordinates.m | 1 + src/roi/keepHemisphere.m | 1 + src/roi/plotDataInRoi.m | 1 + src/roi/renameNeuroSynth.m | 1 + src/roi/resliceRoiImages.m | 1 + src/roi/thresholdToMask.m | 1 + src/utils/cppRoiRoot.m | 1 + src/utils/getClusters.m | 1 + src/utils/isBinaryMask.m | 1 + src/utils/optimizeSubplotNumber.m | 1 + src/utils/removePrefix.m | 1 + src/utils/sortAndLabelClusters.m | 1 + src/utils/sortAndThresholdClusters.m | 1 + 28 files changed, 25 insertions(+), 132 deletions(-) delete mode 100644 .github/workflows/miss_hit.yml delete mode 100644 .github/workflows/update-contributors.yml delete mode 100644 .tributors diff --git a/.github/workflows/miss_hit.yml b/.github/workflows/miss_hit.yml deleted file mode 100644 index ea96582..0000000 --- a/.github/workflows/miss_hit.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: miss_hit - -on: - push: - branches: - - main - - dev - paths: - - '**.m' - pull_request: - branches: ['*'] - paths: - - '**.m' - -jobs: - - miss_hit: - - runs-on: ubuntu-latest - - strategy: - matrix: - command: ["mh_style", "mh_metric --ci && mh_lint"] - fail-fast: true # cancel all jobs if one fails - - steps: - - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 1 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools - pip3 install -r requirements.txt - - - name: ${{ matrix.command }} - run: | - ${{ matrix.command }} diff --git a/.github/workflows/update-contributors.yml b/.github/workflows/update-contributors.yml deleted file mode 100644 index ede8786..0000000 --- a/.github/workflows/update-contributors.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: allcontributors-auto-detect - -on: - schedule: - # Run nightly 1am - - cron: 0 1 1 * * - - # You can also have it check for changes on each push to master - push: - branches: - - main - -jobs: - Update: - name: Generate - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - name: Tributors Update - - # Important! Update to release https://github.com/con/tributors - uses: con/tributors@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - - # Single text list (space separated) of parsers, leave unset to auto-detect - parsers: unset - - # INFO, DEBUG, ERROR, WARNING, etc. - log_level: DEBUG - - # If files already exist and an init is done, force overwrite - force: true - - # the minimum number of contributions required to add a user - threshold: 1 - - - name: Create Pull Request - id: cpr - uses: peter-evans/create-pull-request@v4 - with: - commit-message: update tributors - base: main - delete-branch: true - title: '[BOT] update tributors' - body: 'done via this [GitHub Action](https://github.com/cpp-lln-lab/CPP_ROI/blob/main/.github/workflows/update-contributors.yml)' - - - name: Check outputs - run: | - echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" diff --git a/.tributors b/.tributors deleted file mode 100644 index 514406a..0000000 --- a/.tributors +++ /dev/null @@ -1,33 +0,0 @@ -{ - "marcobarilari": { - "name": "Marco Barilari", - "blog": "https://github.com/marcobarilari", - "orcid": "0000-0002-3313-3120" - }, - "Remi-Gau": { - "name": "Remi Gau", - "blog": "https://github.com/Remi-Gau", - "orcid": "0000-0002-1535-9767", - "affiliation": "Université catholique de Louvain" - }, - "JeanneCaronGuyon ": { - "name": "Jeanne Caron-Guyon ", - "blog": "https://github.com/JeanneCaronGuyon" - }, - "iqrashahzad14": { - "name": "Iqra Shahzad", - "blog": "https://github.com/iqrashahzad14" - }, - "fedefalag": { - "name": "Federica Falagiarda", - "blog": "https://github.com/fedefalag", - "orcid": "0000-0001-7844-1605", - "affiliation": "Université catholique de Louvain" - }, - "CerenB": { - "name": "Ceren Battal", - "blog": "https://github.com/CerenB", - "orcid": "0000-0002-9844-7630", - "affiliation": "Université catholique de Louvain" - } -} diff --git a/requirements.txt b/requirements.txt index 8e6c176..c8dc86a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # linting -miss_hit==0.9.30 +miss_hit==0.9.35 pre-commit # doc diff --git a/src/atlas/copyAtlasToSpmDir.m b/src/atlas/copyAtlasToSpmDir.m index 204f6f2..a83abae 100644 --- a/src/atlas/copyAtlasToSpmDir.m +++ b/src/atlas/copyAtlasToSpmDir.m @@ -13,6 +13,7 @@ function copyAtlasToSpmDir(varargin) % :type verbose: boolean % % + % (C) Copyright 2022 CPP ROI developers args = inputParser; diff --git a/src/atlas/extractRoiByLabel.m b/src/atlas/extractRoiByLabel.m index 95520a0..1be4164 100644 --- a/src/atlas/extractRoiByLabel.m +++ b/src/atlas/extractRoiByLabel.m @@ -14,6 +14,7 @@ % and ``label`` for the corresponding label % :type labelStruct: structure % + % (C) Copyright 2021 CPP ROI developers hdr = spm_vol(sourceImage); diff --git a/src/atlas/extractRoiFromAtlas.m b/src/atlas/extractRoiFromAtlas.m index 565cb83..e4a401d 100644 --- a/src/atlas/extractRoiFromAtlas.m +++ b/src/atlas/extractRoiFromAtlas.m @@ -16,6 +16,7 @@ % :type roiName: string % :type hemisphere: string % + % (C) Copyright 2021 CPP ROI developers if ~ismember(hemisphere, {'L', 'R'}) diff --git a/src/atlas/getAtlasAndLut.m b/src/atlas/getAtlasAndLut.m index 7c24de5..6e451de 100644 --- a/src/atlas/getAtlasAndLut.m +++ b/src/atlas/getAtlasAndLut.m @@ -3,6 +3,7 @@ % Gets the atlas image and the look up table of a given atlas % % + % (C) Copyright 2021 CPP ROI developers lut = getLookUpTable(atlasName); diff --git a/src/atlas/getAtlasFilename.m b/src/atlas/getAtlasFilename.m index 53489a2..70d471e 100644 --- a/src/atlas/getAtlasFilename.m +++ b/src/atlas/getAtlasFilename.m @@ -14,6 +14,7 @@ % PMID: 25452571 % Probabilistic Maps of Visual Topography in Human Cortex % + % (C) Copyright 2021 CPP ROI developers atlasDir = returnAtlasDir(atlasName); diff --git a/src/atlas/getLookUpTable.m b/src/atlas/getLookUpTable.m index c851f60..6dfeaf2 100644 --- a/src/atlas/getLookUpTable.m +++ b/src/atlas/getLookUpTable.m @@ -10,6 +10,7 @@ % % :returns: - :roiLabelLUT: a structure with the fields ``ROI`` and ``label`` % + % (C) Copyright 2021 CPP ROI developers if exist(atlasName, 'file') diff --git a/src/atlas/labelClusters.m b/src/atlas/labelClusters.m index 21c8ac8..03ffb01 100644 --- a/src/atlas/labelClusters.m +++ b/src/atlas/labelClusters.m @@ -21,6 +21,7 @@ % Adapted from: % https://en.wikibooks.org/wiki/SPM/How-to#How_to_remove_clusters_under_a_certain_size_in_a_binary_mask? % + % (C) Copyright 2021 CPP ROI developers default_clusterSize = 0; diff --git a/src/atlas/unzipAtlas.m b/src/atlas/unzipAtlas.m index dee8432..5e99567 100644 --- a/src/atlas/unzipAtlas.m +++ b/src/atlas/unzipAtlas.m @@ -1,5 +1,6 @@ function unzipAtlas(atlas) % + % (C) Copyright 2021 CPP ROI developers atlasDir = returnAtlasDir(); diff --git a/src/roi/checkRoiOrientation.m b/src/roi/checkRoiOrientation.m index c53a7a2..7f73c10 100644 --- a/src/roi/checkRoiOrientation.m +++ b/src/roi/checkRoiOrientation.m @@ -10,6 +10,7 @@ % :param imagesToCheck: better if fullfile path % :type imagesToCheck: string % + % (C) Copyright 2021 CPP ROI developers % TODO diff --git a/src/roi/createRoi.m b/src/roi/createRoi.m index 4e8407f..2d53cdb 100644 --- a/src/roi/createRoi.m +++ b/src/roi/createRoi.m @@ -67,6 +67,7 @@ % - ``mask.global.XYZmm`` % % + % (C) Copyright 2021 CPP ROI developers args = inputParser; diff --git a/src/roi/createRoiName.m b/src/roi/createRoiName.m index 0039fee..a208d85 100644 --- a/src/roi/createRoiName.m +++ b/src/roi/createRoiName.m @@ -6,6 +6,7 @@ % % roiName = createRoiName(mask, volumeDefiningImage) % + % (C) Copyright 2022 CPP ROI developers args = inputParser; diff --git a/src/roi/getPeakCoordinates.m b/src/roi/getPeakCoordinates.m index 5e3beb5..255d2e6 100644 --- a/src/roi/getPeakCoordinates.m +++ b/src/roi/getPeakCoordinates.m @@ -17,6 +17,7 @@ % :type threshold: numerical % % + % (C) Copyright 2021 CPP ROI developers % TODO diff --git a/src/roi/keepHemisphere.m b/src/roi/keepHemisphere.m index 80c87f6..4619a56 100644 --- a/src/roi/keepHemisphere.m +++ b/src/roi/keepHemisphere.m @@ -13,6 +13,7 @@ % :type hemisphere: string % % + % (C) Copyright 2021 CPP ROI developers % TODO change the hemi entity diff --git a/src/roi/plotDataInRoi.m b/src/roi/plotDataInRoi.m index 8ec3a42..8d31f76 100644 --- a/src/roi/plotDataInRoi.m +++ b/src/roi/plotDataInRoi.m @@ -52,6 +52,7 @@ % plotDataInRoi(data, mask); % % + % (C) Copyright 2022 CPP ROI developers defaultNbBins = 100; diff --git a/src/roi/renameNeuroSynth.m b/src/roi/renameNeuroSynth.m index 0318bca..74d7243 100644 --- a/src/roi/renameNeuroSynth.m +++ b/src/roi/renameNeuroSynth.m @@ -16,6 +16,7 @@ % fullfile(pwd, 'space-MNI_label-neurosynthMotion_probseg.nii.gz'); % % + % (C) Copyright 2021 CPP ROI developers basename = spm_file(inputImage, 'basename'); diff --git a/src/roi/resliceRoiImages.m b/src/roi/resliceRoiImages.m index a5bbdaa..05d8be6 100644 --- a/src/roi/resliceRoiImages.m +++ b/src/roi/resliceRoiImages.m @@ -15,6 +15,7 @@ % :param dryRun: Returns the matlabbatch without running it. % :type dryRun: logical % + % (C) Copyright 2021 CPP ROI developers % TODO diff --git a/src/roi/thresholdToMask.m b/src/roi/thresholdToMask.m index 9317daa..e46db5c 100644 --- a/src/roi/thresholdToMask.m +++ b/src/roi/thresholdToMask.m @@ -16,6 +16,7 @@ % % :returns: - :outputImage: (string) % + % (C) Copyright 2021 CPP ROI developers % TODO diff --git a/src/utils/cppRoiRoot.m b/src/utils/cppRoiRoot.m index 3f8a82f..f313dd4 100644 --- a/src/utils/cppRoiRoot.m +++ b/src/utils/cppRoiRoot.m @@ -6,6 +6,7 @@ % pth = cppRoiRoot() % % + % (C) Copyright 2022 CPP ROI developers pth = fullfile(fileparts(mfilename('fullpath')), '..', '..'); diff --git a/src/utils/getClusters.m b/src/utils/getClusters.m index 88dcbc4..7698514 100644 --- a/src/utils/getClusters.m +++ b/src/utils/getClusters.m @@ -11,6 +11,7 @@ % % See also labelClusters, sortAndLabelClusters % + % (C) Copyright 2021 CPP ROI developers hdr = spm_vol(inputImage); diff --git a/src/utils/isBinaryMask.m b/src/utils/isBinaryMask.m index ad6e1a5..2c1d7f0 100644 --- a/src/utils/isBinaryMask.m +++ b/src/utils/isBinaryMask.m @@ -1,5 +1,6 @@ function status = isBinaryMask(image) % + % (C) Copyright 2022 CPP ROI developers status = true; diff --git a/src/utils/optimizeSubplotNumber.m b/src/utils/optimizeSubplotNumber.m index 1b6e92a..276eb5c 100644 --- a/src/utils/optimizeSubplotNumber.m +++ b/src/utils/optimizeSubplotNumber.m @@ -1,5 +1,6 @@ function [m, n] = optimizeSubplotNumber(mn) % + % (C) Copyright 2022 CPP ROI developers % Optimizes the number of subplot to have on a figure diff --git a/src/utils/removePrefix.m b/src/utils/removePrefix.m index 0947e14..a42f6a0 100644 --- a/src/utils/removePrefix.m +++ b/src/utils/removePrefix.m @@ -1,5 +1,6 @@ function image = removePrefix(image, prefix) % + % (C) Copyright 2019 CPP ROI developers basename = spm_file(image, 'basename'); diff --git a/src/utils/sortAndLabelClusters.m b/src/utils/sortAndLabelClusters.m index 2b82f7d..d985c5a 100644 --- a/src/utils/sortAndLabelClusters.m +++ b/src/utils/sortAndLabelClusters.m @@ -12,6 +12,7 @@ % % See also: getClusters, labelClusters % + % (C) Copyright 2021 CPP ROI developers % refactor with sortAndThresholdClusters diff --git a/src/utils/sortAndThresholdClusters.m b/src/utils/sortAndThresholdClusters.m index 5c09ddf..6d38542 100644 --- a/src/utils/sortAndThresholdClusters.m +++ b/src/utils/sortAndThresholdClusters.m @@ -1,5 +1,6 @@ function vol = sortAndThresholdClusters(l2, num, clusterSize) % + % (C) Copyright 2020 CPP ROI developers [n, ni] = sort(histc(l2(:), 0:num), 1, 'descend'); From 7c1dd7aa023bdf507367bba169d8d5cb510f1818 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Wed, 2 Nov 2022 12:13:32 +0100 Subject: [PATCH 09/12] [DATALAD] Added subdataset --- .gitmodules | 4 ++++ lib/marsbar | 1 + 2 files changed, 5 insertions(+) create mode 100644 .gitmodules create mode 160000 lib/marsbar diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..39f102c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "lib/marsbar"] + path = lib/marsbar + url = https://github.com/marsbar-toolbox/marsbar.git + datalad-url = https://github.com/marsbar-toolbox/marsbar.git diff --git a/lib/marsbar b/lib/marsbar new file mode 160000 index 0000000..fdbefc3 --- /dev/null +++ b/lib/marsbar @@ -0,0 +1 @@ +Subproject commit fdbefc3d4c2fcb8ae074dd99a2664da35bc55afe From c41d4d355587a57f4f7ea52d29104e484548c29b Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Wed, 2 Nov 2022 12:14:41 +0100 Subject: [PATCH 10/12] simplify CI --- .github/workflows/run_tests_matlab.yml | 11 +- initCppRoi.m | 2 +- lib/marsbar-0.44/@mardo/add_contrasts.m | 172 -- lib/marsbar-0.44/@mardo/adjusted_data.m | 33 - lib/marsbar-0.44/@mardo/betas.m | 10 - lib/marsbar-0.44/@mardo/block_mean_cols.m | 8 - lib/marsbar-0.44/@mardo/block_means.m | 18 - lib/marsbar-0.44/@mardo/cd_images.m | 63 - lib/marsbar-0.44/@mardo/contrasts.m | 11 - lib/marsbar-0.44/@mardo/data.m | 10 - lib/marsbar-0.44/@mardo/des_struct.m | 11 - lib/marsbar-0.44/@mardo/descrip.m | 11 - lib/marsbar-0.44/@mardo/design_matrix.m | 7 - lib/marsbar-0.44/@mardo/design_structure.m | 12 - lib/marsbar-0.44/@mardo/display.m | 35 - lib/marsbar-0.44/@mardo/error_df.m | 7 - lib/marsbar-0.44/@mardo/event_fitted.m | 54 - lib/marsbar-0.44/@mardo/event_fitted_fir.m | 158 -- lib/marsbar-0.44/@mardo/event_signal.m | 60 - lib/marsbar-0.44/@mardo/event_types.m | 19 - lib/marsbar-0.44/@mardo/event_types_named.m | 15 - lib/marsbar-0.44/@mardo/flip_images.m | 12 - lib/marsbar-0.44/@mardo/flip_option.m | 11 - lib/marsbar-0.44/@mardo/full_vol.m | 61 - .../@mardo/get_contrast_by_name.m | 29 - lib/marsbar-0.44/@mardo/get_contrasts.m | 11 - lib/marsbar-0.44/@mardo/get_data.m | 10 - lib/marsbar-0.44/@mardo/get_vol_field.m | 30 - lib/marsbar-0.44/@mardo/has_contrasts.m | 6 - lib/marsbar-0.44/@mardo/has_filter.m | 10 - lib/marsbar-0.44/@mardo/has_images.m | 6 - lib/marsbar-0.44/@mardo/has_whitener.m | 7 - lib/marsbar-0.44/@mardo/image_names.m | 11 - lib/marsbar-0.44/@mardo/images.m | 10 - lib/marsbar-0.44/@mardo/is_fmri.m | 6 - lib/marsbar-0.44/@mardo/is_mars_estimated.m | 6 - lib/marsbar-0.44/@mardo/is_marsed.m | 3 - lib/marsbar-0.44/@mardo/is_spm_estimated.m | 6 - lib/marsbar-0.44/@mardo/is_valid.m | 6 - lib/marsbar-0.44/@mardo/isempty.m | 6 - lib/marsbar-0.44/@mardo/isfield.m | 8 - lib/marsbar-0.44/@mardo/mardo.m | 310 --- lib/marsbar-0.44/@mardo/mars_tag.m | 16 - lib/marsbar-0.44/@mardo/marsy_data.m | 10 - lib/marsbar-0.44/@mardo/masking_struct.m | 12 - lib/marsbar-0.44/@mardo/modality.m | 6 - lib/marsbar-0.44/@mardo/n_effects.m | 7 - lib/marsbar-0.44/@mardo/n_time_points.m | 7 - lib/marsbar-0.44/@mardo/native_vol_ver.m | 6 - lib/marsbar-0.44/@mardo/paramfields.m | 8 - lib/marsbar-0.44/@mardo/prefix_images.m | 99 - lib/marsbar-0.44/@mardo/private/pr_ev_diff.m | 45 - .../@mardo/private/pr_refresh_et.m | 48 - lib/marsbar-0.44/@mardo/private/pr_sort_evs.m | 41 - lib/marsbar-0.44/@mardo/refresh_contrasts.m | 3 - lib/marsbar-0.44/@mardo/residuals.m | 30 - lib/marsbar-0.44/@mardo/savestruct.m | 28 - lib/marsbar-0.44/@mardo/set_contrasts.m | 34 - lib/marsbar-0.44/@mardo/set_data.m | 8 - lib/marsbar-0.44/@mardo/set_vol_field.m | 31 - lib/marsbar-0.44/@mardo/stat_table.m | 62 - lib/marsbar-0.44/@mardo/subsasgn.m | 9 - lib/marsbar-0.44/@mardo/subsref.m | 7 - lib/marsbar-0.44/@mardo/summary.m | 27 - lib/marsbar-0.44/@mardo/swd.m | 14 - lib/marsbar-0.44/@mardo/swd_writable.m | 15 - lib/marsbar-0.44/@mardo/type.m | 6 - lib/marsbar-0.44/@mardo/ui_et_edit.m | 293 --- lib/marsbar-0.44/@mardo/ui_et_edit_cb.m | 79 - lib/marsbar-0.44/@mardo/ui_event_types.m | 174 -- lib/marsbar-0.44/@mardo/ui_event_types_cb.m | 55 - lib/marsbar-0.44/@mardo/ui_ft_design_data.m | 99 - lib/marsbar-0.44/@mardo/ui_get_contrasts.m | 1526 -------------- .../@mardo/unfiltered_efficiency.m | 17 - lib/marsbar-0.44/@mardo/verbose.m | 11 - lib/marsbar-0.44/@mardo_2/add_trial_f.m | 36 - lib/marsbar-0.44/@mardo_2/apply_filter.m | 71 - lib/marsbar-0.44/@mardo_2/autocorr.m | 98 - lib/marsbar-0.44/@mardo_2/bf_dt.m | 7 - lib/marsbar-0.44/@mardo_2/block_cols.m | 14 - lib/marsbar-0.44/@mardo_2/block_rows.m | 20 - lib/marsbar-0.44/@mardo_2/can_mars_estimate.m | 6 - lib/marsbar-0.44/@mardo_2/compute_contrasts.m | 51 - lib/marsbar-0.44/@mardo_2/convert_vols.m | 51 - lib/marsbar-0.44/@mardo_2/design_vol.m | 32 - lib/marsbar-0.44/@mardo_2/estimate.m | 103 - lib/marsbar-0.44/@mardo_2/event_cols.m | 18 - lib/marsbar-0.44/@mardo_2/event_onsets.m | 40 - lib/marsbar-0.44/@mardo_2/event_regressor.m | 44 - lib/marsbar-0.44/@mardo_2/event_specs.m | 31 - lib/marsbar-0.44/@mardo_2/event_x_fir.m | 96 - lib/marsbar-0.44/@mardo_2/fill.m | 291 --- lib/marsbar-0.44/@mardo_2/fwhm.m | 10 - lib/marsbar-0.44/@mardo_2/get_images.m | 8 - lib/marsbar-0.44/@mardo_2/has_autocorr.m | 10 - lib/marsbar-0.44/@mardo_2/has_filter.m | 10 - lib/marsbar-0.44/@mardo_2/has_images.m | 10 - lib/marsbar-0.44/@mardo_2/has_whitener.m | 10 - lib/marsbar-0.44/@mardo_2/mardo_2.m | 123 -- lib/marsbar-0.44/@mardo_2/mardo_99.m | 105 - lib/marsbar-0.44/@mardo_2/mars_spm_graph.m | 591 ------ lib/marsbar-0.44/@mardo_2/modality.m | 12 - lib/marsbar-0.44/@mardo_2/private/my_design.m | 10 - .../@mardo_2/private/pr_estimate.m | 399 ---- .../@mardo_2/private/pr_fmri_design.m | 201 -- .../@mardo_2/private/pr_fmristat_ar.m | 79 - .../@mardo_2/private/pr_get_filter.m | 51 - lib/marsbar-0.44/@mardo_2/private/pr_spm_ce.m | 49 - .../@mardo_2/private/pr_spm_diff.m | 45 - .../@mardo_2/private/pr_spm_filter.m | 136 -- .../@mardo_2/private/pr_spm_get_bf.m | 180 -- .../@mardo_2/private/pr_spm_get_ons.m | 255 --- .../@mardo_2/private/pr_spm_gpdf.m | 94 - .../@mardo_2/private/pr_spm_hrf.m | 44 - .../@mardo_2/private/pr_spm_orth.m | 16 - lib/marsbar-0.44/@mardo_2/private/pr_spm_q.m | 19 - .../@mardo_2/private/pr_spm_reml.m | 135 -- .../@mardo_2/private/pr_spm_svd.m | 94 - lib/marsbar-0.44/@mardo_2/private/pr_spm_ui.m | 1393 ------------- .../@mardo_2/private/pr_spm_volterra.m | 91 - .../@mardo_2/private/pr_stat_compute.m | 81 - .../@mardo_2/private/pr_stat_compute_mv.m | 153 -- lib/marsbar-0.44/@mardo_2/save_spm.m | 42 - lib/marsbar-0.44/@mardo_2/savestruct.m | 28 - lib/marsbar-0.44/@mardo_2/set_images.m | 12 - lib/marsbar-0.44/@mardo_2/tr.m | 10 - lib/marsbar-0.44/@mardo_2/type.m | 6 - lib/marsbar-0.44/@mardo_2/ui_build.m | 27 - lib/marsbar-0.44/@mardo_2/ui_get_event.m | 39 - lib/marsbar-0.44/@mardo_2/ui_get_filter.m | 23 - lib/marsbar-0.44/@mardo_2/ui_report.m | 960 --------- lib/marsbar-0.44/@mardo_2/ui_report_fmri.m | 135 -- lib/marsbar-0.44/@mardo_5/autocorr.m | 98 - lib/marsbar-0.44/@mardo_5/convert_vols.m | 51 - lib/marsbar-0.44/@mardo_5/estimate.m | 103 - lib/marsbar-0.44/@mardo_5/fill.m | 291 --- lib/marsbar-0.44/@mardo_5/mardo_5.m | 104 - lib/marsbar-0.44/@mardo_5/native_vol_ver.m | 6 - lib/marsbar-0.44/@mardo_5/private/my_design.m | 12 - .../@mardo_5/private/pr_estimate.m | 399 ---- .../@mardo_5/private/pr_fmri_design.m | 206 -- .../@mardo_5/private/pr_fmristat_ar.m | 79 - .../@mardo_5/private/pr_get_filter.m | 51 - .../@mardo_5/private/pr_spm_cat.m | 96 - lib/marsbar-0.44/@mardo_5/private/pr_spm_ce.m | 57 - .../@mardo_5/private/pr_spm_diff.m | 115 - lib/marsbar-0.44/@mardo_5/private/pr_spm_en.m | 18 - .../@mardo_5/private/pr_spm_fileparts.m | 23 - .../@mardo_5/private/pr_spm_filter.m | 90 - .../@mardo_5/private/pr_spm_get_bf.m | 180 -- .../@mardo_5/private/pr_spm_get_ons.m | 263 --- .../@mardo_5/private/pr_spm_gpdf.m | 98 - .../@mardo_5/private/pr_spm_hrf.m | 48 - .../@mardo_5/private/pr_spm_justify.m | 161 -- .../@mardo_5/private/pr_spm_logdet.m | 40 - .../@mardo_5/private/pr_spm_non_sphericity.m | 112 - .../@mardo_5/private/pr_spm_orth.m | 20 - lib/marsbar-0.44/@mardo_5/private/pr_spm_q.m | 41 - .../@mardo_5/private/pr_spm_reml.m | 172 -- .../@mardo_5/private/pr_spm_select.m | 1151 ---------- .../@mardo_5/private/pr_spm_svd.m | 100 - lib/marsbar-0.44/@mardo_5/private/pr_spm_ui.m | 1412 ------------- .../@mardo_5/private/pr_spm_unvec.m | 64 - .../@mardo_5/private/pr_spm_vec.m | 49 - .../@mardo_5/private/pr_spm_volterra.m | 95 - .../@mardo_5/private/pr_stat_compute.m | 81 - .../@mardo_5/private/pr_stat_compute_mv.m | 153 -- lib/marsbar-0.44/@mardo_5/type.m | 6 - lib/marsbar-0.44/@mardo_5/ui_build.m | 27 - lib/marsbar-0.44/@mardo_99/add_trial_f.m | 54 - lib/marsbar-0.44/@mardo_99/apply_filter.m | 63 - lib/marsbar-0.44/@mardo_99/autocorr.m | 11 - lib/marsbar-0.44/@mardo_99/bf_dt.m | 7 - lib/marsbar-0.44/@mardo_99/block_cols.m | 17 - lib/marsbar-0.44/@mardo_99/block_rows.m | 22 - .../@mardo_99/can_mars_estimate.m | 6 - .../@mardo_99/compute_contrasts.m | 55 - lib/marsbar-0.44/@mardo_99/convert_vols.m | 39 - lib/marsbar-0.44/@mardo_99/design_vol.m | 28 - lib/marsbar-0.44/@mardo_99/estimate.m | 48 - lib/marsbar-0.44/@mardo_99/event_cols.m | 19 - lib/marsbar-0.44/@mardo_99/event_onsets.m | 60 - lib/marsbar-0.44/@mardo_99/event_regressor.m | 57 - lib/marsbar-0.44/@mardo_99/event_specs.m | 31 - lib/marsbar-0.44/@mardo_99/event_x_fir.m | 95 - lib/marsbar-0.44/@mardo_99/fill.m | 248 --- lib/marsbar-0.44/@mardo_99/fwhm.m | 10 - lib/marsbar-0.44/@mardo_99/get_images.m | 8 - lib/marsbar-0.44/@mardo_99/has_autocorr.m | 6 - lib/marsbar-0.44/@mardo_99/has_filter.m | 10 - lib/marsbar-0.44/@mardo_99/has_images.m | 6 - lib/marsbar-0.44/@mardo_99/mardo_2.m | 301 --- lib/marsbar-0.44/@mardo_99/mardo_99.m | 113 - lib/marsbar-0.44/@mardo_99/mars_spm_graph.m | 560 ----- lib/marsbar-0.44/@mardo_99/modality.m | 12 - .../@mardo_99/private/my_design.m | 12 - .../@mardo_99/private/pr_estimate.m | 169 -- .../@mardo_99/private/pr_fmri_design.m | 242 --- .../@mardo_99/private/pr_get_filter.m | 107 - .../@mardo_99/private/pr_spm_filter.m | 180 -- .../@mardo_99/private/pr_spm_get_bf.m | 301 --- .../@mardo_99/private/pr_spm_get_ons.m | 437 ---- .../@mardo_99/private/pr_spm_hrf.m | 40 - .../@mardo_99/private/pr_spm_orth.m | 21 - .../@mardo_99/private/pr_spm_ui.m | 1329 ------------ .../@mardo_99/private/pr_spm_volterra.m | 97 - .../@mardo_99/private/pr_stat_compute.m | 83 - .../@mardo_99/private/pr_stat_compute_mv.m | 128 -- lib/marsbar-0.44/@mardo_99/save_spm.m | 49 - lib/marsbar-0.44/@mardo_99/set_images.m | 11 - lib/marsbar-0.44/@mardo_99/tr.m | 10 - lib/marsbar-0.44/@mardo_99/type.m | 6 - lib/marsbar-0.44/@mardo_99/ui_build.m | 27 - lib/marsbar-0.44/@mardo_99/ui_get_event.m | 39 - lib/marsbar-0.44/@mardo_99/ui_get_filter.m | 27 - lib/marsbar-0.44/@mardo_99/ui_report.m | 971 --------- lib/marsbar-0.44/@mardo_99/ui_report_fmri.m | 184 -- lib/marsbar-0.44/@marmoire/add_if_absent.m | 14 - lib/marsbar-0.44/@marmoire/add_item.m | 27 - lib/marsbar-0.44/@marmoire/clear_item_data.m | 18 - lib/marsbar-0.44/@marmoire/default_item.m | 19 - lib/marsbar-0.44/@marmoire/do_save.m | 93 - lib/marsbar-0.44/@marmoire/do_set.m | 145 -- lib/marsbar-0.44/@marmoire/get_item_data.m | 29 - lib/marsbar-0.44/@marmoire/get_item_param.m | 31 - lib/marsbar-0.44/@marmoire/get_item_struct.m | 19 - .../@marmoire/isempty_item_data.m | 16 - lib/marsbar-0.44/@marmoire/item_exists.m | 9 - lib/marsbar-0.44/@marmoire/item_needs_save.m | 10 - lib/marsbar-0.44/@marmoire/marmoire.m | 130 -- .../@marmoire/private/pr_is_nan.m | 6 - .../@marmoire/private/pr_is_nix.m | 3 - .../@marmoire/private/pr_isempty.m | 6 - .../@marmoire/private/pr_needs_save.m | 6 - lib/marsbar-0.44/@marmoire/save_item_data.m | 70 - .../@marmoire/save_item_data_ui.m | 33 - lib/marsbar-0.44/@marmoire/set_item_data.m | 33 - lib/marsbar-0.44/@marmoire/set_item_data_ui.m | 18 - lib/marsbar-0.44/@marmoire/set_item_param.m | 36 - lib/marsbar-0.44/@marmoire/set_item_struct.m | 15 - lib/marsbar-0.44/@marmoire/update_item_data.m | 26 - lib/marsbar-0.44/@maroi/and.m | 8 - lib/marsbar-0.44/@maroi/are_same.m | 23 - lib/marsbar-0.44/@maroi/back2base.m | 10 - lib/marsbar-0.44/@maroi/binarize.m | 14 - lib/marsbar-0.44/@maroi/c_o_m.m | 21 - lib/marsbar-0.44/@maroi/classdata.m | 7 - lib/marsbar-0.44/@maroi/descrip.m | 11 - lib/marsbar-0.44/@maroi/display.m | 53 - lib/marsbar-0.44/@maroi/eq.m | 8 - lib/marsbar-0.44/@maroi/flip_lr.m | 6 - lib/marsbar-0.44/@maroi/ge.m | 8 - lib/marsbar-0.44/@maroi/get_marsy.m | 118 -- lib/marsbar-0.44/@maroi/getdata.m | 122 -- lib/marsbar-0.44/@maroi/gt.m | 8 - lib/marsbar-0.44/@maroi/has_space.m | 6 - lib/marsbar-0.44/@maroi/history.m | 11 - lib/marsbar-0.44/@maroi/label.m | 11 - lib/marsbar-0.44/@maroi/le.m | 8 - lib/marsbar-0.44/@maroi/loadobj.m | 9 - lib/marsbar-0.44/@maroi/lt.m | 8 - lib/marsbar-0.44/@maroi/maroi.m | 169 -- lib/marsbar-0.44/@maroi/maroi_matrix.m | 8 - lib/marsbar-0.44/@maroi/minus.m | 8 - lib/marsbar-0.44/@maroi/mrdivide.m | 8 - lib/marsbar-0.44/@maroi/mtimes.m | 8 - lib/marsbar-0.44/@maroi/native_space.m | 6 - lib/marsbar-0.44/@maroi/ne.m | 8 - lib/marsbar-0.44/@maroi/not.m | 7 - lib/marsbar-0.44/@maroi/or.m | 8 - lib/marsbar-0.44/@maroi/paramfields.m | 10 - lib/marsbar-0.44/@maroi/plus.m | 8 - .../@maroi/private/my_classdata.m | 66 - lib/marsbar-0.44/@maroi/private/my_loadroi.m | 22 - lib/marsbar-0.44/@maroi/private/my_roifname.m | 22 - lib/marsbar-0.44/@maroi/rdivide.m | 8 - lib/marsbar-0.44/@maroi/realpts.m | 14 - lib/marsbar-0.44/@maroi/rle.m | 14 - lib/marsbar-0.44/@maroi/roithresh.m | 14 - lib/marsbar-0.44/@maroi/save_as_image.m | 13 - lib/marsbar-0.44/@maroi/save_mricro.m | 18 - lib/marsbar-0.44/@maroi/saveroi.m | 13 - lib/marsbar-0.44/@maroi/source.m | 11 - lib/marsbar-0.44/@maroi/spm_hold.m | 11 - lib/marsbar-0.44/@maroi/times.m | 8 - lib/marsbar-0.44/@maroi/volume.m | 9 - lib/marsbar-0.44/@maroi/xor.m | 8 - lib/marsbar-0.44/@maroi_box/centre.m | 9 - lib/marsbar-0.44/@maroi_box/flip_lr.m | 6 - lib/marsbar-0.44/@maroi_box/is_empty_roi.m | 6 - lib/marsbar-0.44/@maroi_box/maroi_box.m | 42 - lib/marsbar-0.44/@maroi_box/volume.m | 6 - lib/marsbar-0.44/@maroi_box/voxpts.m | 25 - lib/marsbar-0.44/@maroi_image/flip_lr.m | 8 - lib/marsbar-0.44/@maroi_image/loadobj.m | 22 - lib/marsbar-0.44/@maroi_image/maroi_image.m | 67 - lib/marsbar-0.44/@maroi_image/maroi_matrix.m | 9 - .../@maroi_image/private/my_vol_func.m | 70 - lib/marsbar-0.44/@maroi_image/saveobj.m | 7 - lib/marsbar-0.44/@maroi_image/vol.m | 13 - .../@maroi_matrix/do_write_image.m | 18 - lib/marsbar-0.44/@maroi_matrix/domaths.m | 101 - lib/marsbar-0.44/@maroi_matrix/flip_lr.m | 7 - lib/marsbar-0.44/@maroi_matrix/is_empty_roi.m | 6 - lib/marsbar-0.44/@maroi_matrix/loadobj.m | 10 - lib/marsbar-0.44/@maroi_matrix/maroi_matrix.m | 72 - lib/marsbar-0.44/@maroi_matrix/matrixdata.m | 21 - lib/marsbar-0.44/@maroi_matrix/native_space.m | 6 - .../@maroi_matrix/private/my_rld.m | 14 - .../@maroi_matrix/private/my_rle.m | 8 - lib/marsbar-0.44/@maroi_matrix/rebase.m | 54 - lib/marsbar-0.44/@maroi_matrix/saveobj.m | 12 - lib/marsbar-0.44/@maroi_matrix/spm_mat.m | 6 - lib/marsbar-0.44/@maroi_matrix/voxpts.m | 9 - lib/marsbar-0.44/@maroi_pointlist/flip_lr.m | 8 - lib/marsbar-0.44/@maroi_pointlist/getvals.m | 10 - .../@maroi_pointlist/is_empty_roi.m | 6 - lib/marsbar-0.44/@maroi_pointlist/loadobj.m | 6 - .../@maroi_pointlist/maroi_matrix.m | 18 - .../@maroi_pointlist/maroi_pointlist.m | 83 - .../@maroi_pointlist/native_space.m | 6 - .../@maroi_pointlist/private/my_voxblock.m | 31 - lib/marsbar-0.44/@maroi_pointlist/saveobj.m | 6 - lib/marsbar-0.44/@maroi_pointlist/voxpts.m | 16 - lib/marsbar-0.44/@maroi_shape/c_o_m.m | 23 - lib/marsbar-0.44/@maroi_shape/has_space.m | 6 - lib/marsbar-0.44/@maroi_shape/maroi_matrix.m | 27 - lib/marsbar-0.44/@maroi_shape/maroi_shape.m | 33 - lib/marsbar-0.44/@maroi_sphere/centre.m | 9 - lib/marsbar-0.44/@maroi_sphere/flip_lr.m | 6 - lib/marsbar-0.44/@maroi_sphere/is_empty_roi.m | 6 - lib/marsbar-0.44/@maroi_sphere/maroi_sphere.m | 40 - lib/marsbar-0.44/@maroi_sphere/volume.m | 6 - lib/marsbar-0.44/@maroi_sphere/voxpts.m | 26 - lib/marsbar-0.44/@mars_space/display.m | 19 - lib/marsbar-0.44/@mars_space/eq.m | 10 - lib/marsbar-0.44/@mars_space/mars_space.m | 61 - lib/marsbar-0.44/@mars_space/subsasgn.m | 7 - lib/marsbar-0.44/@mars_space/subsref.m | 7 - lib/marsbar-0.44/@marsy/as_summary_only.m | 19 - lib/marsbar-0.44/@marsy/block_rows.m | 26 - lib/marsbar-0.44/@marsy/can_summarize.m | 17 - lib/marsbar-0.44/@marsy/display.m | 35 - lib/marsbar-0.44/@marsy/eq.m | 19 - lib/marsbar-0.44/@marsy/is_summarized.m | 7 - lib/marsbar-0.44/@marsy/is_summary_only.m | 16 - lib/marsbar-0.44/@marsy/is_valid.m | 7 - lib/marsbar-0.44/@marsy/join.m | 66 - lib/marsbar-0.44/@marsy/marsy.m | 358 ---- lib/marsbar-0.44/@marsy/n_blocks.m | 6 - lib/marsbar-0.44/@marsy/n_regions.m | 6 - lib/marsbar-0.44/@marsy/n_time_points.m | 6 - lib/marsbar-0.44/@marsy/ne.m | 6 - lib/marsbar-0.44/@marsy/private/pr_sum_func.m | 74 - lib/marsbar-0.44/@marsy/region.m | 123 -- lib/marsbar-0.44/@marsy/region_data.m | 10 - lib/marsbar-0.44/@marsy/region_descrip.m | 10 - lib/marsbar-0.44/@marsy/region_field.m | 35 - lib/marsbar-0.44/@marsy/region_info.m | 10 - lib/marsbar-0.44/@marsy/region_name.m | 53 - lib/marsbar-0.44/@marsy/region_size.m | 75 - lib/marsbar-0.44/@marsy/region_weights.m | 10 - lib/marsbar-0.44/@marsy/resummarize.m | 9 - lib/marsbar-0.44/@marsy/savestruct.m | 11 - lib/marsbar-0.44/@marsy/split.m | 24 - lib/marsbar-0.44/@marsy/sumfunc.m | 17 - lib/marsbar-0.44/@marsy/summary.m | 32 - lib/marsbar-0.44/@marsy/summary_block_means.m | 23 - lib/marsbar-0.44/@marsy/summary_data.m | 76 - lib/marsbar-0.44/@marsy/summary_descrip.m | 16 - lib/marsbar-0.44/@marsy/summary_info.m | 16 - lib/marsbar-0.44/@marsy/summary_size.m | 31 - lib/marsbar-0.44/@marsy/ui_plot.m | 270 --- lib/marsbar-0.44/@marsy/verbose.m | 11 - lib/marsbar-0.44/@marsy/xyz.m | 53 - lib/marsbar-0.44/@marsy/y_struct.m | 11 - lib/marsbar-0.44/contents.m | 443 ---- lib/marsbar-0.44/examples/batch/README | 34 - .../examples/batch/configure_er_model.m | 92 - .../examples/batch/do_bch_wrapper.m | 37 - .../examples/batch/er_contrast_spm99.m | 12 - .../examples/batch/er_model_spm2.m | 119 -- .../examples/batch/er_model_spm99.m | 81 - lib/marsbar-0.44/examples/batch/er_smooth.m | 32 - .../examples/batch/estimate_er_model.m | 86 - .../examples/batch/get_subjroot.m | 14 - .../examples/batch/run_preprocess.m | 28 - .../examples/batch/run_s3_model.m | 18 - .../examples/batch/run_tutorial.m | 173 -- lib/marsbar-0.44/install.txt | 21 - lib/marsbar-0.44/mars_arm.m | 63 - lib/marsbar-0.44/mars_arm_call.m | 169 -- lib/marsbar-0.44/mars_armoire.m | 464 ----- lib/marsbar-0.44/mars_blob2roi.m | 33 - lib/marsbar-0.44/mars_blob_menu.m | 56 - lib/marsbar-0.44/mars_blobs2rois.m | 64 - lib/marsbar-0.44/mars_build_roi.m | 107 - lib/marsbar-0.44/mars_display_roi.m | 270 --- lib/marsbar-0.44/mars_get_option.m | 13 - lib/marsbar-0.44/mars_image_scaling.m | 157 -- lib/marsbar-0.44/mars_img2rois.m | 130 -- lib/marsbar-0.44/mars_licence.man | 365 ---- lib/marsbar-0.44/mars_new_space.m | 83 - lib/marsbar-0.44/mars_options.m | 235 --- lib/marsbar-0.44/mars_orthviews.m | 1084 ---------- lib/marsbar-0.44/mars_rois2img.m | 101 - lib/marsbar-0.44/mars_struct.m | 264 --- lib/marsbar-0.44/mars_uifile.m | 87 - lib/marsbar-0.44/mars_utils.m | 275 --- lib/marsbar-0.44/mars_vol_check.m | 70 - lib/marsbar-0.44/mars_vol_utils.m | 341 --- lib/marsbar-0.44/marsbar.jpg | Bin 7460 -> 0 bytes lib/marsbar-0.44/marsbar.m | 1854 ----------------- lib/marsbar-0.44/release/make_contents.m | 186 -- lib/marsbar-0.44/release/pre_release.m | 62 - lib/marsbar-0.44/release/test_rig.m | 123 -- lib/marsbar-0.44/savestruct.m | 21 - lib/marsbar-0.44/spm2/mars_blob_ui.m | 49 - lib/marsbar-0.44/spm2/mars_veropts.m | 41 - lib/marsbar-0.44/spm2/spm_create_image.m | 11 - lib/marsbar-0.44/spm5/mars_blob_ui.m | 49 - lib/marsbar-0.44/spm5/mars_veropts.m | 47 - lib/marsbar-0.44/spm5/spm_create_image.m | 11 - lib/marsbar-0.44/spm5/spm_get.m | 143 -- lib/marsbar-0.44/spm99/mars_blob_ui.m | 53 - lib/marsbar-0.44/spm99/mars_veropts.m | 36 - lib/marsbar-0.44/spm99/spm_close_vol.m | 11 - lib/marsbar-0.44/spm99/spm_create_vol.m | 7 - lib/marsbar-0.44/spm99/spm_read_hdr.m | 140 -- lib/marsbar-0.44/spm99/spm_write_plane.m | 121 -- lib/marsbar-0.44/spm99/spm_write_vol.m | 80 - lib/marsbar-0.44/todo.txt | 6 - 432 files changed, 3 insertions(+), 36412 deletions(-) delete mode 100644 lib/marsbar-0.44/@mardo/add_contrasts.m delete mode 100644 lib/marsbar-0.44/@mardo/adjusted_data.m delete mode 100644 lib/marsbar-0.44/@mardo/betas.m delete mode 100644 lib/marsbar-0.44/@mardo/block_mean_cols.m delete mode 100644 lib/marsbar-0.44/@mardo/block_means.m delete mode 100644 lib/marsbar-0.44/@mardo/cd_images.m delete mode 100644 lib/marsbar-0.44/@mardo/contrasts.m delete mode 100644 lib/marsbar-0.44/@mardo/data.m delete mode 100644 lib/marsbar-0.44/@mardo/des_struct.m delete mode 100644 lib/marsbar-0.44/@mardo/descrip.m delete mode 100644 lib/marsbar-0.44/@mardo/design_matrix.m delete mode 100644 lib/marsbar-0.44/@mardo/design_structure.m delete mode 100644 lib/marsbar-0.44/@mardo/display.m delete mode 100644 lib/marsbar-0.44/@mardo/error_df.m delete mode 100644 lib/marsbar-0.44/@mardo/event_fitted.m delete mode 100644 lib/marsbar-0.44/@mardo/event_fitted_fir.m delete mode 100644 lib/marsbar-0.44/@mardo/event_signal.m delete mode 100644 lib/marsbar-0.44/@mardo/event_types.m delete mode 100644 lib/marsbar-0.44/@mardo/event_types_named.m delete mode 100644 lib/marsbar-0.44/@mardo/flip_images.m delete mode 100644 lib/marsbar-0.44/@mardo/flip_option.m delete mode 100644 lib/marsbar-0.44/@mardo/full_vol.m delete mode 100644 lib/marsbar-0.44/@mardo/get_contrast_by_name.m delete mode 100644 lib/marsbar-0.44/@mardo/get_contrasts.m delete mode 100644 lib/marsbar-0.44/@mardo/get_data.m delete mode 100644 lib/marsbar-0.44/@mardo/get_vol_field.m delete mode 100644 lib/marsbar-0.44/@mardo/has_contrasts.m delete mode 100644 lib/marsbar-0.44/@mardo/has_filter.m delete mode 100644 lib/marsbar-0.44/@mardo/has_images.m delete mode 100644 lib/marsbar-0.44/@mardo/has_whitener.m delete mode 100644 lib/marsbar-0.44/@mardo/image_names.m delete mode 100644 lib/marsbar-0.44/@mardo/images.m delete mode 100644 lib/marsbar-0.44/@mardo/is_fmri.m delete mode 100644 lib/marsbar-0.44/@mardo/is_mars_estimated.m delete mode 100644 lib/marsbar-0.44/@mardo/is_marsed.m delete mode 100644 lib/marsbar-0.44/@mardo/is_spm_estimated.m delete mode 100644 lib/marsbar-0.44/@mardo/is_valid.m delete mode 100644 lib/marsbar-0.44/@mardo/isempty.m delete mode 100644 lib/marsbar-0.44/@mardo/isfield.m delete mode 100644 lib/marsbar-0.44/@mardo/mardo.m delete mode 100644 lib/marsbar-0.44/@mardo/mars_tag.m delete mode 100644 lib/marsbar-0.44/@mardo/marsy_data.m delete mode 100644 lib/marsbar-0.44/@mardo/masking_struct.m delete mode 100644 lib/marsbar-0.44/@mardo/modality.m delete mode 100644 lib/marsbar-0.44/@mardo/n_effects.m delete mode 100644 lib/marsbar-0.44/@mardo/n_time_points.m delete mode 100644 lib/marsbar-0.44/@mardo/native_vol_ver.m delete mode 100644 lib/marsbar-0.44/@mardo/paramfields.m delete mode 100644 lib/marsbar-0.44/@mardo/prefix_images.m delete mode 100644 lib/marsbar-0.44/@mardo/private/pr_ev_diff.m delete mode 100644 lib/marsbar-0.44/@mardo/private/pr_refresh_et.m delete mode 100644 lib/marsbar-0.44/@mardo/private/pr_sort_evs.m delete mode 100644 lib/marsbar-0.44/@mardo/refresh_contrasts.m delete mode 100644 lib/marsbar-0.44/@mardo/residuals.m delete mode 100644 lib/marsbar-0.44/@mardo/savestruct.m delete mode 100644 lib/marsbar-0.44/@mardo/set_contrasts.m delete mode 100644 lib/marsbar-0.44/@mardo/set_data.m delete mode 100644 lib/marsbar-0.44/@mardo/set_vol_field.m delete mode 100644 lib/marsbar-0.44/@mardo/stat_table.m delete mode 100644 lib/marsbar-0.44/@mardo/subsasgn.m delete mode 100644 lib/marsbar-0.44/@mardo/subsref.m delete mode 100644 lib/marsbar-0.44/@mardo/summary.m delete mode 100644 lib/marsbar-0.44/@mardo/swd.m delete mode 100644 lib/marsbar-0.44/@mardo/swd_writable.m delete mode 100644 lib/marsbar-0.44/@mardo/type.m delete mode 100644 lib/marsbar-0.44/@mardo/ui_et_edit.m delete mode 100644 lib/marsbar-0.44/@mardo/ui_et_edit_cb.m delete mode 100644 lib/marsbar-0.44/@mardo/ui_event_types.m delete mode 100644 lib/marsbar-0.44/@mardo/ui_event_types_cb.m delete mode 100644 lib/marsbar-0.44/@mardo/ui_ft_design_data.m delete mode 100644 lib/marsbar-0.44/@mardo/ui_get_contrasts.m delete mode 100644 lib/marsbar-0.44/@mardo/unfiltered_efficiency.m delete mode 100644 lib/marsbar-0.44/@mardo/verbose.m delete mode 100644 lib/marsbar-0.44/@mardo_2/add_trial_f.m delete mode 100644 lib/marsbar-0.44/@mardo_2/apply_filter.m delete mode 100644 lib/marsbar-0.44/@mardo_2/autocorr.m delete mode 100644 lib/marsbar-0.44/@mardo_2/bf_dt.m delete mode 100644 lib/marsbar-0.44/@mardo_2/block_cols.m delete mode 100644 lib/marsbar-0.44/@mardo_2/block_rows.m delete mode 100644 lib/marsbar-0.44/@mardo_2/can_mars_estimate.m delete mode 100644 lib/marsbar-0.44/@mardo_2/compute_contrasts.m delete mode 100644 lib/marsbar-0.44/@mardo_2/convert_vols.m delete mode 100644 lib/marsbar-0.44/@mardo_2/design_vol.m delete mode 100644 lib/marsbar-0.44/@mardo_2/estimate.m delete mode 100644 lib/marsbar-0.44/@mardo_2/event_cols.m delete mode 100644 lib/marsbar-0.44/@mardo_2/event_onsets.m delete mode 100644 lib/marsbar-0.44/@mardo_2/event_regressor.m delete mode 100644 lib/marsbar-0.44/@mardo_2/event_specs.m delete mode 100644 lib/marsbar-0.44/@mardo_2/event_x_fir.m delete mode 100644 lib/marsbar-0.44/@mardo_2/fill.m delete mode 100644 lib/marsbar-0.44/@mardo_2/fwhm.m delete mode 100644 lib/marsbar-0.44/@mardo_2/get_images.m delete mode 100644 lib/marsbar-0.44/@mardo_2/has_autocorr.m delete mode 100644 lib/marsbar-0.44/@mardo_2/has_filter.m delete mode 100644 lib/marsbar-0.44/@mardo_2/has_images.m delete mode 100644 lib/marsbar-0.44/@mardo_2/has_whitener.m delete mode 100644 lib/marsbar-0.44/@mardo_2/mardo_2.m delete mode 100644 lib/marsbar-0.44/@mardo_2/mardo_99.m delete mode 100644 lib/marsbar-0.44/@mardo_2/mars_spm_graph.m delete mode 100644 lib/marsbar-0.44/@mardo_2/modality.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/my_design.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_estimate.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_fmri_design.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_fmristat_ar.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_get_filter.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_spm_ce.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_spm_diff.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_spm_filter.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_spm_get_bf.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_spm_get_ons.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_spm_gpdf.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_spm_hrf.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_spm_orth.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_spm_q.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_spm_reml.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_spm_svd.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_spm_ui.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_spm_volterra.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_stat_compute.m delete mode 100644 lib/marsbar-0.44/@mardo_2/private/pr_stat_compute_mv.m delete mode 100644 lib/marsbar-0.44/@mardo_2/save_spm.m delete mode 100644 lib/marsbar-0.44/@mardo_2/savestruct.m delete mode 100644 lib/marsbar-0.44/@mardo_2/set_images.m delete mode 100644 lib/marsbar-0.44/@mardo_2/tr.m delete mode 100644 lib/marsbar-0.44/@mardo_2/type.m delete mode 100644 lib/marsbar-0.44/@mardo_2/ui_build.m delete mode 100644 lib/marsbar-0.44/@mardo_2/ui_get_event.m delete mode 100644 lib/marsbar-0.44/@mardo_2/ui_get_filter.m delete mode 100644 lib/marsbar-0.44/@mardo_2/ui_report.m delete mode 100644 lib/marsbar-0.44/@mardo_2/ui_report_fmri.m delete mode 100644 lib/marsbar-0.44/@mardo_5/autocorr.m delete mode 100644 lib/marsbar-0.44/@mardo_5/convert_vols.m delete mode 100644 lib/marsbar-0.44/@mardo_5/estimate.m delete mode 100644 lib/marsbar-0.44/@mardo_5/fill.m delete mode 100644 lib/marsbar-0.44/@mardo_5/mardo_5.m delete mode 100644 lib/marsbar-0.44/@mardo_5/native_vol_ver.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/my_design.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_estimate.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_fmri_design.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_fmristat_ar.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_get_filter.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_cat.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_ce.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_diff.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_en.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_fileparts.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_filter.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_get_bf.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_get_ons.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_gpdf.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_hrf.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_justify.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_logdet.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_non_sphericity.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_orth.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_q.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_reml.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_select.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_svd.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_ui.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_unvec.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_vec.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_spm_volterra.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_stat_compute.m delete mode 100644 lib/marsbar-0.44/@mardo_5/private/pr_stat_compute_mv.m delete mode 100644 lib/marsbar-0.44/@mardo_5/type.m delete mode 100644 lib/marsbar-0.44/@mardo_5/ui_build.m delete mode 100644 lib/marsbar-0.44/@mardo_99/add_trial_f.m delete mode 100644 lib/marsbar-0.44/@mardo_99/apply_filter.m delete mode 100644 lib/marsbar-0.44/@mardo_99/autocorr.m delete mode 100644 lib/marsbar-0.44/@mardo_99/bf_dt.m delete mode 100644 lib/marsbar-0.44/@mardo_99/block_cols.m delete mode 100644 lib/marsbar-0.44/@mardo_99/block_rows.m delete mode 100644 lib/marsbar-0.44/@mardo_99/can_mars_estimate.m delete mode 100644 lib/marsbar-0.44/@mardo_99/compute_contrasts.m delete mode 100644 lib/marsbar-0.44/@mardo_99/convert_vols.m delete mode 100644 lib/marsbar-0.44/@mardo_99/design_vol.m delete mode 100644 lib/marsbar-0.44/@mardo_99/estimate.m delete mode 100644 lib/marsbar-0.44/@mardo_99/event_cols.m delete mode 100644 lib/marsbar-0.44/@mardo_99/event_onsets.m delete mode 100644 lib/marsbar-0.44/@mardo_99/event_regressor.m delete mode 100644 lib/marsbar-0.44/@mardo_99/event_specs.m delete mode 100644 lib/marsbar-0.44/@mardo_99/event_x_fir.m delete mode 100644 lib/marsbar-0.44/@mardo_99/fill.m delete mode 100644 lib/marsbar-0.44/@mardo_99/fwhm.m delete mode 100644 lib/marsbar-0.44/@mardo_99/get_images.m delete mode 100644 lib/marsbar-0.44/@mardo_99/has_autocorr.m delete mode 100644 lib/marsbar-0.44/@mardo_99/has_filter.m delete mode 100644 lib/marsbar-0.44/@mardo_99/has_images.m delete mode 100644 lib/marsbar-0.44/@mardo_99/mardo_2.m delete mode 100644 lib/marsbar-0.44/@mardo_99/mardo_99.m delete mode 100644 lib/marsbar-0.44/@mardo_99/mars_spm_graph.m delete mode 100644 lib/marsbar-0.44/@mardo_99/modality.m delete mode 100644 lib/marsbar-0.44/@mardo_99/private/my_design.m delete mode 100644 lib/marsbar-0.44/@mardo_99/private/pr_estimate.m delete mode 100644 lib/marsbar-0.44/@mardo_99/private/pr_fmri_design.m delete mode 100644 lib/marsbar-0.44/@mardo_99/private/pr_get_filter.m delete mode 100644 lib/marsbar-0.44/@mardo_99/private/pr_spm_filter.m delete mode 100644 lib/marsbar-0.44/@mardo_99/private/pr_spm_get_bf.m delete mode 100644 lib/marsbar-0.44/@mardo_99/private/pr_spm_get_ons.m delete mode 100644 lib/marsbar-0.44/@mardo_99/private/pr_spm_hrf.m delete mode 100644 lib/marsbar-0.44/@mardo_99/private/pr_spm_orth.m delete mode 100644 lib/marsbar-0.44/@mardo_99/private/pr_spm_ui.m delete mode 100644 lib/marsbar-0.44/@mardo_99/private/pr_spm_volterra.m delete mode 100644 lib/marsbar-0.44/@mardo_99/private/pr_stat_compute.m delete mode 100644 lib/marsbar-0.44/@mardo_99/private/pr_stat_compute_mv.m delete mode 100644 lib/marsbar-0.44/@mardo_99/save_spm.m delete mode 100644 lib/marsbar-0.44/@mardo_99/set_images.m delete mode 100644 lib/marsbar-0.44/@mardo_99/tr.m delete mode 100644 lib/marsbar-0.44/@mardo_99/type.m delete mode 100644 lib/marsbar-0.44/@mardo_99/ui_build.m delete mode 100644 lib/marsbar-0.44/@mardo_99/ui_get_event.m delete mode 100644 lib/marsbar-0.44/@mardo_99/ui_get_filter.m delete mode 100644 lib/marsbar-0.44/@mardo_99/ui_report.m delete mode 100644 lib/marsbar-0.44/@mardo_99/ui_report_fmri.m delete mode 100644 lib/marsbar-0.44/@marmoire/add_if_absent.m delete mode 100644 lib/marsbar-0.44/@marmoire/add_item.m delete mode 100644 lib/marsbar-0.44/@marmoire/clear_item_data.m delete mode 100644 lib/marsbar-0.44/@marmoire/default_item.m delete mode 100644 lib/marsbar-0.44/@marmoire/do_save.m delete mode 100644 lib/marsbar-0.44/@marmoire/do_set.m delete mode 100644 lib/marsbar-0.44/@marmoire/get_item_data.m delete mode 100644 lib/marsbar-0.44/@marmoire/get_item_param.m delete mode 100644 lib/marsbar-0.44/@marmoire/get_item_struct.m delete mode 100644 lib/marsbar-0.44/@marmoire/isempty_item_data.m delete mode 100644 lib/marsbar-0.44/@marmoire/item_exists.m delete mode 100644 lib/marsbar-0.44/@marmoire/item_needs_save.m delete mode 100644 lib/marsbar-0.44/@marmoire/marmoire.m delete mode 100644 lib/marsbar-0.44/@marmoire/private/pr_is_nan.m delete mode 100644 lib/marsbar-0.44/@marmoire/private/pr_is_nix.m delete mode 100644 lib/marsbar-0.44/@marmoire/private/pr_isempty.m delete mode 100644 lib/marsbar-0.44/@marmoire/private/pr_needs_save.m delete mode 100644 lib/marsbar-0.44/@marmoire/save_item_data.m delete mode 100644 lib/marsbar-0.44/@marmoire/save_item_data_ui.m delete mode 100644 lib/marsbar-0.44/@marmoire/set_item_data.m delete mode 100644 lib/marsbar-0.44/@marmoire/set_item_data_ui.m delete mode 100644 lib/marsbar-0.44/@marmoire/set_item_param.m delete mode 100644 lib/marsbar-0.44/@marmoire/set_item_struct.m delete mode 100644 lib/marsbar-0.44/@marmoire/update_item_data.m delete mode 100644 lib/marsbar-0.44/@maroi/and.m delete mode 100644 lib/marsbar-0.44/@maroi/are_same.m delete mode 100644 lib/marsbar-0.44/@maroi/back2base.m delete mode 100644 lib/marsbar-0.44/@maroi/binarize.m delete mode 100644 lib/marsbar-0.44/@maroi/c_o_m.m delete mode 100644 lib/marsbar-0.44/@maroi/classdata.m delete mode 100644 lib/marsbar-0.44/@maroi/descrip.m delete mode 100644 lib/marsbar-0.44/@maroi/display.m delete mode 100644 lib/marsbar-0.44/@maroi/eq.m delete mode 100644 lib/marsbar-0.44/@maroi/flip_lr.m delete mode 100644 lib/marsbar-0.44/@maroi/ge.m delete mode 100644 lib/marsbar-0.44/@maroi/get_marsy.m delete mode 100644 lib/marsbar-0.44/@maroi/getdata.m delete mode 100644 lib/marsbar-0.44/@maroi/gt.m delete mode 100644 lib/marsbar-0.44/@maroi/has_space.m delete mode 100644 lib/marsbar-0.44/@maroi/history.m delete mode 100644 lib/marsbar-0.44/@maroi/label.m delete mode 100644 lib/marsbar-0.44/@maroi/le.m delete mode 100644 lib/marsbar-0.44/@maroi/loadobj.m delete mode 100644 lib/marsbar-0.44/@maroi/lt.m delete mode 100644 lib/marsbar-0.44/@maroi/maroi.m delete mode 100644 lib/marsbar-0.44/@maroi/maroi_matrix.m delete mode 100644 lib/marsbar-0.44/@maroi/minus.m delete mode 100644 lib/marsbar-0.44/@maroi/mrdivide.m delete mode 100644 lib/marsbar-0.44/@maroi/mtimes.m delete mode 100644 lib/marsbar-0.44/@maroi/native_space.m delete mode 100644 lib/marsbar-0.44/@maroi/ne.m delete mode 100644 lib/marsbar-0.44/@maroi/not.m delete mode 100644 lib/marsbar-0.44/@maroi/or.m delete mode 100644 lib/marsbar-0.44/@maroi/paramfields.m delete mode 100644 lib/marsbar-0.44/@maroi/plus.m delete mode 100644 lib/marsbar-0.44/@maroi/private/my_classdata.m delete mode 100644 lib/marsbar-0.44/@maroi/private/my_loadroi.m delete mode 100644 lib/marsbar-0.44/@maroi/private/my_roifname.m delete mode 100644 lib/marsbar-0.44/@maroi/rdivide.m delete mode 100644 lib/marsbar-0.44/@maroi/realpts.m delete mode 100644 lib/marsbar-0.44/@maroi/rle.m delete mode 100644 lib/marsbar-0.44/@maroi/roithresh.m delete mode 100644 lib/marsbar-0.44/@maroi/save_as_image.m delete mode 100644 lib/marsbar-0.44/@maroi/save_mricro.m delete mode 100644 lib/marsbar-0.44/@maroi/saveroi.m delete mode 100644 lib/marsbar-0.44/@maroi/source.m delete mode 100644 lib/marsbar-0.44/@maroi/spm_hold.m delete mode 100644 lib/marsbar-0.44/@maroi/times.m delete mode 100644 lib/marsbar-0.44/@maroi/volume.m delete mode 100644 lib/marsbar-0.44/@maroi/xor.m delete mode 100644 lib/marsbar-0.44/@maroi_box/centre.m delete mode 100644 lib/marsbar-0.44/@maroi_box/flip_lr.m delete mode 100644 lib/marsbar-0.44/@maroi_box/is_empty_roi.m delete mode 100644 lib/marsbar-0.44/@maroi_box/maroi_box.m delete mode 100644 lib/marsbar-0.44/@maroi_box/volume.m delete mode 100644 lib/marsbar-0.44/@maroi_box/voxpts.m delete mode 100644 lib/marsbar-0.44/@maroi_image/flip_lr.m delete mode 100644 lib/marsbar-0.44/@maroi_image/loadobj.m delete mode 100644 lib/marsbar-0.44/@maroi_image/maroi_image.m delete mode 100644 lib/marsbar-0.44/@maroi_image/maroi_matrix.m delete mode 100644 lib/marsbar-0.44/@maroi_image/private/my_vol_func.m delete mode 100644 lib/marsbar-0.44/@maroi_image/saveobj.m delete mode 100644 lib/marsbar-0.44/@maroi_image/vol.m delete mode 100644 lib/marsbar-0.44/@maroi_matrix/do_write_image.m delete mode 100644 lib/marsbar-0.44/@maroi_matrix/domaths.m delete mode 100644 lib/marsbar-0.44/@maroi_matrix/flip_lr.m delete mode 100644 lib/marsbar-0.44/@maroi_matrix/is_empty_roi.m delete mode 100644 lib/marsbar-0.44/@maroi_matrix/loadobj.m delete mode 100644 lib/marsbar-0.44/@maroi_matrix/maroi_matrix.m delete mode 100644 lib/marsbar-0.44/@maroi_matrix/matrixdata.m delete mode 100644 lib/marsbar-0.44/@maroi_matrix/native_space.m delete mode 100644 lib/marsbar-0.44/@maroi_matrix/private/my_rld.m delete mode 100644 lib/marsbar-0.44/@maroi_matrix/private/my_rle.m delete mode 100644 lib/marsbar-0.44/@maroi_matrix/rebase.m delete mode 100644 lib/marsbar-0.44/@maroi_matrix/saveobj.m delete mode 100644 lib/marsbar-0.44/@maroi_matrix/spm_mat.m delete mode 100644 lib/marsbar-0.44/@maroi_matrix/voxpts.m delete mode 100644 lib/marsbar-0.44/@maroi_pointlist/flip_lr.m delete mode 100644 lib/marsbar-0.44/@maroi_pointlist/getvals.m delete mode 100644 lib/marsbar-0.44/@maroi_pointlist/is_empty_roi.m delete mode 100644 lib/marsbar-0.44/@maroi_pointlist/loadobj.m delete mode 100644 lib/marsbar-0.44/@maroi_pointlist/maroi_matrix.m delete mode 100644 lib/marsbar-0.44/@maroi_pointlist/maroi_pointlist.m delete mode 100644 lib/marsbar-0.44/@maroi_pointlist/native_space.m delete mode 100644 lib/marsbar-0.44/@maroi_pointlist/private/my_voxblock.m delete mode 100644 lib/marsbar-0.44/@maroi_pointlist/saveobj.m delete mode 100644 lib/marsbar-0.44/@maroi_pointlist/voxpts.m delete mode 100644 lib/marsbar-0.44/@maroi_shape/c_o_m.m delete mode 100644 lib/marsbar-0.44/@maroi_shape/has_space.m delete mode 100644 lib/marsbar-0.44/@maroi_shape/maroi_matrix.m delete mode 100644 lib/marsbar-0.44/@maroi_shape/maroi_shape.m delete mode 100644 lib/marsbar-0.44/@maroi_sphere/centre.m delete mode 100644 lib/marsbar-0.44/@maroi_sphere/flip_lr.m delete mode 100644 lib/marsbar-0.44/@maroi_sphere/is_empty_roi.m delete mode 100644 lib/marsbar-0.44/@maroi_sphere/maroi_sphere.m delete mode 100644 lib/marsbar-0.44/@maroi_sphere/volume.m delete mode 100644 lib/marsbar-0.44/@maroi_sphere/voxpts.m delete mode 100644 lib/marsbar-0.44/@mars_space/display.m delete mode 100644 lib/marsbar-0.44/@mars_space/eq.m delete mode 100644 lib/marsbar-0.44/@mars_space/mars_space.m delete mode 100644 lib/marsbar-0.44/@mars_space/subsasgn.m delete mode 100644 lib/marsbar-0.44/@mars_space/subsref.m delete mode 100644 lib/marsbar-0.44/@marsy/as_summary_only.m delete mode 100644 lib/marsbar-0.44/@marsy/block_rows.m delete mode 100644 lib/marsbar-0.44/@marsy/can_summarize.m delete mode 100644 lib/marsbar-0.44/@marsy/display.m delete mode 100644 lib/marsbar-0.44/@marsy/eq.m delete mode 100644 lib/marsbar-0.44/@marsy/is_summarized.m delete mode 100644 lib/marsbar-0.44/@marsy/is_summary_only.m delete mode 100644 lib/marsbar-0.44/@marsy/is_valid.m delete mode 100644 lib/marsbar-0.44/@marsy/join.m delete mode 100644 lib/marsbar-0.44/@marsy/marsy.m delete mode 100644 lib/marsbar-0.44/@marsy/n_blocks.m delete mode 100644 lib/marsbar-0.44/@marsy/n_regions.m delete mode 100644 lib/marsbar-0.44/@marsy/n_time_points.m delete mode 100644 lib/marsbar-0.44/@marsy/ne.m delete mode 100644 lib/marsbar-0.44/@marsy/private/pr_sum_func.m delete mode 100644 lib/marsbar-0.44/@marsy/region.m delete mode 100644 lib/marsbar-0.44/@marsy/region_data.m delete mode 100644 lib/marsbar-0.44/@marsy/region_descrip.m delete mode 100644 lib/marsbar-0.44/@marsy/region_field.m delete mode 100644 lib/marsbar-0.44/@marsy/region_info.m delete mode 100644 lib/marsbar-0.44/@marsy/region_name.m delete mode 100644 lib/marsbar-0.44/@marsy/region_size.m delete mode 100644 lib/marsbar-0.44/@marsy/region_weights.m delete mode 100644 lib/marsbar-0.44/@marsy/resummarize.m delete mode 100644 lib/marsbar-0.44/@marsy/savestruct.m delete mode 100644 lib/marsbar-0.44/@marsy/split.m delete mode 100644 lib/marsbar-0.44/@marsy/sumfunc.m delete mode 100644 lib/marsbar-0.44/@marsy/summary.m delete mode 100644 lib/marsbar-0.44/@marsy/summary_block_means.m delete mode 100644 lib/marsbar-0.44/@marsy/summary_data.m delete mode 100644 lib/marsbar-0.44/@marsy/summary_descrip.m delete mode 100644 lib/marsbar-0.44/@marsy/summary_info.m delete mode 100644 lib/marsbar-0.44/@marsy/summary_size.m delete mode 100644 lib/marsbar-0.44/@marsy/ui_plot.m delete mode 100644 lib/marsbar-0.44/@marsy/verbose.m delete mode 100644 lib/marsbar-0.44/@marsy/xyz.m delete mode 100644 lib/marsbar-0.44/@marsy/y_struct.m delete mode 100644 lib/marsbar-0.44/contents.m delete mode 100644 lib/marsbar-0.44/examples/batch/README delete mode 100644 lib/marsbar-0.44/examples/batch/configure_er_model.m delete mode 100644 lib/marsbar-0.44/examples/batch/do_bch_wrapper.m delete mode 100644 lib/marsbar-0.44/examples/batch/er_contrast_spm99.m delete mode 100644 lib/marsbar-0.44/examples/batch/er_model_spm2.m delete mode 100644 lib/marsbar-0.44/examples/batch/er_model_spm99.m delete mode 100644 lib/marsbar-0.44/examples/batch/er_smooth.m delete mode 100644 lib/marsbar-0.44/examples/batch/estimate_er_model.m delete mode 100644 lib/marsbar-0.44/examples/batch/get_subjroot.m delete mode 100644 lib/marsbar-0.44/examples/batch/run_preprocess.m delete mode 100644 lib/marsbar-0.44/examples/batch/run_s3_model.m delete mode 100644 lib/marsbar-0.44/examples/batch/run_tutorial.m delete mode 100644 lib/marsbar-0.44/install.txt delete mode 100644 lib/marsbar-0.44/mars_arm.m delete mode 100644 lib/marsbar-0.44/mars_arm_call.m delete mode 100644 lib/marsbar-0.44/mars_armoire.m delete mode 100644 lib/marsbar-0.44/mars_blob2roi.m delete mode 100644 lib/marsbar-0.44/mars_blob_menu.m delete mode 100644 lib/marsbar-0.44/mars_blobs2rois.m delete mode 100644 lib/marsbar-0.44/mars_build_roi.m delete mode 100644 lib/marsbar-0.44/mars_display_roi.m delete mode 100644 lib/marsbar-0.44/mars_get_option.m delete mode 100644 lib/marsbar-0.44/mars_image_scaling.m delete mode 100644 lib/marsbar-0.44/mars_img2rois.m delete mode 100644 lib/marsbar-0.44/mars_licence.man delete mode 100644 lib/marsbar-0.44/mars_new_space.m delete mode 100644 lib/marsbar-0.44/mars_options.m delete mode 100644 lib/marsbar-0.44/mars_orthviews.m delete mode 100644 lib/marsbar-0.44/mars_rois2img.m delete mode 100644 lib/marsbar-0.44/mars_struct.m delete mode 100644 lib/marsbar-0.44/mars_uifile.m delete mode 100644 lib/marsbar-0.44/mars_utils.m delete mode 100644 lib/marsbar-0.44/mars_vol_check.m delete mode 100644 lib/marsbar-0.44/mars_vol_utils.m delete mode 100644 lib/marsbar-0.44/marsbar.jpg delete mode 100644 lib/marsbar-0.44/marsbar.m delete mode 100644 lib/marsbar-0.44/release/make_contents.m delete mode 100644 lib/marsbar-0.44/release/pre_release.m delete mode 100644 lib/marsbar-0.44/release/test_rig.m delete mode 100644 lib/marsbar-0.44/savestruct.m delete mode 100644 lib/marsbar-0.44/spm2/mars_blob_ui.m delete mode 100644 lib/marsbar-0.44/spm2/mars_veropts.m delete mode 100644 lib/marsbar-0.44/spm2/spm_create_image.m delete mode 100644 lib/marsbar-0.44/spm5/mars_blob_ui.m delete mode 100644 lib/marsbar-0.44/spm5/mars_veropts.m delete mode 100644 lib/marsbar-0.44/spm5/spm_create_image.m delete mode 100644 lib/marsbar-0.44/spm5/spm_get.m delete mode 100644 lib/marsbar-0.44/spm99/mars_blob_ui.m delete mode 100644 lib/marsbar-0.44/spm99/mars_veropts.m delete mode 100644 lib/marsbar-0.44/spm99/spm_close_vol.m delete mode 100644 lib/marsbar-0.44/spm99/spm_create_vol.m delete mode 100644 lib/marsbar-0.44/spm99/spm_read_hdr.m delete mode 100644 lib/marsbar-0.44/spm99/spm_write_plane.m delete mode 100644 lib/marsbar-0.44/spm99/spm_write_vol.m delete mode 100644 lib/marsbar-0.44/todo.txt diff --git a/.github/workflows/run_tests_matlab.yml b/.github/workflows/run_tests_matlab.yml index 0be6686..1645c64 100644 --- a/.github/workflows/run_tests_matlab.yml +++ b/.github/workflows/run_tests_matlab.yml @@ -5,14 +5,8 @@ on: branches: - dev - main - paths: - - '**.m' - - '.github/workflows/*.m' pull_request: branches: ['*'] - paths: - - '**.m' - - '.github/workflows/*.m' schedule: - cron: "1 1 1 * *" @@ -21,20 +15,19 @@ on: jobs: tests_matlab: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Install MATLAB uses: matlab-actions/setup-matlab@v1.2.2 with: - # MATLAB release to set up R2020a release: R2020a - name: Install CPP_ROI uses: actions/checkout@v3 with: submodules: true - fetch-depth: 1 + fetch-depth: 0 - name: Install SPM run: | diff --git a/initCppRoi.m b/initCppRoi.m index be8b43c..b3230cb 100644 --- a/initCppRoi.m +++ b/initCppRoi.m @@ -17,7 +17,7 @@ function initCppRoi() % we add all the subfunctions that are in the sub directories CPP_ROI_PATHS = genpath(fullfile(thisDirectory, 'src')); CPP_ROI_PATHS = cat(2, CPP_ROI_PATHS, pathSep, ... - fullfile(thisDirectory, 'lib', 'marsbar-0.44')); + fullfile(thisDirectory, 'lib', 'marsbar')); CPP_ROI_PATHS = cat(2, CPP_ROI_PATHS, pathSep, ... fullfile(thisDirectory, 'atlas')); addpath(CPP_ROI_PATHS, '-begin'); diff --git a/lib/marsbar-0.44/@mardo/add_contrasts.m b/lib/marsbar-0.44/@mardo/add_contrasts.m deleted file mode 100644 index 4b16c78..0000000 --- a/lib/marsbar-0.44/@mardo/add_contrasts.m +++ /dev/null @@ -1,172 +0,0 @@ -function [D,Ic,changef] = add_contrasts(D, C, varargin) -% method to add contrast definitions to design -% -% The function has many different formats -% -% FORMAT [D Ic changef] = add_contrasts(D, D2 [,Ic]) -% -% where D2 is a design. If there is no third argument, all the contrasts in -% D2 will be added. If third argument (Ic) is passed, specifies which -% contrasts in D2 to add. If Ic passed, and empty, or contains the string -% 'ui', contrasts to add are fetched using the GUI -% -% OR -% FORMAT [D Ic changef] = add_contrasts(D, xCon) -% -% where xCon is a structure in SPM contrast format containing contrasts to -% add. If there is no third argument, all the contrasts in xCon will be -% added. If third argument (Ic) is passed, specifies which contrasts in xCon -% to add. If Ic passed, and empty, or contains the string 'ui', contrasts to -% add are fetched using the GUI -% -% OR -% FORMAT [D Ic changef] = add_contrasts(D, stat_struct) -% where stat_struct has fields -% 'names', string, or cell array of strings -% 'types', string ('T' or 'F'), or cell array -% 'set_actions', string ('c', 'X0' or 'iX0') or array -% (see spm_FcUtil) -% (field is optional, defaults to 'c') -% 'values', matrix of values -% -% OR -% FORMAT [D Ic changef] = add_contrasts(D, names, types, values) -% where names, types, values are cell arrays of values, or values -% (defined as above) -% -% OR -% FORMAT [D Ic changef] = add_contrasts(D, names, types, set_actions, values) -% where names, types, set_actions, values are cell arrays of values, or -% values (defined as above) -% -% Returns -% D - possibly modified SPM design -% Ic - indices of specified contrasts as stored in D -% changef - 1 if D has changed during call else 0 -% -% Contrast will not be added if it is already present, but the correct -% index will be returned in Ic -% -% $Id$ - -if nargin < 2 - error('Need contrasts to add'); -end - -% Get parameters from current design -SPM = des_struct(D); -sX = SPM.xX.xKXs; -xCon = SPM.xCon; -v_f = verbose(D); - -% process inputs -% The ``C`` variable will hold the xCon structure for the contrasts to add -if isa(C, 'mardo') % design - C = des_struct(C); -end -if isfield(C, 'xCon') % design structure - C = C.xCon; -end -if isfield(C, 'STAT') % xCon structure - % parse Ic input - if nargin > 2 % There is Ic input - Ic_in = varargin{1}; - if isempty(Ic_in) | strcmp(Ic_in,'ui') - D2 = set_contrasts(D, C, 0); - Ic_in = ui_get_contrasts(D2,'T&F',Inf,... - 'Select contrasts to merge','',1); - end - C = C(Ic_in); - end -else % contrast setting structure or values or cells - if ~isstruct(C) % make stat_struct structure if not already passed - C = sf_cell_to_conset(C, varargin{:}); - end - % make xCon structure from stat_struct - C = sf_conset_to_xcon(C, sX); -end -% Initial xCon before adding new contrasts -xc_len = length(xCon); -old_xc_len = xc_len; -% C contains the contrasts to add -for i=1:length(C) - % Update this contrast using our own filtered design - c_i = refresh_con(C(i), sX); - if xc_len == 0 % the xCon to add to is empty - xCon = c_i; - xc_len = 1; - Ic(1) = 1; - continue - end - % Check if we have this contrast already - Ic(i) = spm_FcUtil('In', c_i, sX, xCon); - if Ic(i) == 0 - xc_len = xc_len+1; - xCon(xc_len) = c_i; - Ic(i) = xc_len; - elseif v_f - fprintf('\nContrast %s (type %s) already in xCon\n', ... - c_i.name, c_i.STAT); - end -end -changef = xc_len ~= old_xc_len; -if changef - SPM.xCon = xCon; - D = des_struct(D, SPM); -end -return - -function xcon_re_entry = refresh_con(xcon_entry, sX) -% Rebuild contrast structure from our own filtered design -if isempty(xcon_entry.c) - error('Empty c matrix for contrast, crashing because confused') -end -xcon_re_entry = spm_FcUtil('Set',... - xcon_entry.name,... - xcon_entry.STAT,... - 'c',... - xcon_entry.c,... - sX); - -function C = sf_cell_to_conset(names, types, varargin) -% makes contrast setting structure from cell input -if nargin < 3 - error('Need at least names, statistic types and values'); -end -C = struct(... - 'names', names,... - 'types', types); -if nargin < 4 % values call - values = varargin{1}; - set_actions = 'c'; -else % contrast types, values call - set_actions = deal(varargin{1}); - values = deal(varargin{2}); -end -C = struct(... - 'names', names,... - 'types', types,... - 'set_actions', set_actions,... - 'values', values); -return - -function C = sf_conset_to_xcon(con_set, sX) -% make xCon structure from cell or struct setting parameters -if ~isfield(con_set, 'set_actions') - [con_set.set_actions] = deal('c'); -end -n_e = size(sX.X, 2); -for c = 1:length(con_set) - c1 = con_set(c); - if size(c1.values, 1) ~= n_e & ... - size(c1.values, 2) == n_e - c1.values = c1.values'; - end - C(c) = spm_FcUtil('Set',... - c1.names,... - c1.types,... - c1.set_actions,... - c1.values,... - sX); -end -return diff --git a/lib/marsbar-0.44/@mardo/adjusted_data.m b/lib/marsbar-0.44/@mardo/adjusted_data.m deleted file mode 100644 index e598083..0000000 --- a/lib/marsbar-0.44/@mardo/adjusted_data.m +++ /dev/null @@ -1,33 +0,0 @@ -function Ya = adjusted_data(D, Ic) -% Return adjusted data for estimated design and contrast no -% FORMAT Ya = adjusted_data(D, Ic) -% -% D - Estimated marsbar design -% Ic - Contrast number to adjust for -% -% Outputs -% Ya - Adjusted data, N by M, where N is number of time points -% and M is number of regions in estimated marsbar design -% -% e.g -% E = estimate(D, Y); -% [E Ic] = add_contrasts(E, 'task', 'T', [1 0 0]); -% Ya = adjusted_data(E, Ic); -% -% Matthew Brett - -if nargin < 2 - error('Need contrast number'); -end -if nargin < 3 - r_no = 1; -end -Ya = []; -if ~is_mars_estimated(D) - error('Need a MarsBaR estimated design'); -end - -SPM = des_struct(D); -B = betas(D); -xCon = get_contrasts(D); -Ya = spm_FcUtil('Yc', xCon(Ic),SPM.xX.xKXs, B); diff --git a/lib/marsbar-0.44/@mardo/betas.m b/lib/marsbar-0.44/@mardo/betas.m deleted file mode 100644 index b9ca1ab..0000000 --- a/lib/marsbar-0.44/@mardo/betas.m +++ /dev/null @@ -1,10 +0,0 @@ -function r = betas(o) -% method to get estimated betas -% -% $Id$ - -if ~is_mars_estimated(o) - error('No betas, model not estimated'); -end -SPM = des_struct(o); -r = SPM.betas; diff --git a/lib/marsbar-0.44/@mardo/block_mean_cols.m b/lib/marsbar-0.44/@mardo/block_mean_cols.m deleted file mode 100644 index ab35e0b..0000000 --- a/lib/marsbar-0.44/@mardo/block_mean_cols.m +++ /dev/null @@ -1,8 +0,0 @@ -function bmrs = block_mean_rows(D) -% method returns rows for means for blocks in design -% -% $Id$ - -bmrs = []; -SPM = des_struct(D); -bmrs = SPM.xX.iB; diff --git a/lib/marsbar-0.44/@mardo/block_means.m b/lib/marsbar-0.44/@mardo/block_means.m deleted file mode 100644 index 94ff2a1..0000000 --- a/lib/marsbar-0.44/@mardo/block_means.m +++ /dev/null @@ -1,18 +0,0 @@ -function bms = block_means(D) -% method returns means for blocks in design -% -% Inputs -% D - design object -% -% Outputs -% bms - means over block. Returns B x N matrix -% where B is number of blocks, and N is number -% of ROIs -% -% $Id$ - -Y = data(D); -if isempty(Y) - error('Design does not yet have data'); -end -bms = summary_block_means(data(D)); diff --git a/lib/marsbar-0.44/@mardo/cd_images.m b/lib/marsbar-0.44/@mardo/cd_images.m deleted file mode 100644 index c3b7ca0..0000000 --- a/lib/marsbar-0.44/@mardo/cd_images.m +++ /dev/null @@ -1,63 +0,0 @@ -function D = cd_images(D, newpath, byteswap) -% method for changing path to image files in design -% FORMAT D = cd_images(D, newpath [, byteswap]) -% -% Synopsis -% D = cd_images(D); % get new path from GUI -% D = cd_images(D, '/new/root/path'); -% D = cd_images(D, '/new/root/path', 1); % force byteswap -% D = cd_images(D, '/new/root/path', 1); % prevent byteswap -% -% D - mardo design -% newpath - path to replace common path of files in analysis [GUI] -% byteswap - whether to indicate byte swapping in vol structs -% [determined from images by default] -% -% $Id$ - -if nargin < 2 - newpath = spm_get(-1, '', 'New directory root for files'); -end -if nargin < 3 - byteswap=[]; -end - -% get images -if ~has_images(D) - warning('Design does not contain images'); - return -end -VY = get_images(D); - -% now change directory -newpath = spm_get('cpath', newpath); -if filesep == '\', other_filesep='/';else other_filesep='\';end -n = length(VY); -strout = strvcat(VY(:).fname); -msk = diff(strout+0)~=0; % common path -d1 = min(find(sum(msk,1))); -d1 = max([find(strout(1,1:d1) == other_filesep | strout(1,1:d1) == filesep) 0]); -ffnames = strout(:,d1+1:end); % common path removed -tmp = ffnames == other_filesep; % filesep exchanged for this platform -ffnames(tmp) = filesep; -nfnames = cellstr(... - strcat(repmat(newpath,n,1),filesep,ffnames)); -[VY(:).fname] = deal(nfnames{:}); - -% do the files exist here then? -if ~exist(nfnames{1}, 'file') - error(['Cannot find first file here: ' nfnames{1}]); -end -if isempty(byteswap) - byteswap = mars_vol_utils('is_swapped_wrong', VY(1)); -end - -% do byteswap as necessary -if byteswap - VY = mars_vol_utils('byte_swap', VY); - if verbose(D) - disp('Images vols byteswapped'); - end -end - -D = set_images(D, VY); diff --git a/lib/marsbar-0.44/@mardo/contrasts.m b/lib/marsbar-0.44/@mardo/contrasts.m deleted file mode 100644 index 5e5b04d..0000000 --- a/lib/marsbar-0.44/@mardo/contrasts.m +++ /dev/null @@ -1,11 +0,0 @@ -function r = contrasts(o, xcon) -% method to get or set contrasts -% -% $Id$ - -if nargin < 2 - r = get_contrasts(o); -else - % Always refreshes the contrasts for safety - r = set_contrasts(o, xcon); -end diff --git a/lib/marsbar-0.44/@mardo/data.m b/lib/marsbar-0.44/@mardo/data.m deleted file mode 100644 index 68476c5..0000000 --- a/lib/marsbar-0.44/@mardo/data.m +++ /dev/null @@ -1,10 +0,0 @@ -function r = data(o, Y) -% method to get or set data object -% -% $Id$ - -if nargin < 2 - r = get_data(o); -else - r = set_data(o, Y); -end diff --git a/lib/marsbar-0.44/@mardo/des_struct.m b/lib/marsbar-0.44/@mardo/des_struct.m deleted file mode 100644 index 5e41ab1..0000000 --- a/lib/marsbar-0.44/@mardo/des_struct.m +++ /dev/null @@ -1,11 +0,0 @@ -function res = des_struct(obj, Struct) -% get/set method for des_struct field -% -% $Id$ - -if nargin > 1 - obj.des_struct = Struct; - res = obj; -else - res = obj.des_struct; -end diff --git a/lib/marsbar-0.44/@mardo/descrip.m b/lib/marsbar-0.44/@mardo/descrip.m deleted file mode 100644 index 122ef56..0000000 --- a/lib/marsbar-0.44/@mardo/descrip.m +++ /dev/null @@ -1,11 +0,0 @@ -function strs = descrip(D) -% method gets cell string description of design -% -% $Id$ - -SPM = des_struct(D); -strs = {'Not specified'}; -if ~isfield(SPM, 'xsDes'); - return -end -strs = mars_struct('celldisp', SPM.xsDes); diff --git a/lib/marsbar-0.44/@mardo/design_matrix.m b/lib/marsbar-0.44/@mardo/design_matrix.m deleted file mode 100644 index 819dd4c..0000000 --- a/lib/marsbar-0.44/@mardo/design_matrix.m +++ /dev/null @@ -1,7 +0,0 @@ -function X = design_matrix(D) -% method returns design matrix from design -% -% $Id$ - -SPM = des_struct(D); -X = mars_struct('getifthere', SPM, 'xX', 'X'); diff --git a/lib/marsbar-0.44/@mardo/design_structure.m b/lib/marsbar-0.44/@mardo/design_structure.m deleted file mode 100644 index 6853b5d..0000000 --- a/lib/marsbar-0.44/@mardo/design_structure.m +++ /dev/null @@ -1,12 +0,0 @@ -function r = design_structure(o, xX) -% method to get or set SPM design structure -% -% $Id$ - -SPM = des_struct(o); -if nargin < 2 - r = mars_struct('getifthere', SPM, 'xX'); -else - SPM.xX = xX; - r = des_struct(o, SPM); -end diff --git a/lib/marsbar-0.44/@mardo/display.m b/lib/marsbar-0.44/@mardo/display.m deleted file mode 100644 index ddf699f..0000000 --- a/lib/marsbar-0.44/@mardo/display.m +++ /dev/null @@ -1,35 +0,0 @@ -function display(obj) -% display method for mardo objects -% -% $Id$ - -src = ['[' class(obj) ' design object]']; -if length(obj) > 1 % array of objects - sz = size(obj); - src = sprintf('%d by %d array of %s', sz(1), sz(2), src); - if isequal(get(0,'FormatSpacing'),'compact') - disp([inputname(1) ' =']); - disp(src); - else - disp(' ') - disp([inputname(1) ' =']); - disp(' '); - disp(src); - disp(' '); - end -else % single object - X = char(summary(obj)); - if isequal(get(0,'FormatSpacing'),'compact') - disp([inputname(1) ' =']); - disp(src); - disp(X) - else - disp(' ') - disp([inputname(1) ' =']); - disp(' '); - disp(src); - disp(' '); - disp(X) - disp(' '); - end -end diff --git a/lib/marsbar-0.44/@mardo/error_df.m b/lib/marsbar-0.44/@mardo/error_df.m deleted file mode 100644 index e271b03..0000000 --- a/lib/marsbar-0.44/@mardo/error_df.m +++ /dev/null @@ -1,7 +0,0 @@ -function e = error_df(D) -% method returns error df from design -% -% $Id$ - -SPM = des_struct(D); -e = mars_struct('getifthere', SPM, 'xX', 'erdf'); diff --git a/lib/marsbar-0.44/@mardo/event_fitted.m b/lib/marsbar-0.44/@mardo/event_fitted.m deleted file mode 100644 index 25f993c..0000000 --- a/lib/marsbar-0.44/@mardo/event_fitted.m +++ /dev/null @@ -1,54 +0,0 @@ -function [tc, dt] = event_fitted(D, e_spec, dur) -% method to compute fitted event time course -% FORMAT [tc dt] = event_fitted(D, e_spec, dur) -% -% D - design -% e_spec - 2 by N array specifying events to combine -% with row 1 giving session number -% and row 2 giving event number in session -% This may in due course become an object type -% dur - duration in seconds of event to estimate for -% -% Returns -% tc - fitted event time course, averaged over events -% dt - time units (seconds per row in X) -% -% $Id$ - -if nargin < 2 - error('Need event specification'); -end -if nargin < 3 - dur = 0; -end - -if ~is_fmri(D) | isempty(e_spec) - tc = []; - return -end -if ~is_mars_estimated(D) - error('Need a MarsBaR estimated design'); -end -if size(e_spec, 1) == 1, e_spec = e_spec'; end - -e_s_l = size(e_spec, 2); -SPM = des_struct(D); -betas = SPM.betas; -tc = zeros(1, size(betas, 2)); -for e_i = 1:e_s_l - es = e_spec(:, e_i); - ss = es(1); - [X dt]= event_regressor(D, es, dur); - B = betas(event_cols(D, es), :); - Yh = X*B; - - % Sum over events - sz = size(Yh, 1); - szo = size(tc, 1); - if sz > szo - tc(end+1:sz, :) = 0; - end - tc(1:sz,:) = tc(1:sz,:) + Yh; - -end -tc = tc / e_s_l; diff --git a/lib/marsbar-0.44/@mardo/event_fitted_fir.m b/lib/marsbar-0.44/@mardo/event_fitted_fir.m deleted file mode 100644 index 553902d..0000000 --- a/lib/marsbar-0.44/@mardo/event_fitted_fir.m +++ /dev/null @@ -1,158 +0,0 @@ -function [tc, dt] = event_fitted_fir(D, e_spec, bin_length, bin_no, opts) -% method to compute fitted event time courses using FIR -% FORMAT [tc, dt] = event_fitted_fir(D, e_spec, bin_length, bin_no, opts) -% -% (defaults are in []) -% D - design -% e_spec - 2 by N array specifying events to combine -% with row 1 giving session number -% and row 2 giving event number in session -% This may in due course become an object type -% bin_length - duration of time bin for FIR in seconds [TR] -% bin_no - number of time bins [24 seconds / TR] -% opts - structure, containing fields with options -% 'single' - if field present, gives single FIR -% This option removes any duration information, and -% returns a simple per onset FIR model, where 1s in the -% design matrix corresponds to 1 event at the given -% offset. -% 'percent' - if field present, gives results as percent -% of block means -% -% Returns -% tc - fitted event time course, averaged over events -% dt - time units (seconds per row in tc = bin_length) -% -% Here, just some notes to explain 'single' and 'stacked' FIR models. Imagine -% you have an event of duration 10 seconds, and you want an FIR model. To -% make things simple, let's say the TR is 1 second, and that a standard -% haemodynamic response function (HRF) lasts 24 seconds. -% -% In order to do the FIR model, there are two ways to go. The first is to -% make an FIR model which estimates the signal (say) at every second (TR) -% after event onset, where your model (Impulse Response) lasts long enough -% to capture the event and its HRF response - say 10+24 = 24 seconds. This -% is what I will call a 'single' FIR model. Another approach - and this is -% what SPM does by default - is to think of the 10 second event as a (say) -% 10 events one after the other, each starting 1 second after the last. -% Here the FIR model estimates the effect of one of these 1 second events, -% and the length of your FIR model (Impulse response) is just the length of -% the HRF (24 seconds). This second approach I will call a 'stacked' FIR -% model, because the events are stacking up one upon another. -% -% The single and stacked models are the same thing, if you specify a -% duration of 0 for all your events. If your events have different -% durations, it is very difficult to model the event response sensibly with -% a single FIR, because, for the later FIR time bins, some events will have -% stopped, and activity will be dropping to baseline, whereas other events -% will still be continuing. In this case the stacked model can make sense, -% as it just models longer events as having more (say) 1 second events. -% However, if your events have non-zero durations, but each duration is the -% same, then it may be that you do not want the stacked model, because your -% interest is in the event time course across the whole event, rather than -% some average response which pools together responses in the start middle -% and end of your actual event response, as the stacked model does. In such -% a case, you may want to switch to a single FIR model. -% -% There is an added problem for the stacked models, which is what to do -% about the actual height of the regressors. That problem also requires -% a bit of exposition which I hope to get down to in due course. -% -% $Id$ - -if nargin < 2 - error('Need event specification'); -end -if nargin < 3 - bin_length = []; -end -if nargin < 4 - bin_no = []; -end -if nargin < 5 - opts = []; -end - -if ~is_fmri(D) | isempty(e_spec) - tc = []; dt = []; - return -end -if ~is_mars_estimated(D) - error('Need a MarsBaR estimated design'); -end - -if size(e_spec, 1) == 1, e_spec = e_spec'; end -[SN EN] = deal(1, 2); -e_s_l = size(e_spec, 2); - -if isempty(bin_length) - bin_length = tr(D); -end -if isempty(bin_no) - bin_no = 25/bin_length; -end -bin_no = round(bin_no); - -% build a simple FIR model subpartition (X) -%------------------------------------------ -dt = bf_dt(D); -blk_rows = block_rows(D); -oX = design_matrix(D); -[n_t_p n_eff] = size(oX); -y = summary_data(data(D)); -y = apply_filter(D, y); -n_rois = size(y, 2); -tc = zeros(bin_no, n_rois); -blk_mns = block_means(D); - -% for each session -for s = 1:length(blk_rows) - sess_events = e_spec(EN, e_spec(SN, :) == s); - brX = blk_rows{s}; - iX_out = []; - X = []; - n_s_e = length(sess_events); - if isempty(n_s_e), break, end - - for ei = 1:n_s_e - e = sess_events(ei); - - % New design bit for FIR model for this trial type - Xn = event_x_fir(D, [s e]', bin_length, bin_no, opts); - - % Columns from original design that need to be removed - iX_out = [iX_out event_cols(D, [s e])]; - - % Columns in new design matrix for basic FIR model - iX_in(ei,:) = size(X, 2) + [1:size(Xn,2)]; - - X = [X Xn]; - end - - % put into previous design for this session, and filter - %------------------------------------------------------ - iX0 = [1:n_eff]; - iX0(iX_out) = []; - aX = [X oX(brX,iX0)]; - KX = apply_filter(D, aX, struct('sessions', s)); - - % Reestimate to get FIR time courses - %------------------------------------------------------ - xX = spm_sp('Set',KX); - pX = spm_sp('x-',xX); - betas = pX*y(brX,:); - tc_s = betas(1:size(X,2), :); - - % Sum over events - tc_s = reshape(tc_s, bin_no, n_s_e, n_rois); - tc_s = squeeze(sum(tc_s, 2)); - - % Do percent if necessary - if isfield(opts, 'percent'), tc_s = tc_s / blk_mns(s) * 100; end - - % Sum over sessions - tc = tc + tc_s; - -end -tc = tc / e_s_l; -dt = bin_length; diff --git a/lib/marsbar-0.44/@mardo/event_signal.m b/lib/marsbar-0.44/@mardo/event_signal.m deleted file mode 100644 index d549716..0000000 --- a/lib/marsbar-0.44/@mardo/event_signal.m +++ /dev/null @@ -1,60 +0,0 @@ -function s = event_signal(D, e_spec, dur, diff_func, varargin) -% method to compute % signal change from fMRI events -% FORMAT s = event_signal(D, e_spec, dur, diff_func, varargin) -% -% D - design -% e_spec - 2 by N array specifying events to combine -% with row 1 giving session number -% and row 2 giving event number in session -% This may in due course become an object type -% dur - duration in seconds of event to estimate for -% diff_func - function to calculate signal change from canonical event -% one of 'max', 'max-min', 'abs max', 'abs max-min', 'window' -% varargin - any needed arguments for diff_func -% No arguments are needed for -% 'max', 'max-min', 'abs max','abs max-min' -% For 'window', you need a 1x2 vector with the time in -% seconds over which to take the mean, and the length in -% seconds of a time bin for the basis functions (returned -% for example by bf_dt(my_design) -% -% Returns -% s - average % signal change over the events -% 1 by n_regions vector -% -% $Id$ - -if nargin < 2 - error('Need event specification'); -end -if nargin < 3 - dur = 0; -end -if nargin < 4 - diff_func = ''; -end -if isempty(diff_func) - diff_func = 'abs max'; -end - -if ~is_fmri(D) | isempty(e_spec) - s = []; - return -end -if ~is_mars_estimated(D) - error('Need a MarsBaR estimated design'); -end -if size(e_spec, 1) == 1, e_spec = e_spec'; end - -e_s_l = size(e_spec, 2); -s = 0; -s_mus = block_means(D); -SPM = des_struct(D); -for e_i = 1:e_s_l - es = e_spec(:, e_i); - ss = es(1); - Yh = event_fitted(D, es, dur); - d = pr_ev_diff(Yh, diff_func, varargin{:}); - s = s + d ./ s_mus(ss,:); -end -s = s / e_s_l * 100; diff --git a/lib/marsbar-0.44/@mardo/event_types.m b/lib/marsbar-0.44/@mardo/event_types.m deleted file mode 100644 index b92f866..0000000 --- a/lib/marsbar-0.44/@mardo/event_types.m +++ /dev/null @@ -1,19 +0,0 @@ -function res = event_types(D, et) -% method to get / set event types for design -% FORMAT et = event_types(D) -% to return event types for design -% -% FORMAT D = event_types(D, et) -% to set event types for design -% -% $Id$ - -SPM = des_struct(D); -if nargin < 2 - % get - res = mars_struct('getifthere', SPM, 'event_types'); -else - % set - SPM.event_types = et; - res = des_struct(D, SPM); -end diff --git a/lib/marsbar-0.44/@mardo/event_types_named.m b/lib/marsbar-0.44/@mardo/event_types_named.m deleted file mode 100644 index 2f103a3..0000000 --- a/lib/marsbar-0.44/@mardo/event_types_named.m +++ /dev/null @@ -1,15 +0,0 @@ -function et = event_types_named(D) -% method returns event types structures for events with same names -% FORMAT et = event_types_named(D) -% -% $Id$ - -[e_s enames] = event_specs(D); - -ets = unique(enames); - -for e = 1:length(ets) - et(e).name = ets{e}; - in_evs = ismember(enames, ets{e}); - et(e).e_spec = e_s(:, in_evs); -end diff --git a/lib/marsbar-0.44/@mardo/flip_images.m b/lib/marsbar-0.44/@mardo/flip_images.m deleted file mode 100644 index d374794..0000000 --- a/lib/marsbar-0.44/@mardo/flip_images.m +++ /dev/null @@ -1,12 +0,0 @@ -function o = flip_images(o) -% flips images in design -% -% $Id$ - -if ~has_images(o), return, end -VY = get_images(o); -M = diag([-1 1 1 1]); -for i = 1:length(VY) - VY(i).mat = M * VY(i).mat; -end -o = set_images(o, VY); diff --git a/lib/marsbar-0.44/@mardo/flip_option.m b/lib/marsbar-0.44/@mardo/flip_option.m deleted file mode 100644 index ec1885c..0000000 --- a/lib/marsbar-0.44/@mardo/flip_option.m +++ /dev/null @@ -1,11 +0,0 @@ -function res = flip_option(obj, data) -% get/set flag for flipping images in design -% -% $Id$ - -if nargin > 1 - obj.flip_option = data; - res = obj; -else - res = obj.flip_option; -end diff --git a/lib/marsbar-0.44/@mardo/full_vol.m b/lib/marsbar-0.44/@mardo/full_vol.m deleted file mode 100644 index 4262911..0000000 --- a/lib/marsbar-0.44/@mardo/full_vol.m +++ /dev/null @@ -1,61 +0,0 @@ -function V = full_vol(D, imgs) -% returns vol with full path, from vols, or image names -% FORMAT V = full_vol(D, imgs) -% -% Input -% D - mardo design object -% imgs - image names or vol structs -% -% Output -% V - vol structs with full path names -% -% If the filename for the image does not exist, the routine returns an -% empty vol struct - which has the filename set, but all other fields are -% empty -% -% $Id$ - -if nargin < 2 - error('Need image information'); -end - -Swd = swd(D); -if isempty(Swd) - error('Need directory of design; it is missing'); -end - -def_struct = mars_vol_utils('def_vol'); - -if isempty(imgs) - V = def_struct; - return -end - -if iscell(imgs) - imgs = char(imgs); -end -if isstruct(imgs) % vol struct, check for absolute path name - V = imgs; - nimgs = prod(size(imgs)); - for i = 1:nimgs - fname = V(i).fname; - if ~mars_utils('isabspath', fname); - fname = fullfile(Swd, fname); - end - V(i).fname = fname; - end -elseif ischar(imgs) - for i = 1:size(imgs, 1) - fname = deblank(imgs(i,:)); - if ~mars_utils('isabspath', fname) - fname = fullfile(Swd, fname); - end - if exist(fname, 'file') - V(i) = spm_vol(fname); - else - V(i).fname = fname; - end - end -else - error('Odd input format for images'); -end diff --git a/lib/marsbar-0.44/@mardo/get_contrast_by_name.m b/lib/marsbar-0.44/@mardo/get_contrast_by_name.m deleted file mode 100644 index 53f602e..0000000 --- a/lib/marsbar-0.44/@mardo/get_contrast_by_name.m +++ /dev/null @@ -1,29 +0,0 @@ -function [xc, ic] = get_contrast_by_name(D, cname) -% get named contrast(s) from design contrast structure -% FORMAT [xc, ic] = get_contrast_by_name(D, cname) -% -% D - design object -% cname - contrast name(s) (string or cell array) -% -% Returns -% xc - xCon structure containing only named contrast -% ic - index of contrast in design contrast structure -% -% e.g. [con ic] = get_named_contrasts(D, 'effects of interest'); -% -% $Id$ - -if nargin < 2 - error('Need contrast name(s)'); -end -if ischar(cname) - cname = cellstr(cname); -end - -xc = get_contrasts(D); -if isempty(xc) - ic = []; -else - ic = find(ismember({xc(:).name}, cname)); -end -xc = xc(ic); diff --git a/lib/marsbar-0.44/@mardo/get_contrasts.m b/lib/marsbar-0.44/@mardo/get_contrasts.m deleted file mode 100644 index b246e71..0000000 --- a/lib/marsbar-0.44/@mardo/get_contrasts.m +++ /dev/null @@ -1,11 +0,0 @@ -function xCon = get_contrasts(D) -% method to get contrasts from design object -% FORMAT xCon = get_contrasts(D) -% -% Returns contrast structure from design -% See ui_get_contrasts for UI to get individual contrasts -% -% $Id$ - -SPM = des_struct(D); -xCon = mars_struct('getifthere', SPM, 'xCon'); diff --git a/lib/marsbar-0.44/@mardo/get_data.m b/lib/marsbar-0.44/@mardo/get_data.m deleted file mode 100644 index d5a8d78..0000000 --- a/lib/marsbar-0.44/@mardo/get_data.m +++ /dev/null @@ -1,10 +0,0 @@ -function d = get_data(D) -% method to get data from design object -% -% $Id$ - -SPM = des_struct(D); -d = []; -if isfield(SPM, 'marsY') - d = SPM.marsY; -end diff --git a/lib/marsbar-0.44/@mardo/get_vol_field.m b/lib/marsbar-0.44/@mardo/get_vol_field.m deleted file mode 100644 index d4b00d2..0000000 --- a/lib/marsbar-0.44/@mardo/get_vol_field.m +++ /dev/null @@ -1,30 +0,0 @@ -function V = get_vol_field(D, fieldn) -% method to get named field, containing or referring to vol structs -% FORMAT V = get_vol_field(D, fieldn) -% -% D - design object -% fieldn - field name -% -% Returns -% V - vol struct -% -% e.g Vbeta = get_vol_field(D, 'Vbeta'); -% -% We need to deal with the fact that vol fields can be char or vol_structs. -% SPM99, for good reason, stored the design structs from the results of the -% estimation as file names, which then had to be remapped with spm_vol to -% get the vol structs. The good reason was that this avoided -% byte-swapping problems if the design was copied to another system. -% -% $Id$ - -if nargin < 2 - error('Need field name'); -end - -SPM = des_struct(D); -if ~isfield(SPM, fieldn) - error([ fieldn ' is not a field in design']); -end -V = getfield(SPM, fieldn); -V = full_vol(D, V); diff --git a/lib/marsbar-0.44/@mardo/has_contrasts.m b/lib/marsbar-0.44/@mardo/has_contrasts.m deleted file mode 100644 index caf110b..0000000 --- a/lib/marsbar-0.44/@mardo/has_contrasts.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = has_contrasts(D) -% method returns 1 if design has contrasts -% -% $Id$ - -tf = isfield(des_struct(D), 'xCon'); diff --git a/lib/marsbar-0.44/@mardo/has_filter.m b/lib/marsbar-0.44/@mardo/has_filter.m deleted file mode 100644 index bdbd733..0000000 --- a/lib/marsbar-0.44/@mardo/has_filter.m +++ /dev/null @@ -1,10 +0,0 @@ -function tf = has_filter(o) -% returns 1 if object contains filter -% -% $Id$ - -tf = 0; -des = des_struct(o); -if isfield(des, 'xX') - tf = isfield(des.xX, 'K'); -end diff --git a/lib/marsbar-0.44/@mardo/has_images.m b/lib/marsbar-0.44/@mardo/has_images.m deleted file mode 100644 index b93e185..0000000 --- a/lib/marsbar-0.44/@mardo/has_images.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = has_images(o) -% returns 1 if design contains images, NaN if not known -% -% $Id$ - -tf = NaN; diff --git a/lib/marsbar-0.44/@mardo/has_whitener.m b/lib/marsbar-0.44/@mardo/has_whitener.m deleted file mode 100644 index c3ac884..0000000 --- a/lib/marsbar-0.44/@mardo/has_whitener.m +++ /dev/null @@ -1,7 +0,0 @@ -function tf = has_whitener(D) -% returns 1 if design has whitening filter -% -% $Id$ - -% Which is not the case for default, SPM99 designs -tf = 0; diff --git a/lib/marsbar-0.44/@mardo/image_names.m b/lib/marsbar-0.44/@mardo/image_names.m deleted file mode 100644 index ebc63b0..0000000 --- a/lib/marsbar-0.44/@mardo/image_names.m +++ /dev/null @@ -1,11 +0,0 @@ -function P = image_names(D) -% method returning image file names for design -% Returns cell array of same dimension of image list -% -% $Id$ - -P = {}; -if has_images(D) - VY = get_images(D); - P = reshape({VY.fname},size(VY)); -end diff --git a/lib/marsbar-0.44/@mardo/images.m b/lib/marsbar-0.44/@mardo/images.m deleted file mode 100644 index 0dd47a5..0000000 --- a/lib/marsbar-0.44/@mardo/images.m +++ /dev/null @@ -1,10 +0,0 @@ -function r = images(o, imgs) -% method to get or set images -% -% $Id$ - -if nargin < 2 - r = get_images(o); -else - r = set_images(o, imgs); -end diff --git a/lib/marsbar-0.44/@mardo/is_fmri.m b/lib/marsbar-0.44/@mardo/is_fmri.m deleted file mode 100644 index 1f10dfb..0000000 --- a/lib/marsbar-0.44/@mardo/is_fmri.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = is_fmri(D) -% method returns 1 if this is an fmri design -% -% $Id$ - -tf = strcmp(modality(D), 'fmri'); diff --git a/lib/marsbar-0.44/@mardo/is_mars_estimated.m b/lib/marsbar-0.44/@mardo/is_mars_estimated.m deleted file mode 100644 index 26132b1..0000000 --- a/lib/marsbar-0.44/@mardo/is_mars_estimated.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = is_mars_estimated(D) -% method returns 1 if design has been estimated in MarsBaR -% -% $Id$ - -tf = isfield(D.des_struct, 'marsY'); diff --git a/lib/marsbar-0.44/@mardo/is_marsed.m b/lib/marsbar-0.44/@mardo/is_marsed.m deleted file mode 100644 index 2396044..0000000 --- a/lib/marsbar-0.44/@mardo/is_marsed.m +++ /dev/null @@ -1,3 +0,0 @@ -function tf = is_marsed(o) -% returns 1 if design has been processed with MarsBaR -tf = isfield(o.des_struct, 'xMars'); diff --git a/lib/marsbar-0.44/@mardo/is_spm_estimated.m b/lib/marsbar-0.44/@mardo/is_spm_estimated.m deleted file mode 100644 index a4d9f1c..0000000 --- a/lib/marsbar-0.44/@mardo/is_spm_estimated.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = is_spm_estimated(D) -% returns 1 if design has been estimated in SPM -% -% $Id$ - -tf = isfield(D.des_struct, 'VResMS'); diff --git a/lib/marsbar-0.44/@mardo/is_valid.m b/lib/marsbar-0.44/@mardo/is_valid.m deleted file mode 100644 index e5f3928..0000000 --- a/lib/marsbar-0.44/@mardo/is_valid.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = is_valid(o) -% returns 1 if object contains valid SPM/MarsBaR design -% -% $Id$ - -tf = isfield(des_struct(o), 'xX'); diff --git a/lib/marsbar-0.44/@mardo/isempty.m b/lib/marsbar-0.44/@mardo/isempty.m deleted file mode 100644 index 9b98b59..0000000 --- a/lib/marsbar-0.44/@mardo/isempty.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = isempty(o) -% overloaded isempty method for mardo object -% -% $Id$ - -tf = isempty(o.des_struct); diff --git a/lib/marsbar-0.44/@mardo/isfield.m b/lib/marsbar-0.44/@mardo/isfield.m deleted file mode 100644 index 3e62c38..0000000 --- a/lib/marsbar-0.44/@mardo/isfield.m +++ /dev/null @@ -1,8 +0,0 @@ -function result = isfield(this, fieldn) -% method to overload isfield for mardo objects -% isfield for mardo objects replies according to the contents of -% the des_struct field -% -% $Id$ - -result =isfield(this.des_struct, fieldn); diff --git a/lib/marsbar-0.44/@mardo/mardo.m b/lib/marsbar-0.44/@mardo/mardo.m deleted file mode 100644 index 5b0d391..0000000 --- a/lib/marsbar-0.44/@mardo/mardo.m +++ /dev/null @@ -1,310 +0,0 @@ -function [o, others] = mardo(params, others, passf) -% mardo - class constructor for MarsBaR design object -% inputs [defaults] -% params - one of: -% - string, specifying SPM design file, OR -% - structure, which can: -% contain SPM/MarsBaR design or -% contain fields for mardo object, which should include -% 'des_struct', containing design structure -% others - any other fields for mardo object (or children) -% passf - if 1, or not passed, will try children objects to see if -% they would like to own this design -% -% outputs -% o - mardo object -% others - any unrecognized fields from params, others -% -% Synopsis -% -------- -% D = mardo('/my/spm/analysis/directory/SPM.mat'); -% % or -% load('/my/spm/analysis/directory/SPM.mat'); -% D = mardo(SPM); -% % or -% load('/my/spm/analysis/directory/SPM.mat'); -% D = mardo(struct('des_struct', SPM, 'verbose', 0)); -% % or -% D = mardo(SPM, struct('verbose', 0)); -% -% mardo is an object to contain SPM designs. It allows us to deal with -% different design formats by overloading functions in child objects, here -% for harmonizing between SPM2 and SPM99 designs. It is transparent, in -% the sense that it can be referenced as a structure, so to the user, it -% can appear as if the design continues to be the familiar old SPM structure. -% -% This constructor first checks for strings; it treats strings as filenames -% containing SPM designs, and loads the file. By now it should have an SPM -% design structure (passed or loaded). It then labels itself as a mardo -% design, and passes itself to candidate mardo design classes (99 and 2 type -% designs) for these classes to further claim the object. If the (99 or 2) -% classes claim the object, they return an object of class (99 or 2), which -% inherits the mardo class just created in this call to the object. -% -% Note the "passf" input flag; this is a trick to allow the other mardo -% classes (99 and 2) to create a mardo object for them to inherit, without -% this constructor passing the mardo object back to the other classes, -% creating an infinite loop. So, the flag is by default set to 1, and the -% newly created mardo object is passed to the other mardo classes for them -% to claim ownership. The other mardo classes can call this constructor -% with passf set to 0 in order for the constructor merely to make a mardo -% object, without passing back to the other classes. -% -% Note also the way that the constructor passes out fields in the input -% structures that it does not recognize. This is so apparently useless -% field information can be passed to child objects for processing (or -% parent objects, but mardo does not have a parent). -% -% Fields -% des_struct - structure containing SPM design -% verbose - flag; if 1, display text messages during processing -% flip_option - flag; only used on creation of the object. If 1, and the -% design not the same format as the current version of SPM -% on the path, then this constructor will flip the images -% in the design left to right. So, if an SPM99 design -% object is being created, and SPM2 is the version on the -% path, and flip_option is set to 1, then the images will -% be automatically flipped in the design, as the object is -% being created. -% -% Methods -% is_valid - returns 1 if des_struct contains a valid design -% is_fmri - returns 1 if design is modality 'fmri' -% is_marsed - returns 1 if design has been processed with MarsBaR -% is_mars_estimated - returns 1 if design has Mars estimation data -% is_spm_estimated - returns 1 if design has SPM estimation data -% modality - returns one of 'fmri','pet','unknown' -% verbose - whether reporting is verbose or not (1 or 0) -% type - returns design version string 'SPM2' or 'SPM99' -% block_rows - returns cell array, one cell per subject or session, -% containing indices of design rows for that -% subject/session -% block_means - returns means for each block in the design -% n_time_points - number of rows (time points) in design -% n_effects - number of columns (effects) in design -% ui_report - display design report and query menu in UI -% ui_report_fmri - design report + inspection tools for FMRI -% -% savestruct - saves design structure to file, with fields as variables -% des_struct - sets or gets design structure -% -% has_filter - returns 1 if the design contains a filter, NaN if not known -% apply_filter - applies design filter to data -% ui_get_filter - gets filter and stocks in design -% fill - fills design with filter, images, or default values -% -% data - get/set data in estimated design -% get_data - get data -% set_data - set_data -% -% contrasts - get/set contrasts -% has_contrasts - returns 1 if the design contains contrasts -% set_contrasts - set contrasts to design -% get_contrasts - returns contrasts if present -% add_contrasts - adds contrasts from a design, xCon struct or passed values -% ui_get_contrasts - runs spm_conman to choose contrasts, returns indices -% -% has_images - returns 1 if the design contains images, NaN if not known -% images - gets / sets images in design -% get_images - gets image vol structs if present -% set_images - sets images -% image_names - gets image names as cell array -% cd_images - changes root directory to design images -% prefix_images - adds, removes prefix from images names (e.g. 's') -% -% estimate - estimates design, given data -% compute_contrasts - computes contrasts, returns statistics structure -% stat_table - return statistic table report and structures for -% contrasts -% mars_spm_graph - runs graph UI, displays in SPM windows -% -% event_signal - calculates % signal change for (maybe compound) event -% event_fitted - gets fitted time course for (maybe compound) event -% event_regressor - returns regressor for given event type and duration -% ui_get_event - runs UI to select a single event -% ui_event_types - runs UI to select, create, edit event types. -% event_cols - returns column in design from given event -% -% $Id$ - -myclass = 'mardo'; -cvs_v = marsbar('ver'); % was CVS version; now marsbar version - -% Default flip option -flippo = mars_struct('getifthere', ... - spm('getglobal', 'MARS'), ... - 'OPTIONS', ... - 'statistics', ... - 'flip_option'); -if isempty(flippo), flippo = 0; end - -% Default object structure; see also paramfields.m -defstruct = struct('des_struct', [],... - 'flip_option', flippo,... - 'verbose', 1); - -if nargin < 1 - defstruct.cvs_version = cvs_v; - o = class(defstruct, myclass); - others = []; - return -end -if nargin < 2 - others = []; -end -if nargin < 3 - passf = 1; -end - -% Deal with passed objects of this (or child) class -if isa(params, myclass) - o = params; - % Check for simple form of call - if isempty(others), return, end - - % Otherwise, we are being asked to set fields of object - [p others] = mars_struct('split', others, defstruct); - if isfield(p, 'des_struct') - error('Please set des_struct using des_struct method'); - end - if isfield(p, 'verbose'), o.verbose = p.verbose; end - if isfield(p, 'flip_option'), o.flip_option = p.flip_option; end - return -end - -% check inputs -if ischar(params) % maybe filename - fname = deblank(params); - fname = spm_get('CPath', fname); - params = load(fname); - params.swd = fileparts(fname); -else - fname = ''; -end -if isstruct(params) - if ~isfield(params, 'des_struct') - % Appears to be an SPM design - params = struct('des_struct', params); - end -end - -% fill with other params, defaults, parse into fields for this object, -% children -params = mars_struct('ffillmerge', params, others); -[params, others] = mars_struct('ffillsplit', defstruct, params); - -% cvs version -params.cvs_version = cvs_v; - -% set the mardo object -o = class(params, myclass); - -% Return if des_struct is empty, there's nothing to do -if isempty(o.des_struct), return, end - -% If requested, pass to child objects to request ownership -if passf - % Check what object type is returned from each of the potential - % constructors. If returns default (this) object type, the constructor - % has disowned the design, and keep looking - [o others] = mardo_99(o, others); - if strcmp(class(o), myclass) - [o others] = mardo_2(o, others); - end - if strcmp(class(o), myclass) - [o others] = mardo_5(o, others); - end -end - -% convert MarsBaR data field to object, if present -if isfield(o.des_struct, 'marsY') - o.des_struct.marsY = marsy(o.des_struct.marsY); -end - -% If the design was loaded from a file, and is 99 type then it may need -% contrasts. If it was estimated in MarsBaR, try loading mars_xCon.mat in the -% same directory. If it was estimated in SPM, try loading xCon.mat in the same -% directory. -if ~isempty(fname) & strcmp(type(o), 'SPM99') & ~has_contrasts(o) - % We try to load contrasts from an xCon file - [pn fn ext] = fileparts(fname); - if is_mars_estimated(o) - xcon_name = fullfile(pn, 'mars_xCon.mat') - elseif is_spm_estimated(o) - xcon_name = fullfile(pn, 'xCon.mat'); - else - xcon_name = ''; - end - if ~isempty(xcon_name) - % There is a file to load - if exist(xcon_name, 'file') - xc = load(xcon_name); - if isfield(xc, 'xCon') - o = set_contrasts(o, xc.xCon); - if verbose(o) - disp(['Set contrasts from ' xcon_name]); - end - end - elseif verbose(o) - disp('Failed to load contrasts'); - end - end -end - -% Refresh contrasts if option specifies -if is_mars_estimated(o) & mars_get_option('statistics', 'refresh_contrasts') - o = refresh_contrasts(o); -end - -% sort out design image flipping -dt = type(o); -sv = mars_utils('spm_version'); -maybe_flip = ~strcmp(dt, sv) & ismember('SPM99', {dt, sv}); -if ~is_marsed(o) - if sf_tf(has_images(o)) & maybe_flip - flippo = flip_option(o); - switch flippo - case 1 - o = flip_images(o); - add_str = ''; - case 0 - add_str = 'not '; - otherwise - error(['Do not recognize flip option ' flippo]); - end - if verbose(o) - fprintf([... - 'This a design from %s, but you are currently using %s\n',... - 'Data may be extracted from different sides in X (L/R)\n',... - 'when using this design with %s compared to %s.\n',... - 'NB mardo object has %sflipped the images for this design\n'],... - dt, sv, dt, sv, add_str); - end - end % has_images, design/running SPM version differ - % Add Mars tag - o = mars_tag(o, struct(... - 'flipped', flip_option(o))); -end - -% resolve confusing field name in marsbar <= 0.23 -% ResMS was in fact the _Root_ Mean Square -% The statistics routines treated the field correctly -D = o.des_struct; -if isfield(D, 'ResMS') - if verbose(o) - msg = {'Compatibility trivia: processed ResMS to ResidualMS'}; - fprintf('\n%s',sprintf('%s\n',msg{:})); - end - D.ResidualMS = D.ResMS .^ 2; - D = rmfield(D, 'ResMS'); - o.des_struct = D; -end - -return - -function r = sf_tf(d) -if isnan(d), r = 0; -else - r = (d~=0); -end -return diff --git a/lib/marsbar-0.44/@mardo/mars_tag.m b/lib/marsbar-0.44/@mardo/mars_tag.m deleted file mode 100644 index 52a4a5c..0000000 --- a/lib/marsbar-0.44/@mardo/mars_tag.m +++ /dev/null @@ -1,16 +0,0 @@ -function res = mars_tag(o, data) -% returns, or sets, Mars tagging structure in design -% -% $Id$ - -if nargin > 1 % set - res = o; - res.des_struct.xMars = data; - return -end - -if isfield(o.des_struct, 'xMars') % get - res = o.des_struct.xMars; -else - res = []; -end diff --git a/lib/marsbar-0.44/@mardo/marsy_data.m b/lib/marsbar-0.44/@mardo/marsy_data.m deleted file mode 100644 index 449408e..0000000 --- a/lib/marsbar-0.44/@mardo/marsy_data.m +++ /dev/null @@ -1,10 +0,0 @@ -function r = marsy_data(o, Y) -% method to get or set marsy data -% -% $Id$ - -if nargin < 2 - r = get_data(o); -else - r = set_data(o, Y); -end diff --git a/lib/marsbar-0.44/@mardo/masking_struct.m b/lib/marsbar-0.44/@mardo/masking_struct.m deleted file mode 100644 index fb3ebbc..0000000 --- a/lib/marsbar-0.44/@mardo/masking_struct.m +++ /dev/null @@ -1,12 +0,0 @@ -function r = masking_struct(o, xM) -% method to get or set SPM masking structure -% -% $Id$ - -SPM = des_struct(o); -if nargin < 2 - r = mars_struct('getifthere', SPM, 'xM'); -else - SPM.xM = xM; - r = des_struct(o, SPM); -end diff --git a/lib/marsbar-0.44/@mardo/modality.m b/lib/marsbar-0.44/@mardo/modality.m deleted file mode 100644 index 808ab90..0000000 --- a/lib/marsbar-0.44/@mardo/modality.m +++ /dev/null @@ -1,6 +0,0 @@ -function mod_str = modality(D) -% method returns modality of design -% -% $Id$ - -mod_str = 'unknown'; diff --git a/lib/marsbar-0.44/@mardo/n_effects.m b/lib/marsbar-0.44/@mardo/n_effects.m deleted file mode 100644 index fc670e6..0000000 --- a/lib/marsbar-0.44/@mardo/n_effects.m +++ /dev/null @@ -1,7 +0,0 @@ -function n = n_effects(o) -% get number of effects (columns) in design -% -% $Id$ - -SPM = des_struct(o); -n = size(SPM.xX.X, 2); diff --git a/lib/marsbar-0.44/@mardo/n_time_points.m b/lib/marsbar-0.44/@mardo/n_time_points.m deleted file mode 100644 index 5c38b2c..0000000 --- a/lib/marsbar-0.44/@mardo/n_time_points.m +++ /dev/null @@ -1,7 +0,0 @@ -function n = n_time_points(o) -% get number of time_points in design -% -% $Id$ - -SPM = des_struct(o); -n = size(SPM.xX.X, 1); diff --git a/lib/marsbar-0.44/@mardo/native_vol_ver.m b/lib/marsbar-0.44/@mardo/native_vol_ver.m deleted file mode 100644 index 4b27462..0000000 --- a/lib/marsbar-0.44/@mardo/native_vol_ver.m +++ /dev/null @@ -1,6 +0,0 @@ -function res = native_vol_ver(obj) -% return string specifying native vol type -% -% $Id: verbose.m 87 2004-01-06 01:48:35Z matthewbrett $ - -res = '99'; diff --git a/lib/marsbar-0.44/@mardo/paramfields.m b/lib/marsbar-0.44/@mardo/paramfields.m deleted file mode 100644 index 1fe8aea..0000000 --- a/lib/marsbar-0.44/@mardo/paramfields.m +++ /dev/null @@ -1,8 +0,0 @@ -function params = paramfields(o) -% returns struct with fields from maroi object useful for copying objects -% -% $Id$ - -params = struct('des_struct', o.des_struct,... - 'flip_option', o.flip_option,... - 'verbose', o.verbose); diff --git a/lib/marsbar-0.44/@mardo/prefix_images.m b/lib/marsbar-0.44/@mardo/prefix_images.m deleted file mode 100644 index 4d8bc82..0000000 --- a/lib/marsbar-0.44/@mardo/prefix_images.m +++ /dev/null @@ -1,99 +0,0 @@ -function D = prefix_images(D, action, prefix, flags) -% method for adding or removing prefix from file names in design -% FORMAT D = prefix_images(D, action, prefix) -% -% D - mardo design -% action - one of 'add' or 'remove' -% prefix - prefix to remove -% flags - optional struct containing none or more of fields -% 'check_exist' - one of 'warn', 'error', 'none' -% If not 'none' checks images exist with new -% filenames -% 'check_all' - if not 0, checks all images, instead of -% the first image in the image list -% 'check_swap' - if not 0, checks if images with new -% filenames need byte swapping, and swaps if so -% -% $Id$ - -def_flags = struct('check_exist', 'none', ... - 'check_all', 1, ... - 'check_swap', 0); - -if nargin < 2 - action = 'remove'; -end -if nargin < 3 - prefix = 's'; -end -if nargin < 4 - flags = []; -end -flags = mars_struct('ffillsplit', def_flags, flags); -if flags.check_swap, flags.check_exist = 'error'; end - -% get images -if ~has_images(D) - warning('Design does not contain images'); - return -end -VY = get_images(D); - -% remove prefix -files = strvcat(VY(:).fname); -fpaths = spm_str_manip(files, 'h'); -fns = spm_str_manip(files, 't'); -nf = size(files, 1); - -switch lower(action) - case 'remove' - s_is = strmatch(prefix, fns); - if length(s_is) == nf - fns(:, 1:length(prefix)) = []; - else - warning(['Not all analysis files prefixed with ''' prefix ... - ''', design has not been changed']) - return - end - case 'add' - fns = [repmat(prefix, nf, 1) fns]; - otherwise - error(['Warped action ' action]); -end - -newfns = cellstr(strcat(fpaths, filesep, fns)); -[VY(:).fname] = deal(newfns{:}); - -% Do checks if necessary -c_e = lower(flags.check_exist); -switch c_e - case 'none' - case {'error', 'warn'} - if ~flags.check_all, cV = VY(1); else cV = VY; end - e_f = 1; - n_chk = prod(size(cV)); - for v = 1:n_chk - if ~exist(newfns{v}, 'file'), e_f = 0; break; end - end - if ~e_f - str = sprintf('Image %s does not exist', newfns{v}); - if strcmp(c_e, 'error'), error(str); else warn(str); end - end - otherwise - error(sprintf('Who asked for %s?', c_e)); -end -if flags.check_swap - if flags.check_all - for v = 1:nf - if mars_vol_utils('is_swapped_wrong', VY(v)) - VY(v) = mars_vol_utils('byte_swap', VY(v)); - end - end - else % just check the first and apply to all - if mars_vol_utils('is_swapped_wrong', VY(1)) - VY = mars_vol_utils('byte_swap', VY); - end - end -end - -D = set_images(D, VY); diff --git a/lib/marsbar-0.44/@mardo/private/pr_ev_diff.m b/lib/marsbar-0.44/@mardo/private/pr_ev_diff.m deleted file mode 100644 index a7aad0c..0000000 --- a/lib/marsbar-0.44/@mardo/private/pr_ev_diff.m +++ /dev/null @@ -1,45 +0,0 @@ -function d = pr_ev_diff(ev_tc, diff_func, varargin) -% method to calculate event height for % signal change -% FORMAT d = pr_ev_diff(ev_tc, diff_func, varargin) -% -% Inputs -% ev_tc - event time course -% diff_func - difference function; one of -% 'max' - the maximum of the time course -% 'max-min' - the max minus the min -% 'abs max' - if abs(max) > abs(min) => max otherwise => min -% 'abs max-min' - if abs(max) > abs(min) => (max - min) -% otherwise => (min - max) -% -% $Id$ - -if nargin < 2 - diff_func = ''; -end -if isempty(diff_func) - diff_func = 'max'; -end - -[m n] = size(ev_tc); -d = zeros(1, n); -switch lower(diff_func) - case 'max' - d = max(ev_tc, [], 1); - case 'max-min' - d = max(ev_tc, [], 1) - min(ev_tc, [], 1); - case 'abs max' - [d i] = max(abs(ev_tc), [], 1); - for s = 1:n, d(s) = ev_tc(i(s), s); end - case 'abs max-min' - mx = max(ev_tc, [], 1); - mn = min(ev_tc, [], 1); - i = abs(mx) > abs(mn); - d(i) = mx(i)-mn(i); - d(~i) = mn(~i)-mx(~i); - case 'window' - if nargin < 4, error('Need window and dt'); end - w = round(varargin{1} / varargin{2}) + 1; - d = mean(ev_tc(w(1):w(2), :), 1); - otherwise - error(sprintf('What is this difference function: %s?', diff_func)); -end diff --git a/lib/marsbar-0.44/@mardo/private/pr_refresh_et.m b/lib/marsbar-0.44/@mardo/private/pr_refresh_et.m deleted file mode 100644 index 1b3faae..0000000 --- a/lib/marsbar-0.44/@mardo/private/pr_refresh_et.m +++ /dev/null @@ -1,48 +0,0 @@ -function F = pr_refresh_et(D, ic, F, hList, hEdit) -% Refreshes data and display of event type window after edit -% FORMAT F = pr_refresh_et(D, ic, F, hList) -% -% D - design object -% ic - indices to events to select -% F - (optional) figure handle -% hList - (optional) handle to list uicontrol -% hEdit - (optional) handle to Edit uicontrol -% -% Returns -% F - figure handle (in case you didn't have it) -% -% $Id$ - -if nargin < 1 - error('Need object'); -end -if nargin < 2 - ic = []; -end -if nargin < 3 - F = findobj(get(0, 'Children'), 'Flat', 'Tag', 'ui_event_types'); -end -if nargin < 4 - hList = findobj(F, 'Tag','eList'); -end -if nargin < 5 - hEdit = findobj(F, 'Tag','eEdit'); -end - -if ~ishandle(F) - error('Could not find ui_event_types window'); -end - -et = event_types(D); - -% Event type list to put -if isfield(et, 'name') - eNames = {et(:).name}; -else - eNames = {}; -end - -set(hList, 'String', eNames); -set(hList, 'Value', ic); -set(F, 'Userdata', D); -set(hEdit, 'UserData', 1); diff --git a/lib/marsbar-0.44/@mardo/private/pr_sort_evs.m b/lib/marsbar-0.44/@mardo/private/pr_sort_evs.m deleted file mode 100644 index 8d32ced..0000000 --- a/lib/marsbar-0.44/@mardo/private/pr_sort_evs.m +++ /dev/null @@ -1,41 +0,0 @@ -function evs = pr_sort_evs(evs, sort_type, downf) -% function to sort event according to sort type -% FORMAT evs = pr_sort_evs(evs, sort_type, downf) -% -% evs - structure containing fields -% 'names': names of events -% 'e_spec': row1 = session row2 = event number -% sort_type - one of 'session' 'event' 'name' -% downf - 1 if descending sort, 0 otherwise (0 default) -% -% Returns -% evs - sorted event structure -% -% $Id$ - -if nargin < 2 - error('Need event specs and sort type'); -end -if nargin < 3 - downf = 0; -end - -e_s = [evs.e_spec]'; - -switch lower(sort_type) - case {'session no', 'session'} - [tmp I] = sortrows(e_s); - case {'event no', 'event'} - [tmp I] = sortrows(e_s, [2 1]); - case {'event name', 'name'} - [tmp I] = sort(evs.names); - otherwise - error(['Crazy sorting too much with ' sort_type]); -end - -if downf, I = flipud(I); end - -evs.names = evs.names(I); -evs.e_spec = evs.e_spec(:, I); - -return diff --git a/lib/marsbar-0.44/@mardo/refresh_contrasts.m b/lib/marsbar-0.44/@mardo/refresh_contrasts.m deleted file mode 100644 index ad2947b..0000000 --- a/lib/marsbar-0.44/@mardo/refresh_contrasts.m +++ /dev/null @@ -1,3 +0,0 @@ -function o = refresh_contrasts(o) -% method to refresh contrasts to match design -o = set_contrasts(o, get_contrasts(o)); diff --git a/lib/marsbar-0.44/@mardo/residuals.m b/lib/marsbar-0.44/@mardo/residuals.m deleted file mode 100644 index 1729ce4..0000000 --- a/lib/marsbar-0.44/@mardo/residuals.m +++ /dev/null @@ -1,30 +0,0 @@ -function r = residuals(D) -% method returns residuals from model -% -% $Id$ - -if ~is_mars_estimated(D) - error('Need estimated model'); -end -Y = get_data(D); -if ~is_summarized(Y) - Y = resummarize(Y); -end -if ~is_summarized(Y) - error('Cannot get summarized data from model data'); -end -y = summary_data(Y); - -if is_fmri(D) - if ~has_filter(D) - error('FMRI design lacks filter'); - end - y = apply_filter(D, y); -end - -SPM = des_struct(D); -r = marsy(spm_sp('r',SPM.xX.xKXs,y), ... - region_name(Y), ... - struct('info', summary_info(Y),... - 'descrip', ['Residuals for ' summary_descrip(Y)],... - 'block_rows', {block_rows(D)})); diff --git a/lib/marsbar-0.44/@mardo/savestruct.m b/lib/marsbar-0.44/@mardo/savestruct.m deleted file mode 100644 index 36991f6..0000000 --- a/lib/marsbar-0.44/@mardo/savestruct.m +++ /dev/null @@ -1,28 +0,0 @@ -function savestruct(obj, filename) -% saves data in def_struct as variables in .mat file -% FORMAT savestruct(object, matname) -% -% $Id$ - -if nargin ~= 2 - error('Need matfile name'); -end - -% allow args to be in reverse order -if ischar(obj) - tmp = obj; - obj = filename; - filename = tmp; -end - -% Convert vols to native format -obj = convert_vols(obj, native_vol_ver(obj)); - -% unobjectify marsy object before save -SPM = des_struct(obj); -if isfield(SPM, 'marsY') - SPM.marsY = y_struct(SPM.marsY); -end -savestruct(SPM, filename) - -return diff --git a/lib/marsbar-0.44/@mardo/set_contrasts.m b/lib/marsbar-0.44/@mardo/set_contrasts.m deleted file mode 100644 index 0b4afba..0000000 --- a/lib/marsbar-0.44/@mardo/set_contrasts.m +++ /dev/null @@ -1,34 +0,0 @@ -function D = set_contrasts(D, C, refreshf) -% method to set contrasts into design object -% -% D - design -% C - contrasts -% C can be a contrast structure, or a structure containing -% a contrast structure -% refreshf - if 1 then refresh contrasts with respect to design matrix -% structures in `D`. Default is 1 -% -% Returns -% D - design with contrasts set to C -% -% $Id$ - -if nargin < 2 - error('Need contrasts'); -end -if nargin < 3 - refreshf = 1; -end -if isfield(C, 'xCon'); - C = C.xCon; -end -SPM = des_struct(D); -if refreshf - % Use add contrasts routine to refresh contrasts - SPM.xCon = []; - D = des_struct(D, SPM); - D = add_contrasts(D, C); -else % Hope for the best - SPM.xCon = C; - D = des_struct(D, SPM); -end diff --git a/lib/marsbar-0.44/@mardo/set_data.m b/lib/marsbar-0.44/@mardo/set_data.m deleted file mode 100644 index bd814d6..0000000 --- a/lib/marsbar-0.44/@mardo/set_data.m +++ /dev/null @@ -1,8 +0,0 @@ -function D = set_data(D, d) -% method to set data for design object -% -% $Id$ - -SPM = des_struct(D); -SPM.marsY = marsy(d); -D = des_struct(D, SPM); diff --git a/lib/marsbar-0.44/@mardo/set_vol_field.m b/lib/marsbar-0.44/@mardo/set_vol_field.m deleted file mode 100644 index 7349aa0..0000000 --- a/lib/marsbar-0.44/@mardo/set_vol_field.m +++ /dev/null @@ -1,31 +0,0 @@ -function D = set_vol_field(D, fieldn, imgs) -% method to set named field, containing or referring to vol structs -% FORMAT D = get_vol_field(D, fieldn, imgs) -% -% D - design object -% fieldn - field name -% imgs - image names or vol structs -% -% Returns -% D - changed object -% -% e.g D = get_vol_field(D, 'Vbeta', Vbeta); -% -% We need to deal with the fact that vol fields can be char or vol_structs. -% SPM99, for good reason, stored the design structs from the results of the -% estimation as file names, which then had to be remapped with spm_vol to -% get the vol structs. The good reason was that this avoided -% byte-swapping problems if the design was copied to another system. -% -% $Id$ - -if nargin < 2 - error('Need field name'); -end - -SPM = des_struct(D); - -V = design_vol(D, imgs); - -SPM = setfield(SPM, fieldn, V); -D = des_struct(D, SPM); diff --git a/lib/marsbar-0.44/@mardo/stat_table.m b/lib/marsbar-0.44/@mardo/stat_table.m deleted file mode 100644 index 418e6cb..0000000 --- a/lib/marsbar-0.44/@mardo/stat_table.m +++ /dev/null @@ -1,62 +0,0 @@ -function [rep_strs, marsS, marsD, changef] = stat_table(marsD, Ic) -% gets Mars statistics and creates statistic table as cell array -% FORMAT [rep_strs, marsS, marsD, changef] = stat_table(marsD, Ic) -% -% Inputs -% marsD - MarsBaR design structure -% Ic - indices for contrasts to be displayed -% -% Outputs -% rep_strs - Cell array containing table report -% marsS - MarsBaR statistics structure -% marsD - design, including contrast structure (which -% might have changed) -% changef - flag to indicate if design has changed -% -% $Id$ - -if nargin < 2 - Ic = []; -end - -changef = 0; -if isempty(Ic) - [Ic marsD changef] = ui_get_contrasts(marsD,'T|F',Inf,... - 'Select contrasts ','',1); -end - -% Do statistics work -[marsS] = compute_contrasts(marsD, Ic); - -% output to text table -if isempty(marsS), return, end -% output column headings -if marsS.rows{1}.stat == 'T' - numstr = 'Contrast value'; - statstr = 't statistic'; -else - numstr = 'Extra SS'; - statstr = 'F statistic'; -end -str = sprintf('%-20s%20s:%15s:%15s:%15s:%15s',... - 'Contrast name',... - 'ROI name',... - numstr,... - statstr,... - 'Uncorrected P',... - 'Corrected P'); -rep_strs{1} = sprintf('\n%s\n%s\n',str, repmat('-',1,length(str))); - -for con = 1:length(marsS.rows) - rep_strs{end+1} = sprintf('%s\n%s\n', ... - marsS.rows{con}.name,... - repmat('-',1,42)); - for roi = 1:length(marsS.columns) - rep_strs{end+1} = sprintf('%40s:%15.2f:%15.2f:%15.6f:%15.6f\n', ... - marsS.columns{roi},... - marsS.con(con,roi),... - marsS.stat(con,roi),... - marsS.P(con,roi),... - marsS.Pc(con,roi)); - end -end diff --git a/lib/marsbar-0.44/@mardo/subsasgn.m b/lib/marsbar-0.44/@mardo/subsasgn.m deleted file mode 100644 index c3a6971..0000000 --- a/lib/marsbar-0.44/@mardo/subsasgn.m +++ /dev/null @@ -1,9 +0,0 @@ -function result = subsasgn(this, Struct, rhs) -% method to overload . notation in assignments. -% . assignment for mardo objects acts on the contents of des_struct -% -% $Id$ - -SPM = des_struct(this); -SPM = builtin('subsasgn', SPM, Struct, rhs); -result = des_struct(this, SPM); diff --git a/lib/marsbar-0.44/@mardo/subsref.m b/lib/marsbar-0.44/@mardo/subsref.m deleted file mode 100644 index 05634e4..0000000 --- a/lib/marsbar-0.44/@mardo/subsref.m +++ /dev/null @@ -1,7 +0,0 @@ -function result = subsref(this, Struct) -% method to overload the . notation. -% . reference for mardo objects returns contents of des_struct -% -% $Id$ - -result = builtin('subsref', des_struct(this), Struct ); diff --git a/lib/marsbar-0.44/@mardo/summary.m b/lib/marsbar-0.44/@mardo/summary.m deleted file mode 100644 index 0322213..0000000 --- a/lib/marsbar-0.44/@mardo/summary.m +++ /dev/null @@ -1,27 +0,0 @@ -function strs = summary(D) -% method returns cell array of strings describing design -% -% $Id$ - -strs{1} = sprintf('SPM working dir \t%s', swd(D)); -strs{2} = sprintf('Design type: \t%s', type(D)); -strs{3} = sprintf('Modality: \t%s', modality(D)); -if is_fmri(D) - tmp = sf_recode(has_filter(D)); -else - tmp = 'N/A'; -end -strs{4} = sprintf('Has filter?: \t%s', tmp); -strs{5} = sprintf('Has images?: \t%s', ... - sf_recode(has_images(D))); -strs{6} = sprintf('MarsBaR estimated?:\t%s', ... - sf_recode(is_mars_estimated(D))); -strs = [strs {'Description:'}, descrip(D)]; - -return - -function str = sf_recode(tf) -if isnan(tf), str = 'unknown'; -elseif tf, str = 'yes'; -else str = 'no'; -end diff --git a/lib/marsbar-0.44/@mardo/swd.m b/lib/marsbar-0.44/@mardo/swd.m deleted file mode 100644 index 3e894b8..0000000 --- a/lib/marsbar-0.44/@mardo/swd.m +++ /dev/null @@ -1,14 +0,0 @@ -function res = swd(D, dir) -% method to get/set design directory -% FORMAT dir = swd(D); % get -% FORMAT D = swd(D, dir); % set -% -% $Id$ - -SPM = des_struct(D); -if nargin < 2 - res = mars_struct('getifthere', SPM, 'swd'); -else - SPM.swd = dir; - res = des_struct(D, SPM); -end diff --git a/lib/marsbar-0.44/@mardo/swd_writable.m b/lib/marsbar-0.44/@mardo/swd_writable.m deleted file mode 100644 index edd482e..0000000 --- a/lib/marsbar-0.44/@mardo/swd_writable.m +++ /dev/null @@ -1,15 +0,0 @@ -function tf = swd_writable(D) -% returns true if swd directory can be written to -% -% $Id$ - -tf = 0; -Swd = swd(D); -if isempty(Swd), return, end - -test_file = fullfile(Swd, 'write_test.txt'); -try - save(test_file, 'test_file'); - tf = 1; -end -if tf, delete(test_file); end diff --git a/lib/marsbar-0.44/@mardo/type.m b/lib/marsbar-0.44/@mardo/type.m deleted file mode 100644 index 9b14545..0000000 --- a/lib/marsbar-0.44/@mardo/type.m +++ /dev/null @@ -1,6 +0,0 @@ -function str = type(o) -% returns SPM version string corresponding to design type -% -% $Id$ - -str = 'Unknown'; diff --git a/lib/marsbar-0.44/@mardo/ui_et_edit.m b/lib/marsbar-0.44/@mardo/ui_et_edit.m deleted file mode 100644 index 54af055..0000000 --- a/lib/marsbar-0.44/@mardo/ui_et_edit.m +++ /dev/null @@ -1,293 +0,0 @@ -function [D, ic] = ui_et_edit(D, ic) -% method to edit invidual event types in design -% FORMAT [D, ic] = ui_et_edit(D, ic) -% -% D - design object -% ic - index identifying event type to edit (or edited) -% -% In this case, the return of an empty ic means that the routine was -% cancelled, as this makes no sense otherwise. -% -% The object method idea here is rather a hack, because the passed object is -% used only to pull in the object methods for the callback. -% -% We first collect all the events from the design, and their names. The -% event passed, that are IN, get attached to the top (IN) panel, and the -% rest go to the bottom (OUT) panel. Event names and definitions -% (session, event number pairs) are always sorted according to the -% current sort mode, which is set from the GUI. -% -% $Id$ - -et = event_types(D); -len_et = prod(size(et)); -if nargin < 2 - if len_et > 1 - error('Need event number to edit'); - end - if len_et - ic = 1; - else - ic = Inf; - end -end -if prod(size(ic)) > 1 - error('Can only edit one event'); -end -if ~isfinite(ic) % New - my_event = struct('name', 'New event', ... - 'e_spec', []); - ic = len_et + 1; -elseif ic < 0 | ic > len_et - error('Event number is out of range'); -else - my_event = et(ic); -end - -% Put up window and initialize callbacks -[F hDone hListIN hName] = sf_start_edit_window(D, my_event); - -% Wait for OK, Cancel, figure cleared. -waitfor(hDone,'UserData') - -% Get what was pressed, assume cancel if window has died -if ~ishandle(hDone) - status = 0; - ic = []; -else - status = get(hDone, 'UserData'); - if status % OK - my_event.name = get(hName, 'String'); - e_vals = get(hListIN, 'UserData'); - my_event.e_spec = mars_struct('getifthere', e_vals, 'e_spec'); - if isempty(et), et = my_event; else et(ic) = my_event; end - D = event_types(D, et); - else - ic = []; - end - close(F); -end - -return - -function [F, hDone, hListIN, hName] = sf_start_edit_window(D, my_event) -% Put up window and set up callbacks - -% Window tag -w_tag = 'ui_et_edit'; - -% Close any et_edit windows currently open -close(findobj('Tag', w_tag)) - -%-Generic CallBack code to get embedded object -cb = ['ete_D = get(findobj(''Tag'', ''' w_tag '''),''UserData''); ']; - -% Get events IN and events OUT -[all_es ev_names] = event_specs(D); -n_evs = size(all_es, 2); -ev_names = cellstr([char(ev_names) ... % add session names - repmat(': session ', n_evs, 1) ... - num2str(all_es(1, :)')]); -if isempty(my_event.e_spec) - in_cols = logical(zeros(n_evs, 1)); -else - in_cols = ismember(all_es', my_event.e_spec', 'rows'); -end -IN_evs = pr_sort_evs(struct('names', {ev_names(in_cols)},... - 'e_spec', all_es(:, in_cols)), ... - 'session'); -OUT_evs = pr_sort_evs(struct('names', {ev_names(~in_cols)},... - 'e_spec', all_es(:, ~in_cols)),... - 'session'); - -%-Create window, compute scaling for screen size -%----------------------------------------------------------------------- -WS = spm('WinScale'); %-Window scaling factors -FS = spm('FontSizes'); %-Scaled font sizes -PF = spm_platform('fonts'); %-Font names (for this platform) -S0 = get(0,'ScreenSize'); %-Screen size - -% Window size, button size, positions, in WS units -win_sz = [400 500]; -b_ratio = (1 + sqrt(5))/1.5; -border_x = 12; -border_y = 12; -text_sz = 12; -button_sz_x = 80; -button_sz_y = button_sz_x / b_ratio; -button_sz = [button_sz_x button_sz_y]; - -% Text sizes, locations -label_gap = 4; % y gap between label and control it refers to -label_sz_y = text_sz *1.5; -control_gap = 14; % default y gap between controls -text_box_sz = label_sz_y * 1.5; - -% Sizes, positions for stuff on LHS -OUT_list_y = border_y; -name_label_y = win_sz(2)-border_y-label_sz_y; -name_box_y = name_label_y - label_gap - text_box_sz; -IN_label_y = name_box_y - control_gap - label_sz_y; -IN_list_top = IN_label_y - label_gap; - -list_sz_y = (IN_list_top - OUT_list_y ... - - control_gap - label_sz_y - label_gap)/2; - -IN_list_y = IN_list_top - list_sz_y; -OUT_label_y = IN_list_y - control_gap - label_sz_y; -OUT_list_top = OUT_label_y - label_gap; - -% Sizes, positions for stuff on RHS -n_buttons = 4; % buttons (sizes) to spread out across list size -button_x = win_sz(1) - button_sz_x - border_x; -gap_b = (list_sz_y - button_sz_y) / (n_buttons-1); -buttons_y = [OUT_list_y:gap_b:OUT_list_top ... - IN_list_y:gap_b:IN_list_top]; -sort_box_y = buttons_y(6); -sort_label_y = sort_box_y + button_sz_y + label_gap; - -% Sort out x sizes for LHS -list_sz_x = button_x - border_x*2; -list_sz = [list_sz_x list_sz_y]; - -% Figure -F = figure('IntegerHandle','off',... - 'Tag', w_tag,... - 'UserData', D, ... - 'Name','Event type edit', ... - 'NumberTitle','off',... - 'Position',[S0(3)/2,S0(4)/2,0,0] + [-250,-200, win_sz].*WS,... - 'Resize','off',... - 'Color',[1 1 1]*.7,... - 'MenuBar','none',... - 'DefaultTextColor','k',... - 'DefaultTextFontName',PF.helvetica,... - 'DefaultTextFontSize',FS(text_sz),... - 'DefaultAxesFontName',PF.helvetica,... - 'DefaultUicontrolBackgroundColor',[1 1 1]*.7,... - 'DefaultUicontrolFontName',PF.helvetica,... - 'DefaultUicontrolFontSize',FS(text_sz),... - 'DefaultUicontrolInterruptible','on',... - 'Colormap',gray(64),... - 'Renderer','painters',... - 'Visible','on'); - -% OK -hDone = uicontrol(F,... - 'Style','Pushbutton','String','OK',... - 'ToolTipString','OK - press after selecting events to include',... - 'ForegroundColor','k',... - 'Tag','ui_et_done', ... - 'Callback',[cb 'ui_et_edit_cb(ete_D, ''OK'')'] ,... - 'Interruptible','off','BusyAction','Cancel',... - 'Position',[button_x buttons_y(1) button_sz].*WS); - -% Cancel -uicontrol(F,... - 'Style','Pushbutton','String','Cancel',... - 'ToolTipString','Cancel UI and return without changing event type',... - 'ForegroundColor','k',... - 'Tag','ui_et_cancel',... - 'Callback',[cb 'ui_et_edit_cb(ete_D, ''Cancel'')'] ,... - 'Interruptible','off','BusyAction','Cancel',... - 'Position',[button_x buttons_y(2) button_sz].*WS); - -% Add -uicontrol(F,... - 'Style','Pushbutton','String','Add',... - 'ToolTipString','Add events to event type',... - 'ForegroundColor','k',... - 'Tag','ui_et_add',... - 'Callback',[cb 'ui_et_edit_cb(ete_D, ''Add'')'] ,... - 'Interruptible','off','BusyAction','Cancel',... - 'Position',[button_x buttons_y(4) button_sz].*WS); - -% Remove -uicontrol(F,... - 'Style','Pushbutton','String','Remove',... - 'ToolTipString','Remove events to event type',... - 'ForegroundColor','k',... - 'Tag','ui_et_remove',... - 'Callback',[cb 'ui_et_edit_cb(ete_D, ''Remove'')'] ,... - 'Interruptible','off','BusyAction','Cancel',... - 'Position',[button_x buttons_y(8) button_sz].*WS); - -% Sort box -uicontrol(F,... - 'Style','PopUp', ... - 'String',strvcat('Session no', 'Event no', 'Event name'),... - 'ToolTipString','Sort events by...',... - 'ForegroundColor','k',... - 'Tag','ui_et_sort',... - 'Callback',[cb 'ui_et_edit_cb(ete_D, ''Sort'')'] ,... - 'Interruptible','off','BusyAction','Cancel',... - 'Position',[button_x sort_box_y button_sz].*WS); - -% Sort box label -uicontrol(F,'Style','Text',... - 'String','Sort by...',... - 'FontWeight','Bold',... - 'ForegroundColor','k',... - 'HorizontalAlignment','Center',... - 'Position',[button_x sort_label_y button_sz_x label_sz_y].*WS); - -% Name box -hName = uicontrol(F,'Style','Edit','Tag','ui_et_name',... - 'ToolTipString','enter name for event type',... - 'String', my_event.name,... - 'UserData', my_event.name,... % to check for change - 'HorizontalAlignment','Left',... - 'Interruptible','off',... - 'BackgroundColor','w',... - 'Position',[border_x name_box_y list_sz_x ... - text_box_sz].*WS); - -% Name box label -uicontrol(F,'Style','Text',... - 'String','Event type name',... - 'FontWeight','Bold',... - 'ForegroundColor','k',... - 'HorizontalAlignment','Left',... - 'Position',[border_x name_label_y list_sz_x label_sz_y].*WS); - -% IN list -hListIN = uicontrol(F,'Style','ListBox','Tag','ui_et_IN',... - 'ToolTipString',['Select events(s) - drag/shift-click',... - '/ctrl-click to select multiple events'],... - 'UserData', IN_evs,... - 'String', IN_evs.names,... - 'Max',2,... - 'CallBack', '' ,... - 'Interruptible','off','BusyAction','Queue',... - 'BackgroundColor','w',... - 'Position',[border_x IN_list_y list_sz].*WS); - -% IN label -uicontrol(F,'Style','Text',... - 'String','Events IN event type',... - 'FontWeight','Bold',... - 'ForegroundColor','k',... - 'HorizontalAlignment','Left',... - 'Position',[border_x IN_label_y list_sz_x label_sz_y].*WS); - -% Events that are OUT list -uicontrol(F,'Style','ListBox','Tag','ui_et_OUT',... - 'ToolTipString',['Select events(s) - drag/shift-click',... - '/ctrl-click to select multiple events'],... - 'UserData', OUT_evs,... - 'String', OUT_evs.names,... - 'Max',2,... - 'CallBack', '' ,... - 'Interruptible','off','BusyAction','Queue',... - 'BackgroundColor','w',... - 'Position',[border_x OUT_list_y, list_sz].*WS); - -% OUT label -uicontrol(F,'Style','Text',... - 'String','Events NOT IN event type',... - 'FontWeight','Bold',... - 'ForegroundColor','k',... - 'HorizontalAlignment','Left',... - 'Position',[border_x OUT_label_y list_sz_x label_sz_y].*WS); - -return diff --git a/lib/marsbar-0.44/@mardo/ui_et_edit_cb.m b/lib/marsbar-0.44/@mardo/ui_et_edit_cb.m deleted file mode 100644 index 0de3f95..0000000 --- a/lib/marsbar-0.44/@mardo/ui_et_edit_cb.m +++ /dev/null @@ -1,79 +0,0 @@ -function varargout = ui_et_edit_cb(D, action, varargin) -% method to handle callbacks from ui_et_edit -% FORMAT varargout = ui_et_edit_cb(D, action, varargin) -% -% $Id$ - -if nargin < 2 - error('Need action'); -end - -F = gcbf; -action = lower(action); -switch action - case 'ok' - % Deblank name, and check name is not empty - hName = findobj(F, 'Tag', 'ui_et_name'); - new_name = get(hName, 'String'); - old_name = get(hName, 'UserData'); - new_name = deblank(fliplr(deblank(fliplr(new_name)))); - if isempty(new_name) | strcmp(new_name, 'New event') - msgbox('Need a name for this event type'); return - end - % Check if name has been changed - if ~strcmp(new_name, old_name) - % Check name has not been used - ets = event_types(D); - if ~isempty(ets) - if ismember(new_name, {ets(:).name}) - msgbox(['Event type ' new_name ' already exists']); return - end - end - end - % Check events not empty - if isempty(get(findobj(F, 'Tag', 'ui_et_IN'), 'String')) - msgbox('Need events for this event type'); return - end - % Put (deblanked) string back, and set Done flag - set(hName, 'String', new_name); - set(findobj(F,'Tag','ui_et_done'),'UserData',1); - case 'cancel' - set(findobj(F,'Tag','ui_et_done'),'UserData',0); - case {'add', 'remove'} - switch action - case 'add' - hListTO = findobj(F, 'Tag', 'ui_et_IN'); - hListFROM = findobj(F, 'Tag', 'ui_et_OUT'); - case 'remove' - hListFROM = findobj(F, 'Tag', 'ui_et_IN'); - hListTO = findobj(F, 'Tag', 'ui_et_OUT'); - end - TO_evs = get(hListTO, 'UserData'); - FROM_evs = get(hListFROM, 'UserData'); - if isempty(FROM_evs), msgbox(['No events to ' action]); end - es_to_add = get(hListFROM, 'Value'); - if isempty(es_to_add) - msgbox(['Please select events to ' action]); return - end - TO_evs.names = [TO_evs.names; FROM_evs.names(es_to_add)]; - FROM_evs.names(es_to_add) = []; - TO_evs.e_spec = [TO_evs.e_spec FROM_evs.e_spec(:, es_to_add)]; - FROM_evs.e_spec(:, es_to_add) = []; - set(hListTO, 'UserData', TO_evs); - set(hListFROM, 'UserData', FROM_evs); - set(hListFROM, 'Value', []); - ui_et_edit_cb(D, 'sort'); - case 'sort' - sort_obj = findobj(F, 'Tag', 'ui_et_sort'); - sort_strs = cellstr(get(sort_obj, 'String')); - sort_type = sort_strs{get(sort_obj, 'Value')}; - for H = [findobj(F, 'Tag', 'ui_et_IN') findobj(F, 'Tag', 'ui_et_OUT')] - evs = pr_sort_evs(get(H, 'UserData'), sort_type); - set(H, 'String', evs.names); - set(H, 'UserData', evs); - end - otherwise - error([ action ' is deviant' ]); -end - -return diff --git a/lib/marsbar-0.44/@mardo/ui_event_types.m b/lib/marsbar-0.44/@mardo/ui_event_types.m deleted file mode 100644 index 71adfb9..0000000 --- a/lib/marsbar-0.44/@mardo/ui_event_types.m +++ /dev/null @@ -1,174 +0,0 @@ -function [D, ic, status] = ui_event_types(D) -% ui method for selection / editing of event types -% FORMAT [D, ic, status] = ui_event_types(D) -% -% Input -% D - design object -% -% Returns -% D - possibly modified design object -% ic - indices of selected event types (empty for none) -% status - 0 for Cancel or window quit -% 1 for OK, but no edits to event types -% 2 for OK, with edits to event types -% -% The routine sets up the event type window, and waits until that window -% is done, then returns with the modified values. -% -% $Id$ - -% Put up window and initialize callbacks -[F hDone hList hEdit] = sf_start_window(D); - -% Wait for OK, Cancel, figure cleared. -waitfor(hDone,'UserData') - -% Get what was pressed, assume cancel if window has died -ic = []; -if ~ishandle(hDone) - status = 0; -else - status = get(hDone, 'UserData'); - if status - % Edit control contains info as to whether edits done - status = status + get(hEdit, 'UserData'); - D = get(F, 'UserData'); - if ~isempty(event_types(D)) - ic = get(hList, 'Value'); - end - end - close(F); -end - -return - -function [F, hDone, hList, hEdit] = sf_start_window(D) -% Put up window and set up callbacks - -% Window tag -w_tag = 'ui_event_types'; - -% Close any event_types windows currently open -close(findobj('Tag', w_tag)) - -%-Generic CallBack code to get embedded object -cb = ['et_D = get(findobj(''Tag'', ''' w_tag '''),''UserData''); ']; - -%-Create window, compute scaling for screen size -%----------------------------------------------------------------------- -WS = spm('WinScale'); %-Window scaling factors -FS = spm('FontSizes'); %-Scaled font sizes -PF = spm_platform('fonts'); %-Font names (for this platform) -S0 = get(0,'ScreenSize'); %-Screen size - -% Window size, button size, position, in WS units -win_sz = [400 300]; -ratio_dor = (1 + sqrt(5))/2; - -% Button sizes and positions -n_buttons = 5; -button_sz_x = 75; -button_border = [12 12]; -button_sz = [button_sz_x button_sz_x / ratio_dor]; -button_x = win_sz(1) - button_sz(1) - button_border(1); -l_b = button_border(2); -h_b = win_sz(2) - button_border(2) - button_sz(2); -gap_b = (h_b - l_b) / (n_buttons-1); -buttons_y = l_b:gap_b:h_b; - -% Event list size, position -elist_border = button_border; -elist_pos = elist_border; -elist_sz(1) = button_x - elist_border(1)*2; -elist_sz(2) = win_sz(2) - elist_border(2)*2; - -F = figure('IntegerHandle','off',... - 'Tag', w_tag,... - 'UserData', D, ... - 'Name','Event type', ... - 'NumberTitle','off',... - 'Position',[S0(3)/2,S0(4)/2,0,0] + [-250,-200, win_sz].*WS,... - 'Resize','off',... - 'Color',[1 1 1]*.7,... - 'MenuBar','none',... - 'DefaultTextColor','k',... - 'DefaultTextFontName',PF.helvetica,... - 'DefaultTextFontSize',FS(10),... - 'DefaultAxesFontName',PF.helvetica,... - 'DefaultUicontrolBackgroundColor',[1 1 1]*.7,... - 'DefaultUicontrolFontName',PF.helvetica,... - 'DefaultUicontrolFontSize',FS(10),... - 'DefaultUicontrolInterruptible','on',... - 'Colormap',gray(64),... - 'Renderer','painters',... - 'Visible','on'); - -% OK -hDone = uicontrol(F,... - 'Style','Pushbutton','String','OK',... - 'ToolTipString','OK - press after selecting selected events types',... - 'ForegroundColor','k',... - 'Tag','Done','UserData',-1,... - 'Callback',[cb 'ui_event_types_cb(et_D, ''OK'')'] ,... - 'Interruptible','off','BusyAction','Cancel',... - 'Position',[button_x buttons_y(1) button_sz].*WS); - -% Cancel -uicontrol(F,... - 'Style','Pushbutton','String','Cancel',... - 'ToolTipString','Cancel UI and return without changes',... - 'ForegroundColor','k',... - 'Tag','Cancel','UserData',-1,... - 'Callback',[cb 'ui_event_types_cb(et_D, ''Cancel'')'] ,... - 'Interruptible','off','BusyAction','Cancel',... - 'Position',[button_x buttons_y(2) button_sz].*WS); - -% Delete -uicontrol(F,... - 'Style','Pushbutton','String','Delete',... - 'ToolTipString','Delete - press after selecting events type(s)',... - 'ForegroundColor','k',... - 'Tag','Delete','UserData',-1,... - 'Callback',[cb 'ui_event_types_cb(et_D, ''Delete'')'] ,... - 'Interruptible','off','BusyAction','Cancel',... - 'Position',[button_x buttons_y(3) button_sz].*WS); - -% Edit -hEdit = uicontrol(F,... - 'Style','Pushbutton','String','Edit',... - 'ToolTipString','Edit - press after selecting an event type',... - 'ForegroundColor','k',... - 'Tag','eEdit','UserData',0,... - 'Callback',[cb 'ui_event_types_cb(et_D, ''Edit'')'] ,... - 'Interruptible','off','BusyAction','Cancel',... - 'Position',[button_x buttons_y(4) button_sz].*WS); - -% New -uicontrol(F,... - 'Style','Pushbutton','String','New',... - 'ToolTipString','New - create new event type',... - 'ForegroundColor','k',... - 'Tag','New','UserData',-1,... - 'Callback',[cb 'ui_event_types_cb(et_D, ''New'')'] ,... - 'Interruptible','off','BusyAction','Cancel',... - 'Position',[button_x buttons_y(5) button_sz].*WS); - -% Event type list -et = event_types(D); -if isfield(et, 'name') - eNames = {et(:).name}; -else - eNames = {}; -end - -hList = uicontrol(F,'Style','ListBox','Tag','eList',... - 'ToolTipString',['Select events(s) - drag/shift-click',... - '/ctrl-click to select multiple events'],... - 'String',eNames,... - 'Max',2,... - 'CallBack', '' ,... - 'Interruptible','off','BusyAction','Queue',... - 'BackgroundColor','w',... - 'Position',[elist_pos elist_sz].*WS); - -return diff --git a/lib/marsbar-0.44/@mardo/ui_event_types_cb.m b/lib/marsbar-0.44/@mardo/ui_event_types_cb.m deleted file mode 100644 index eb481e8..0000000 --- a/lib/marsbar-0.44/@mardo/ui_event_types_cb.m +++ /dev/null @@ -1,55 +0,0 @@ -function varargout = ui_event_types_cb(D, action, varargin) -% method to handle callbacks from ui_event_types -% FORMAT varargout = ui_event_types_cb(D, action, varargin) -% -% $Id$ - -if nargin < 2 - error('Need action'); -end - -et = event_types(D); -F = gcbf; - -switch lower(action) - case 'ok' - set(findobj(F,'Tag','Done'),'UserData',1) - case 'cancel' - set(findobj(F,'Tag','Done'),'UserData',0) - case 'new' - e = struct('name', 'New event', 'e_spec', []); - if isempty(et), et = e; else et = [et e]; end - D = event_types(D, et); - [D ic] = ui_et_edit(D, length(et)); - if ~isempty(ic) % not cancelled - pr_refresh_et(D, ic, F); - end - case 'edit' - hList = findobj(F,'Tag','eList'); - ic = get(hList, 'Value'); - if isempty(ic) - msgbox('Please select an event type to edit'); - elseif length(ic) > 1 - msgbox('Please select a single event type to edit'); - else - et = event_types(D); - [D ic] = ui_et_edit(D, ic); - if ~isempty(ic) % not cancelled - pr_refresh_et(D, ic, F, hList); - end - end - case 'delete' - hList = findobj(F,'Tag','eList'); - ic = get(hList, 'Value'); - if isempty(ic) - msgbox('Please select event type(s) to delete'); - else - et(ic) = []; - D = event_types(D, et); - pr_refresh_et(D, 1, F, hList); - end - otherwise - error([ action ' is deviant' ]); -end - -return diff --git a/lib/marsbar-0.44/@mardo/ui_ft_design_data.m b/lib/marsbar-0.44/@mardo/ui_ft_design_data.m deleted file mode 100644 index ad70691..0000000 --- a/lib/marsbar-0.44/@mardo/ui_ft_design_data.m +++ /dev/null @@ -1,99 +0,0 @@ -function ui_ft_design_data(D, mY, e_s, opts) -% method plots FT of design and data to graphics window -% FORMAT ui_ft_design_data(D, mY, e_s, opts) -% -% Inputs -% D - design object -% mY - marsy data object -% e_s - event specification (session no, event no) -% opts - struct containing optional fields -% 'event_name' - name for the event -% 'filter' - apply design filter -% 'fig' - figure handle to plot to -% -% $Id$ - -if ~is_fmri(D) - disp('Need an FMRI design for design/data plot'); - return -end -if nargin < 2 - error('Need data to plot against'); -end -mY = marsy(mY); -if n_time_points(mY) ~= n_time_points(D) - error('Design and data have different number of rows'); -end - -if nargin < 3, e_s = []; end -if nargin < 4, opts = []; end - -e_n = 'Event'; -if isempty(e_s) - % Setup input window - [Finter,Fgraph,CmdLine] = spm('FnUIsetup','Design filter', 1); - [e_s e_n] = ui_get_event(D); -end -if isfield(opts, 'fig') - Fgraph = opts.fig; -else - Fgraph = spm_figure('GetWin'); -end -e_n_tmp = mars_struct('getifthere', opts, 'event_name'); -if ~isempty(e_n_tmp) - e_n = e_n_tmp; -end - -s = e_s(1); -e = e_s(2); - -% Get the regressors and data -X = design_matrix(D); -R = X(:, event_cols(D,e_s)); -Y = summary_data(mY); -r = block_rows(D); -r = r{s}; -R = R(r,:); -Y = Y(r,:); - -% Filter data if requested -if isfield(opts, 'filter') - R = apply_filter(D, R, struct('sessions', s)); - Y = apply_filter(D, Y, struct('sessions', s)); -end - -TR = tr(D); -if isempty(TR) - b_len = 1; - b_str = 'cycles per time point'; -else - b_len = TR; - b_str = 'Hz'; -end -q = length(r); -Hz = [0:(q - 1)]/(q * b_len); -q = 2:fix(q/2); -Hz = Hz(q); - -figure(Fgraph) -subplot(2,1,1); -gX = abs(fft(R)).^2; -gX = gX*diag(1./sum(gX)); -gX = gX(q,:); -plot(Hz, gX); -xlabel(sprintf('Frequency (%s)', b_str)) -ylabel('Relative spectral density') -t_str = sprintf('Regressors for %s: block %d', e_n, e_s(1)); -title(t_str, 'interpreter', 'none'); -axis tight - -subplot(2,1,2); -gX = abs(fft(spm_detrend(Y))).^2; -gX = gX*diag(1./sum(gX)); -gX = gX(q,:); -plot(Hz, gX); -xlabel(sprintf('Frequency (%s)', b_str)) -ylabel('Relative spectral density') -title('Region data'); -legend(region_name(mY)); -axis tight diff --git a/lib/marsbar-0.44/@mardo/ui_get_contrasts.m b/lib/marsbar-0.44/@mardo/ui_get_contrasts.m deleted file mode 100644 index ba58b60..0000000 --- a/lib/marsbar-0.44/@mardo/ui_get_contrasts.m +++ /dev/null @@ -1,1526 +0,0 @@ -function varargout=ui_get_contrasts(D, varargin) -% SPM contrast UI, wrapped for MarsBaR -% -%======================================================================= -% - FORMAT specifications -%======================================================================= -%( This is a multi function function: If the first argument is a string,) -%( then this is the action string, specifying the particular action ) -%( function to take. ) -% -% FORMAT [I,D,changef] = ui_get_contrasts(D,STATmode,n,Prompt,Mcstr,OK2chg) -% -% Takes design, offers contrast GUI, returns possibly modified design -% Fields used in design are: -% xX - Design Matrix structure -% - (see spm_spm.m for structure) -% - fields used directly are: -% .xKXs - space structure of smoothed design matrix -% .name|xNames - cellstr of parameter names -% -% xCon - Contrast definitions structure array -% (see spm_FcUtil.m for structure, rules & handling) -% - defaults to empty contrast structure -% - fields used directly are: -% .name - contrast name string -% .STAT - character describing statistic required: 'T' or 'F' -% .c - contrast weights (column) vector / matrix -% -% STATmode - string indicating STAT modes to allow contrast -% selection/definition for: -% - 'T' to limit to (1-dimensional) contrasts defined for SPM{t} -% - 'F' to limit to contrasts defined for SPM{F} -% - 'T|F' to allow either contrasts for SPM{t} or SPM{F} -% (both may be defined, but only one type may be selected) -% - 'T&F' to allow both contrasts for SPM{t} and SPM{F} -% - defaults to 'T|F' -% -% n - Number of contrasts to select, Inf for unlimited -% -% Prompt - Prompt string -% -% Mcstr - string to describe multiple contrast selection -% E.g. ' for conjunction' will result in the status message -% reading 'Selected 2 contrasts for conjunction' when -% two contrasts are selected. -% -% OK2chg - logical, specifying whether the contrast structure can be -% changed. If false, then new contrasts cannot be defined, and -% existing contrasts cannot be renamed. -% -% I - Index (or indices) of contrasts selected -% -% D (out) - Design with modified contrast definitions structure array -% changef - flag set to 1 if contrast definitions have changed -% -% ---------------- -% -% [F,cF] = ui_get_contrasts(D, 'Initialise',... -% Vis,STATmode,n,Prompt,Mcstr,OK2chg) -% Initialise mConMan GUI for contrast selection/definition -% Vis - Initialisation action: -% 'close' - closes mConMan window -% 'off' - hides mConMan window -% 'reset' - hides and resets mConMan window -% 'on' - initialises mConMan window using arguments given -% STATmode - string indicating STAT modes to allow contrast -% n - number of contrasts to select, Inf for unlimited -% Prompt - Prompt string -% Mcstr - string to describe multiple contrast selection -% OK2chg - logical, specifying whether contrast structure can be changed -% F - figure used for contrast manager window -% cF - Figure which was current before function call -% -% FORMAT ui_get_contrasts(D, 'ListCon',hConList,STAT,I) -% Utility function to list contrasts in ListBox -% hConList - handle of GUI ListBox object -% STAT - STAT character: 'T' or 'F' or empty (show all) -% I - indices of currently selected contrasts -% -% FORMAT ui_get_contrasts(D, 'GraphCons',xCon,I,F) -% Utility function to display contrast image/bar-graph & setup "surfing" -% xCon - contrast definitions structure array -% I - indicies of contrasts to display -% F - handle of 'mConMan' figure -% -% FORMAT ui_get_contrasts(D, 'StatusLine',F,str,col) -% Utility function to update mConMan window statusline -% F - handle of 'mConMan' figure -% str - string to display -% (defaults to status of contrast selection) -% col - colour to use [defaults to 'w' - white -% -% FORMAT ui_get_contrasts(D, 'Done_CB') -% CallBack for "Done" button on mConMan contrast selection interface -% -% FORMAT ui_get_contrasts(D, 'ConList_CB') -% CallBack for contrast selection ListBox -% -% FORMAT STAT = ui_get_contrasts(D, 'TFA') -% CallBack for 'T','F' or 'any' STAT selection RadioButtons -% FORMAT STAT = ui_get_contrasts(D, 'TFA',F,STAT) -% Initialisation of 'T','F' or 'any' STAT selection RadioButtons -% FORMAT STAT = ui_get_contrasts(D, 'TFA',F,STAT,STATmode) -% Function to set STAT & STATmode -% Initialisation of 'T','F' or 'any' STAT selection RadioButtons & STATmode -% F - handle of 'mConMan' figure -% STAT - STAT character: 'T' or 'F' of empty (all) -% STATmode - string indicating STAT modes to allow contrast -% -% FORMAT ui_get_contrasts(D, 'FConMenu_CB') -% CallBack to set state of mConMan contrast selection figure context menu -% -% FORMAT ui_get_contrasts(D, 'Rename_CB') -% CallBack to handle contrast renaming -% -% FORMAT [c,I,emsg,imsg,msg] = ui_get_contrasts(D, 'ParseCon',cstr,X,STAT) -% Contrast weights parser: Catch evaluation errors and invalid contrasts -% cstr - string (or cellstr) to evaluate to get contrast(s) -% X - design matrix -% STAT - 'T' or 'F' (for contrast checking) -% c - contrast weights matrix -% I - logical validity indicator: indicates which rows of -% cellstr(cstr) generated valid contrasts which were -% included in c -% emsg - cellstr of error messages produced during parsing -% imsg - cellstr of information messages for valid contrasts -% msg - cellstr of all messages produced during parsing, -% one cell per string in cstr -% -% FORMAT [iX0,I,emsg,imsg] = ui_get_contrasts(D, 'ParseIStr',str,max) -% DesMtx column index parser: Catch eval errors and invalid indices -% str - string for evaluation to get column indices -% max - number of columns in design matrix -% iX0 - vector of column indices: '!' if evaluation error -% I - 0 if evaluation error, 1 if evaluated OK -% emsg - error message -% (evaluation errors, non-integer indices, out of range indices) -% imsg - information message (valid indices) -% -% FORMAT ui_get_contrasts(D, 'Reset_CB') -% CallBack handler for "reset" button on contrast selection interface -% -% FORMAT ui_get_contrasts(D, 'D_Setup_CB') -% CallBack handler for "Define new" button: -% Initialises Contrast Definition interface for use -% -% FORMAT ui_get_contrasts(D, 'D_ConMtx_CB') -% CallBack handler for contrast weights definition widget -% FORMAT ui_get_contrasts(D, 'D_X1cols_CB') -% Callback handler for F-contrast "columns for reduced design" widget -% -% FORMAT ui_get_contrasts(D, 'D_Reset_CB') -% CallBack handler for "reset" button on contrast definition interface -% -% FORMAT ui_get_contrasts(D, 'D_Cancel_CB') -% CallBack handler for "cancel" button on contrast definition interface -% -% FORMAT ui_get_contrasts(D, 'D_OK_CB') -% CallBack handler for "OK" button on contrast definiton interface -% -% FORMAT ui_get_contrasts(D, 'D_Status',F) -% Set status line of contrast definition interface -% F - Handle of mConMan figure [defaults gcbf] -% -% FORMAT [F,H] = ui_get_contrasts(D, 'CreateFig') -% Creates mConMan dialog figure (definition interface initially hidden) -% F - Handle of mConMan figure created -% H - Stricture of Handles: -% .hConList - handle of contrast selection ListBox -% .hDesMtxAx - handle of axes for design matrix imaging -% .hPrompt - handle of prompt text object -% .hSTATmode - handle of frame containing "T/F/All" radio buttons -% .hStatLin - handle of status line text object (in selection interface) -% .hNew - handle of "Define new contrast" pushbutton -%_______________________________________________________________________ -% -% -% MarsBaR edits -% ------------- -% The contrasts are stored in a stripped down mardo design structure, to -% allow this function to be called using object methods. We need to return -% a flag (changef) to tell us if the contrasts have been changed by the GUI. -% This is stored in the D_Reset tagged handle (which is attached to the -% reset button). -% -% Edited from @(#)spm_conman.m 2.18 Andrew Holmes 02/09/10 -% -% $Id$ - -% simplify access to design -xCon = get_contrasts(D); - -%-Parameters -%======================================================================= -COLOUR = [.8,.8,1]; %-Question background colour -PJump = 1; %-Jumping of pointer to mConMan window - - -if (nargin<2) | ismember(varargin{1}, {'T', 'F', 'T|F', 'T&F'}) -%======================================================================= -% [I,D,changef] = ui_get_contrasts(D,STATmode,n,Prompt,Mcstr,OK2chg) - -%-Condition arguments -%----------------------------------------------------------------------- -if nargin<6, OK2chg = 0; else, OK2chg=varargin{5}; end -if nargin<5, Mcstr = ''; else, Mcstr=varargin{4}; end -if nargin<4, Prompt='Select contrast(s)...'; else, Prompt=varargin{3}; end -if nargin<3, n=1; else, n=varargin{2}; end -if nargin<2, STATmode='T|F'; else, STATmode=varargin{1}; end - -%----------------------------------------------------------------------- - -%-Setup mConMan window & jump cursor -[F,cF] = ui_get_contrasts(D, 'Initialise','on',STATmode,n,Prompt,Mcstr,OK2chg); -if PJump - PLoc = get(0,'PointerLocation'); - FRec = get(F,'Position'); - set(0,'PointerLocation',[FRec(1)+FRec(3)/2, FRec(2)+FRec(2)/2]) -end - -%-Wait until filenames have been selected -hDone = findobj(F,'Tag','Done'); -waitfor(hDone,'UserData') - -%-Exit with error if mConManWin deleted -if ~ishandle(hDone), error('Contrast Manager was quit!'), end - -%-Get xCon, I & exit status -status = get(hDone,'UserData'); -hConList = findobj(F,'Tag','ConList'); -Q = get(hConList,'UserData'); -I = Q(get(hConList,'Value')); -changef = get(findobj(F,'Tag','D_Reset'), 'UserData'); - -% Set new contrasts, if modified -if changef - D = set_contrasts(D, get_contrasts(get(F,'UserData')), 0); -end - -%-Reset and hide SelFileWin -ui_get_contrasts(D, 'Initialise','off'); - -%-Return focus to previous figure (if any) -set(0,'CurrentFigure',cF) - -%-Jump cursor back to previous location -if PJump, set(0,'PointerLocation',PLoc), end - -%-Exit with error if reset (status=-1) -if status == -1, error(['reset: ',mfilename,' bailing out!']), end - -%-Output arguments -varargout={I,D,changef}; - -return -end - -%======================================================================= -% - Callbacks & Utility embedded functions -%======================================================================= - -%======================================================================= -switch lower(varargin{1}), case 'initialise' -%======================================================================= -% [F,cF] = ui_get_contrasts(D,'Initialise',Vis,STATmode,n,Prompt,Mcstr,OK2chg) - -if nargin<2, Vis='on'; else, Vis=varargin{2}; end - -%-Recover mConMan figure number (if it exists) -F = findobj(get(0,'Children'),'Flat','Tag','mConMan'); - -cF = get(0,'CurrentFigure'); %-Save current figure - -switch lower(Vis), case 'close' - close(F) - varargout = {[],cF}; - return -case {'off','reset'} - varargout = {F,cF}; %-Return figure handles - if isempty(F), return, end %-Return if no mConMan win - set(F,'Visible','off') %-Make window Invisible - if strcmp(lower(Vis),'reset') - set(findobj(F,'Tag','Done'),'UserData',-1) - end - return -case 'on' - %-Sort out arguments - %--------------------------------------------------------------- - if nargin<8, OK2chg = 0; else, OK2chg=varargin{7}; end - if nargin<7, Mcstr = ''; else, Mcstr=varargin{6}; end - Mcstr = cellstr(Mcstr); if length(Mcstr)<2, Mcstr{2}=''; end - if nargin<6, Prompt='Select contrast(s)'; else, Prompt=varargin{5}; end - if nargin<5, n=Inf; else, n=varargin{4}; end - if nargin<4, STATmode='T&F'; else, STATmode=varargin{3}; end - - %-Create/find mConMan window - %--------------------------------------------------------------- - if isempty(F) %-Create mConMan win - [F,H] = ui_get_contrasts(D, 'CreateFig'); - else %-Get handles - H.hDesMtxAx = findobj(F,'Tag','DesMtxAx'); - H.hParEstAx = findobj(F,'Tag','ParEstAx'); - H.hConList = findobj(F,'Tag','ConList'); - H.hPrompt = findobj(F,'Tag','Prompt'); - H.hTFAf = findobj(F,'Tag','TFAf'); - H.hSTATmode = findobj(F,'Tag','STATmode'); - H.hStatLin = findobj(F,'Tag','StatusLine'); - H.hNew = findobj(F,'Tag','New'); - end - varargout = {F,cF}; %-Return figure handles - - %-Set up xX for display etc - %--------------------------------------------------------------- - SPM = des_struct(D); - xX = SPM.xX; - - %-Store required parameters in UserData of various objects - %--------------------------------------------------------------- - tmpD = des_struct(D, struct('xCon', xCon)); - sf_SetD(tmpD, 0, F); - set(H.hStatLin, 'UserData', Mcstr) %-** - - - % A little hack to make designs compatible between SPM 99 and 2 - if isfield(xX, 'Xnames'), xX.name = xX.Xnames; end - - %-Initialise interface - %--------------------------------------------------------------- - set(findobj(F,'Tag','Done'),'UserData',0) %-Init. Done UserData - STAT = ui_get_contrasts(D, 'TFA',F,'',STATmode);%-Init. TFA buttons - set(H.hPrompt,'String',Prompt,'UserData',n) %-Set prompt - sf_ImDesMtx(xX, H.hDesMtxAx) %-Depict DesMtx - sf_ImParEst(xX, H.hParEstAx) %-Parameter estimability - ui_get_contrasts(D, 'ListCon',H.hConList,STAT,[]) %-List contrasts - if OK2chg, tmp='on'; else, tmp='off'; end %-OK to change xCon? - set(H.hNew,'Enable',tmp) %-En/dis-able change UI -%-**** if isempty(xCon), ui_get_contrasts(D); end %-Go straight to DNewUI - - %-Popup figure, retaining CurrentFigure - %--------------------------------------------------------------- - set(get(findobj(F,'Tag','DefineNew'),'UserData'),'Visible','off') - %-Hide define UI - figure(F) %-PopUp figure - set(0,'CurrentFigure',cF) %-Return to prev. figure - return - -otherwise - error('Unrecognised ''Vis'' option') -end - - -%======================================================================= -case 'listcon' -%======================================================================= -% ui_get_contrasts(D,'ListCon',hConList,STAT,I) - -hConList = varargin{2}; -STAT = varargin{3}; -if nargin<5 - Q = get(hConList,'UserData'); - I = Q(get(hConList,'Value')); -else - I = varargin{4}; -end - -%-Sort out list, filtering by STAT, and display -%----------------------------------------------------------------------- -if isempty(xCon) - Q = []; -elseif isempty(STAT) - Q = 1:length(xCon); -else - Q = find(strcmp({xCon(:).STAT},STAT)); -end - -q = find(ismember(Q,I)); - -if ~isempty(Q) - str = cell(0); - for i=1:length(Q) - str{i} = sprintf('%03d {%c} : %s',... - Q(i),xCon(Q(i)).STAT,xCon(Q(i)).name); - end - FontAngle = 'Normal'; - FontWeight = 'Normal'; - Enable = 'on'; -else - str = ['no',deblank([' ',STAT]),' contrasts defined']; - FontAngle = 'Italic'; - FontWeight = 'Bold'; - Enable = 'off'; -end - -set(hConList,'String',str,... - 'UserData',Q,... - 'Value',q,... - 'FontAngle',FontAngle,'FontWeight',FontWeight,... - 'Enable',Enable) - -ui_get_contrasts(D, 'GraphCons',xCon,Q(q),get(hConList,'Parent')) -ui_get_contrasts(D, 'StatusLine',get(hConList,'Parent')) - - -%======================================================================= -case 'graphcons' -%======================================================================= -% ui_get_contrasts(D, 'GraphCons',xCon,I,F) - -if nargin>2, xCon=varargin{2}; end -if nargin<4, I=[1:length(xCon)]; else, I=varargin{3}; end -if nargin<5, F=[]; else, F=varargin{4}; end -if isempty(F), F=spm_figure('FindWin','mConMan'); end -if isempty(F), error('can''t find mConMan win'), end - -cF = get(0,'CurrentFigure'); %-Save current figure -set(0,'CurrentFigure',F); %-Make F current - -delete(findobj(F,'Tag','ConGrphAx')); - - -%-Display contrasts -%----------------------------------------------------------------------- -if isempty(I) - axes('Position',[0.65 (0.7 + .1*(1-0.9)) 0.3 .1*.9],... - 'Tag','ConGrphAx','Visible','off') - text(0.5,0.5,'no contrast(s)',... - 'FontSize',spm('FontSize',8),... - 'FontAngle','Italic',... - 'HorizontalAlignment','Center',... - 'VerticalAlignment','Middle') - -else - - nPar = size(xCon(1).c,1); - xx = [repmat([0:nPar-1],2,1);repmat([1:nPar],2,1)]; - nCon = length(I); - dy = 0.2/max(nCon,2); - hConAx = axes('Position',[0.65 (0.70 + dy*.1) 0.30 dy*(nCon-.1)],... - 'Tag','ConGrphAx','Visible','off'); - title('contrast(s)') - htxt = get(hConAx,'title'); set(htxt,'Visible','on') - - for ii = nCon:-1:1 - i = abs(I(ii)); - axes('Position',[0.65 (0.7 + dy*(nCon-ii+.1)) 0.3 dy*.9]) - if xCon(i).STAT == 'T' & size(xCon(i).c,2)==1 - %-Single vector contrast for SPM{t} - bar - yy = [zeros(1,nPar);repmat(xCon(i).c',2,1);zeros(1,nPar)]; - h = patch(xx,yy,[1,1,1]*.5); - set(gca,'Tag','ConGrphAx',... - 'Box','off','TickDir','out',... - 'XTick',[],... - 'XLim', [0,nPar],... - 'YTick',[-1,0,+1],'YTickLabel','',... - 'YLim', [min(xCon(i).c),max(xCon(i).c)] + ... - [-1 +1] * max(abs(xCon(i).c))/10 ) - else - %-F-contrast - image - h = image((xCon(i).c'/max(abs(xCon(i).c(:)))+1)*32); - set(gca,'Tag','ConGrphAx',... - 'Box','on','TickDir','out',... - 'XTick',[],... - 'XLim', [0,nPar]+0.5,... - 'YTick',[0:size(xCon(i).c,2)]+0.5,'YTickLabel','',... - 'YLim', [0,size(xCon(i).c,2)]+0.5 ) - end - if I(ii)>0, ylabel(num2str(i)), end - set(h,'ButtonDownFcn','spm_DesRep(''SurfCon_CB'')',... - 'UserData', struct( 'i', I(ii),... - 'h', htxt,... - 'xCon', xCon(i))) - end -end - -set(0,'CurrentFigure',cF) %-Reset CurrentFigure to previous figure - - -%======================================================================= -case 'statusline' -%======================================================================= -% ui_get_contrasts(D, 'StatusLine',F,str,col) - -if nargin<3, F = findobj(get(0,'Children'),'Flat','Tag','mConMan'); - else, F = varargin{2}; end - -if nargin<4 - n = get(findobj(F,'Tag','Prompt'),'UserData'); - m = length(get(findobj(F,'Tag','ConList'),'Value')); - - str = sprintf('Selected %d contrast',m); - if m~=1, str=[str,'s']; end - - Mcstr = get(findobj(F,'Tag','StatusLine'),'UserData'); - if m>1, str=[str,Mcstr{1}]; else, str=[str,Mcstr{2}]; end - - if m==0 - if n<0 - str = [str,', press "Done" when finished.']; - else - str = [str,'.']; - end - else - if n==1 - str = [str,', press "Done".']; - else - str = [str,', press "Done" when finished.']; - end - end -else - str = varargin{3}; -end - -if nargin<5, col='w'; else, col=varargin{4}; end - -set(findobj(F,'Tag','StatusLine'),'String',str,'ForegroundColor',col) - - -%======================================================================= -case 'done_cb' -%======================================================================= -% ui_get_contrasts(D, 'Done_CB') - -F = gcbf; - -n = get(findobj(F,'Tag','Prompt'),'UserData'); -q = get(findobj(F,'Tag','ConList'),'Value'); - - -if n>0 & isempty(q) %-Contrast(s) required, but none selected - if n==1, str = 'Select a contrast!'; - elseif isfinite(n), str = sprintf('Select %d contrasts!',n); - else, str = 'Select at least one contrast!'; - end -elseif length(q)>abs(n) %-Too many contrasts selected - if n<0, tstr='at most'; else, tstr='only'; end - if abs(n)==1, str = ['Select',tstr,' one contrast!']; - else, str = sprintf('Select %s %d contrasts!',tstr,abs(n)); - end -elseif n>0 & isfinite(n) & length(q)2, error('matrices only!'), end - c = num2cell(cstr,2); - cstr = cell(size(c)); - for i=1:prod(size(c)), cstr{i}=num2str(c{i}); end -else - error('contrast input must be string or number') -end - - -%-Evaluate individual lines of contrast matrix input -%----------------------------------------------------------------------- -I = zeros(size(c,1),1); -msg = cell(size(c)); [msg{:}] = deal(' (OK)'); -for i=1:size(c,1) - if isstr(c{i}) - c{i} = evalin('base',['[',c{i},']'],'''!'''); - end - if isstr(c{i}) - msg{i} = '!evaluation error'; - else - if isempty(c{i}) - msg{i}=' (empty line - ignored)'; - elseif all(c{i}(:)==0) - if size(c{i},1)==1, str='vector'; else, str='matrix'; end - c{i}=[]; msg{i}=[' (zero ',str,' - ignored)']; - elseif STAT=='T' & size(c{i},1)>1 - c{i}='!'; msg{i}='!vector required'; - elseif size(c{i},2)>p - c{i}='!'; msg{i}=sprintf('!too long - only %d prams',p); - else - if size(c{i},2)

1, str=' column'; else, str=''; end - if tmp>1, str=[str,'s']; end - msg{i} = sprintf(' (right padded with %d zero%s)',tmp,str); - end - if ~spm_SpUtil('allCon',X,c{i}') - c{i}='!'; msg{i}='!invalid contrast'; - end - end - end - I(i)=~isstr(c{i}); -end - -%-Construct contrast matrix, validity indicator, and collate parsing messages -%----------------------------------------------------------------------- -c = cat(1,c{find(I)}); -msg = [char(cstr), repmat(' <- ',size(msg,1),1), char(msg)]; -emsg = msg(find(~I),:); -imsg = msg(find( I),:); - -if all(I) & STAT=='T' & size(c,1)>1 %-Check for vector t-contrasts! - I=zeros(size(I)); emsg={'!vector required'}; imsg={}; -end - -%-Return arguments -%----------------------------------------------------------------------- -varargout = {c',I,emsg,imsg,msg}; - - - -%======================================================================= -case 'parseistr' %-Parse index string -%======================================================================= -% [iX0,I,emsg,imsg] = ui_get_contrasts(D, 'ParseIStr',str,max) -% str should be a string (row)vector - - -%-Sort out parameters -%----------------------------------------------------------------------- -str = varargin{2}; -mx = varargin{3}; - - -%-Process input string -%----------------------------------------------------------------------- -I = evalin('base',['[',str,']'],'''!'''); - -if isstr(I) - varargout = {'!',0,[str,' <- !evaluation error'],''}; - return -end - -%-Construct list of valid indicies -%----------------------------------------------------------------------- -ok = ismember(I(:)',[1:mx]); -iX0 = I(ok); - -%-Construct diagnostic info messages -%----------------------------------------------------------------------- -str = ''; msg=''; -if any(ok) - str = strvcat(str,num2str(I(ok))); - msg = strvcat(msg,' <- (OK)'); -end -tmp = ( I<1 | I>mx ); %-Out of range -if any(tmp) - str = strvcat(str,num2str(I(tmp))); - msg = strvcat(msg,sprintf(' <- (ignored - not in [1:%d]',mx)); -end -tmp = ( ~tmp & ~ok ); %-Non integer in range -if any(tmp) - str = strvcat(str,num2str(I(tmp))); - msg = strvcat(msg,' <- (ignored - non-integer)'); -end - -%-Return arguments -%----------------------------------------------------------------------- -varargout = {iX0,1,'',cellstr([str,msg])}; - - -%======================================================================= -case 'reset_cb' -%======================================================================= -% ui_get_contrasts(D, 'Reset_CB') - -hConList = findobj(gcbf,'Tag','ConList'); -STAT = get(findobj(gcbf,'Tag','TFA','Value',1),'UserData'); - -ui_get_contrasts(D,'ListCon',hConList,STAT,[]) - - -%======================================================================= -case 'd_setup_cb' -%======================================================================= -% ui_get_contrasts(D, 'D_Setup_CB') - -F = gcbf; -STAT = get(findobj(F,'Tag','TFA','Value',1),'UserData'); -STATmode = get(findobj(F,'Tag','STATmode'),'UserData'); - -set(F,'UIContextMenu',[]) %-Disable Fig ContextMenu -H = get(findobj(F,'Tag','DefineNew'),'UserData'); %-Get define UI handles -set(findobj(H,'flat','Tag','D_name'),'String','') %-Clear name -%set(findobj(H,'flat','Tag','D_ConMtx'),'UserData',[]) %-Clear con definition -set(H,'Visible','on') %-Show UI -ui_get_contrasts(D, 'D_TF',F,STAT,STATmode); %-Setup rest of define UI - - -%======================================================================= -case {'d_conmtx_cb','d_x1cols_cb'} -%======================================================================= -% ui_get_contrasts(D, 'D_ConMtx_CB') -% ui_get_contrasts(D, 'D_X1cols_CB') - -fcn = find(strcmp(lower(varargin{1}),{'d_conmtx_cb','d_x1cols_cb'})); - -F = gcbf; -h = gcbo; -str = get(h,'String'); - -hD_ConMtx = findobj(F,'Tag','D_ConMtx'); -hD_X1cols = findobj(F,'Tag','D_X1cols'); - - -%-Extract info from holding objects -%----------------------------------------------------------------------- -xX = get(findobj(F,'Tag','DesMtxAx'),'UserData'); -STAT = get(findobj(F,'Tag','D_TF','Value',1),'UserData'); - - -if fcn==1 %-Parse string from ConMtx widget -%----------------------------------------------------------------------- - - set(hD_X1cols,'String','') - [c,I,emsg,imsg] = ui_get_contrasts(D, 'ParseCon',str,xX.xKXs,STAT); - if all(I) - DxCon = spm_FcUtil('Set','',STAT,'c',c,xX.xKXs); - else - DxCon = []; - end - -elseif fcn==2 %-Process column indicies from X1cols widget -%----------------------------------------------------------------------- - set(hD_ConMtx,'String','') - - nPar = spm_SpUtil('size',xX.xKXs,2); - [iX0,I,emsg,imsg] = ui_get_contrasts(D, 'ParseIStr',str,nPar); - - if I - try %-try-catch block for any errors in spm_FcUtil! - DxCon = spm_FcUtil('Set','',STAT,'iX0',iX0,xX.xKXs); - if STAT=='T' & size(DxCon.c,2)>1 - I = 0; emsg = {'! t-contrasts must be vectors'}; - end - catch - I = 0; - emsg = lasterr; - end - end -end - - -%-Define the contrast or report errors... -%----------------------------------------------------------------------- -set(findobj(F,'Tag','D_ConErrs'),'String',emsg,'Value',[]) -set(findobj(F,'Tag','D_ConInfo'),'String',imsg,'Value',[]) -if all(I) - set(hD_ConMtx,'UserData',DxCon); %-Store contrast - ui_get_contrasts(D, 'GraphCons',DxCon,-1,F) %-Depict contrast -else - set(hD_ConMtx,'UserData',[]); %-Clear contrast store - ui_get_contrasts(D, 'GraphCons',[],[],F) %-Clear contrast plot -end -ui_get_contrasts(D, 'D_Status',F) %-Set StatusLine - - -%======================================================================= -case 'd_reset_cb' -%======================================================================= -% ui_get_contrasts(D, 'D_Reset_CB') - -STAT = get(findobj(gcbf,'Tag','TFA','Value',1),'UserData'); -set(findobj(gcbf,'Tag','D_name'),'String','') %-Clear name -set(findobj(gcbf,'Tag','D_ConMtx'),'UserData',[]) %-Contrast definition -ui_get_contrasts(D, 'D_TF',gcbf,STAT); %-Setup rest of define UI - - -%======================================================================= -case 'd_cancel_cb' -%======================================================================= -% ui_get_contrasts(D, 'D_Cancel_CB') - -set(get(findobj(gcbf,'Tag','DefineNew'),'UserData'),'Visible','off') -set(gcbf,'UIContextMenu',findobj(gcbf,'Tag','mConMan_ConMen')) -ui_get_contrasts(D, 'StatusLine') - - -%======================================================================= -case 'd_ok_cb' -%======================================================================= -% ui_get_contrasts(D, 'D_OK_CB') - -F = gcbf; - -name = get(findobj(F,'Tag','D_name'),'String'); -DxCon = get(findobj(F,'Tag','D_ConMtx'),'UserData'); -STAT = get(findobj(F,'Tag','D_TF','Value',1),'UserData'); - -dNam = ~isempty(name); -dCon = ~isempty(DxCon); - -if ~(dNam & dCon) - spm('Beep') - str = { 'contrast name not defined!','',... - 'no valid contrast defined!',''}; - msgbox(str([dNam+1,dCon+3]),... - sprintf('%s%s: %s...',spm('ver'),... - spm('GetUser',' (%s)'),mfilename),'error','modal') - return -end - - -%-Append new contrast to xCon structure of mConMan figure 'UserData' -%----------------------------------------------------------------------- -DxCon.name = name; -if ~strcmp(DxCon.STAT,STAT), error('STAT & DxCon.STAT mismatch!'), end -if isempty(xCon) - xCon = DxCon; -else - xCon = [xCon, DxCon]; -end -D = set_contrasts(D, xCon, 0); -sf_SetD(D, 1, F); - - -%-Redisplay the new list of contrasts, with the new one selected -%----------------------------------------------------------------------- -hConList = findobj(F,'Tag','ConList'); -I = length(xCon); - -%-Use this code to add the new contrast to a multiple selection, if allowed -% Q = get(hConList,'UserData'); -% I = Q(get(hConList,'Value')); -% n = get(findobj(F,'Tag','Prompt'),'UserData'); -% if abs(n)>1, I=[I,length(xCon)]; else, I=length(xCon); end - -ui_get_contrasts(D, 'TFA',F,xCon(end).STAT); %-Set STAT -ui_get_contrasts(D, 'ListCon',hConList,xCon(end).STAT,I) %-ListCon - -%-Hide the DefineNew UI -%----------------------------------------------------------------------- -set(get(findobj(gcbf,'Tag','DefineNew'),'UserData'),'Visible','off') -set(gcbf,'UIContextMenu',findobj(gcbf,'Tag','mConMan_ConMen')) - - -%======================================================================= -case 'd_status' -%======================================================================= -% ui_get_contrasts(D, 'D_Status',F) - -if nargin<3, F=gcbf; else, F=varargin{2}; end -str = {' not',''}; -dNam = ~isempty(get(findobj(F,'Tag','D_name'),'String')); -dCon = ~isempty(get(findobj(F,'Tag','D_ConMtx'),'UserData')); -if dNam & dCon, ok='on'; col='g'; else, ok='off'; col='w'; end -ui_get_contrasts(D, 'StatusLine',F,... - sprintf('name%s defined, contrast%s defined',str{dNam+1},str{dCon+1}),... - col) -%set(findobj(F,'Tag','D_OK'),'Enable',ok) %-Enable "OK" button? - - -%======================================================================= -case 'createfig' -%======================================================================= -% [F,H] = ui_get_contrasts(D, 'CreateFig') -% Handle Structure - H.{hConList,hDesMtxAx,hPrompt,hSTATmode,hStatLin,hNew} - -cF = get(0,'CurrentFigure'); %-Save current figure - -%-Generic callBack code. Fetches object for method calls in callbacks -%----------------------------------------------------------------------- -cb = 'conD = get(findobj(''Tag'', ''mConMan''),''UserData''); '; - -%-Create window, compute scaling for screen size -%----------------------------------------------------------------------- -WS = spm('WinScale'); %-Window scaling factors -FS = spm('FontSizes'); %-Scaled font sizes -PF = spm_platform('fonts'); %-Font names (for this platform) -S0 = get(0,'ScreenSize'); %-Screen size - -F = figure('IntegerHandle','off',... - 'Tag','mConMan',... - 'Name','SPM contrast manager','NumberTitle','off',... - 'Position',[S0(3)/2,S0(4)/2,0,0] + [-250,-200,500,400].*WS,... - 'Resize','off',... - 'Color',[1 1 1]*.7,... - 'MenuBar','none',... - 'DefaultTextColor','k',... - 'DefaultTextFontName',PF.helvetica,... - 'DefaultTextFontSize',FS(10),... - 'DefaultAxesFontName',PF.helvetica,... - 'DefaultUicontrolBackgroundColor',[1 1 1]*.7,... - 'DefaultUicontrolFontName',PF.helvetica,... - 'DefaultUicontrolFontSize',FS(10),... - 'DefaultUicontrolInterruptible','on',... - 'Colormap',gray(64),... - 'Renderer','painters',... - 'Visible','off'); - -%-Draw GUI objects -%----------------------------------------------------------------------- -hPrompt = uicontrol(F,'Style','Text','Tag','Prompt','UserData',[],... - 'String','',... - 'FontName',PF.times,... - 'FontWeight','Bold',... - 'FontAngle','Italic',... - 'FontSize',FS(16),... - 'ForegroundColor','k',... - 'BackgroundColor',[1,1,1]*.7,... - 'HorizontalAlignment','Center',... - 'Position',[020 370 280 025].*WS); - -% ---------------- -%-T/F/all buttons... - -hSTATmode = uicontrol(F,'Style','Frame','Tag','STATmode',... - 'Position',[040 340 260 028].*WS); -uicontrol(F,'Style','Text','String','show',... - 'FontName',PF.times,'FontAngle','Italic','FontSize',FS(8),... - 'ForegroundColor','w',... - 'Position',[045 365 030 010].*WS); -hT = uicontrol(F,'Style','RadioButton','String','t-contrasts','Tag','TFA',... - 'ToolTipString','...to show only contrasts for SPM{t}',... - 'FontSize',FS(9),... - 'ForegroundColor','k',... - 'UserData','T',... - 'Position',[044 343 105 020].*WS); -hF = uicontrol(F,'Style','RadioButton','String','F-contrasts','Tag','TFA',... - 'ToolTipString','...to show only contrasts for SPM{F}',... - 'FontSize',FS(9),... - 'ForegroundColor','k',... - 'UserData','F',... - 'Position',[149 343 105 020].*WS); -hA = uicontrol(F,'Style','RadioButton','String','all','Tag','TFA',... - 'ToolTipString','...to show all defined contrasts',... - 'FontSize',FS(9),... - 'ForegroundColor','k',... - 'UserData','',... - 'Position',[254 343 041 020].*WS); -set([hT,hF,hA],'CallBack',[cb 'ui_get_contrasts(conD, ''TFA'');'],... - 'Interruptible','off','BusyAction','Queue') - - -% ---------------- -%-Contrast list... - -uicontrol(F,'Style','Text','Tag','ConListHdr',... - 'String','### {type} : name',... - 'FontSize',FS(8),'FontAngle','Italic',... - 'HorizontalAlignment','Left',... - 'BackgroundColor','w',... - 'Position',[042 320 256 016].*WS); - -hConList = uicontrol(F,'Style','ListBox','Tag','ConList',... - 'ToolTipString',['Select contrast(s) - drag/shift-click',... - '/ctrl-click to select multiple contrasts'],... - 'String',{'list','not','set','yet'},... - 'Max',2,... - 'CallBack',[cb 'ui_get_contrasts(conD, ''ConList_CB'')'],... - 'Interruptible','off','BusyAction','Queue',... - 'BackgroundColor','w',... - 'Position',[040 080 260 240].*WS); - -% ---------------- -%-Control buttons & status area... - -hNew = uicontrol(F,'Style','Pushbutton','String','Define new contrast...',... - 'Tag','New',... - 'ToolTipString','define new contrast',... - 'ForegroundColor','b',... - 'Callback',[cb 'ui_get_contrasts(conD, ''D_Setup_CB'')'],... - 'Enable','on',... - 'Position',[040 050 150 022].*WS); - -uicontrol(F,'Style','Pushbutton','String','Reset',... - 'ToolTipString','reset selection',... - 'ForegroundColor','r',... - 'Callback',[cb 'ui_get_contrasts(conD, ''Reset_CB'')'],... - 'Position',[195 050 050 022].*WS); - -uicontrol(F,'Style','Pushbutton','String','Done',... - 'ToolTipString','done - press when selected contrast(s)',... - 'ForegroundColor','m',... - 'Tag','Done','UserData',1,... - 'Callback',[cb 'ui_get_contrasts(conD, ''Done_CB'')'],... - 'Interruptible','off','BusyAction','Cancel',... - 'Position',[250 050 050 022].*WS); - -uicontrol(F,'Style','Frame','Tag','StatusArea',... - 'Position',[010 010 480 030].*WS); - -if exist('spm_help.m')==2 - uicontrol(F,'Style','Pushbutton','String','?',... - 'ToolTipString','help on contrasts and the contrast manager',... - 'ForegroundColor','g',... - 'Callback','spm_help(''spm_conman.m'')',... - 'Position',[460 015 020 020].*WS); -end - -hStatLin = uicontrol(F,'Style','Text','Tag','StatusLine',... - 'String','',... - 'FontAngle','Italic',... - 'HorizontalAlignment','Center',... - 'ForegroundColor','w',... - 'Position',[020 015 430 020].*WS); - -% ---------------- -%-Axes for design matrix and parameter estimability... - -hDesMtxAx = axes('Parent',F,'Tag','DesMtxAx',... - 'Position',[0.65 0.30 0.30 0.40],... - 'Color','w',... - 'Box','on','XTick',[],'YTick',[]); - -hParEstAx = axes('Parent',F,'Tag','ParEstAx',... - 'Position',[0.65 0.18 0.30 0.05],... - 'Color','w',... - 'Box','on','XTick',[],'YTick',[]); - -% ---------------- -%-Figure UICOntextMenu - -h = uicontextmenu('Tag','mConMan_ConMen'); -set(F,'UIContextMenu',h) -uimenu(h,'Label','Define new contrast...',... - 'Tag','CM_New',... - 'CallBack',[cb 'ui_get_contrasts(conD, ''D_Setup_CB'')'],... - 'Interruptible','off','BusyAction','Cancel'); -uimenu(h,'Label','Rename selected contrast...',... - 'Tag','CM_Ren',... - 'CallBack',[cb 'ui_get_contrasts(conD, ''Rename_CB'')'],... - 'Interruptible','off','BusyAction','Cancel'); -uimenu(h,'Label','Reset','Separator','on',... - 'CallBack',[cb 'ui_get_contrasts(conD, ''Reset_CB'')'],... - 'Interruptible','off','BusyAction','Cancel'); -uimenu(h,'Label','Done',... - 'CallBack',[cb 'ui_get_contrasts(conD, ''Done_CB'')'],... - 'Interruptible','off','BusyAction','Cancel'); -uimenu(h,'Label','help','Separator','on',... - 'CallBack','spm_help(''spm_conman'')',... - 'Interruptible','off','BusyAction','Cancel'); -uimenu(h,'Label','crash out','Separator','on',... - 'CallBack',[cb 'ui_get_contrasts(conD, ''Initialise'',''reset'');'],... - 'Interruptible','off','BusyAction','Cancel'); -set(h,'CallBack',[cb 'ui_get_contrasts(conD, ''FConMenu_CB'')'],... - 'Interruptible','off','BusyAction','Cancel'); - - -%-Draw contrast definition GUI -%----------------------------------------------------------------------- -H = []; %-Save handles for visibility switching - -h = uicontrol(F,'Style','Frame','Tag','DefineNew',... - 'Position',[010 045 300 350].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Text','Tag','D_Prompt','UserData',[],... - 'String','define contrast...',... - 'FontName',PF.times,... - 'FontWeight','Bold',... - 'FontAngle','Italic',... - 'FontSize',FS(14),... - 'ForegroundColor','b',... - 'HorizontalAlignment','Center',... - 'Position',[020 360 280 030].*WS); -H = [H,h]; - -% ---------------- -%-name -h = uicontrol(F,'Style','Frame','Position',[020 335 280 033].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Text','String','name',... - 'FontSize',FS(10),... - 'FontAngle','Italic',... - 'ForegroundColor','w',... - 'HorizontalAlignment','Center',... - 'Position',[025 355 045 020].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Edit','Tag','D_name',... - 'ToolTipString','enter name for contrast',... - 'HorizontalAlignment','Left',... - 'BackgroundColor',COLOUR,... - 'Callback',[cb 'ui_get_contrasts(conD, ''D_Status'')'],... - 'Interruptible','off',... - 'Position',[080 340 215 022].*WS); -H = [H,h]; - -% ---------------- -%-type -h = uicontrol(F,'Style','Frame','Position',[020 295 280 033].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Text','String','type',... - 'FontSize',FS(10),... - 'FontAngle','Italic',... - 'ForegroundColor','w',... - 'HorizontalAlignment','Center',... - 'Position',[025 315 040 020].*WS); -H = [H,h]; - -hDT = uicontrol(F,'Style','RadioButton','String','t-contrast','Tag','D_TF',... - 'ToolTipString','...to define contrast for SPM{t}',... - 'FontSize',FS(9),... - 'ForegroundColor','k',... - 'UserData','T',... - 'Position',[080 300 105 022].*WS); -hDF = uicontrol(F,'Style','RadioButton','String','F-contrast','Tag','D_TF',... - 'ToolTipString','...to define contrast for SPM{F}',... - 'FontSize',FS(9),... - 'ForegroundColor','k',... - 'UserData','F',... - 'Position',[190 300 105 022].*WS); -set([hDT,hDF],'CallBack',[cb 'ui_get_contrasts(conD, ''D_TF'');'],... - 'Interruptible','off','BusyAction','Queue') -H = [H,hDT,hDF]; - -% ---------------- -%-contrast -h = uicontrol(F,'Style','Frame','Position',[020 080 280 208].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Text','String','contrast',... - 'FontSize',FS(10),... - 'FontAngle','Italic',... - 'ForegroundColor','w',... - 'HorizontalAlignment','Center',... - 'Position',[025 275 055 020].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Text','String','contrast',... - 'FontSize',FS(6),... - 'HorizontalAlignment','Right',... - 'Position',[030 255 045 008].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Text','String','weights',... - 'FontSize',FS(6),... - 'HorizontalAlignment','Right',... - 'Position',[030 245 045 008].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Text','String','vector','Tag','D_Ttxt',... - 'FontSize',FS(6),... - 'HorizontalAlignment','Right',... - 'Position',[030 235 045 008].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Text','String','matrix','Tag','D_Ftxt',... - 'FontSize',FS(6),... - 'HorizontalAlignment','Right',... - 'Position',[030 235 045 008].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Edit','Tag','D_ConMtx',... - 'ToolTipString','enter contrast',... - 'HorizontalAlignment','Left',... - 'BackgroundColor',COLOUR,... - 'Max',2,... - 'CallBack',[cb 'ui_get_contrasts(conD, ''D_ConMtx_CB'')'],... - 'Interruptible','off','BusyAction','Queue',... - 'UserData',[],... - 'Position',[080 200 215 082].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Text','String','or','Tag','D_Ftxt',... - 'FontAngle','Italic',... - 'FontSize',FS(6),... - 'HorizontalAlignment','Left',... - 'Position',[025 205 030 008].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Text','String','columns for','Tag','D_Ftxt',... - 'FontSize',FS(6),... - 'HorizontalAlignment','Right',... - 'Position',[022 190 070 008].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Text','String','reduced design','Tag','D_Ftxt',... - 'FontSize',FS(6),... - 'HorizontalAlignment','Right',... - 'Position',[022 180 070 008].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Edit','Tag','D_X1cols',... - 'ToolTipString',... - 'enter column indicies of reduced design matrix X0',... - 'HorizontalAlignment','Left',... - 'BackgroundColor',COLOUR,... - 'CallBack',[cb 'ui_get_contrasts(conD, ''D_X1cols_CB'')'],... - 'Interruptible','off','BusyAction','Queue',... - 'Position',[090 180 155 020].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Pushbutton','String','...submit',... - 'FontSize',FS(8),... - 'ForegroundColor','c',... - 'Position',[245 180 050 020].*WS); -H = [H,h]; - -%-Errors & info boxes... -h = uicontrol(F,'Style','ListBox','Tag','D_ConErrs',... - 'ToolTipString','contrast parsing errors',... - 'FontName',PF.courier,'FontSize',FS(7),... - 'ForegroundColor','r',... - 'BackgroundColor',[1 1 1]*.7,... - 'Enable','on','Max',2,'Value',[],... - 'Position',[027 127 268 042].*WS); -H = [H,h]; -h = uicontrol(F,'Style','ListBox','Tag','D_ConInfo',... - 'ToolTipString','contrast parsing info',... - 'FontName',PF.courier,'FontSize',FS(7),... - 'ForegroundColor','g',... - 'BackgroundColor',[1 1 1]*.7,... - 'Enable','on','Max',2,'Value',[],... - 'Position',[027 085 268 042].*WS); -H = [H,h]; - -% ---------------- -%-Control buttons & status area... -h = uicontrol(F,'Style','Pushbutton','String','Reset',... - 'Tag','D_Reset',... - 'ToolTipString','reset definition interface',... - 'ForegroundColor','b',... - 'Callback',[cb 'ui_get_contrasts(conD, ''D_Reset_CB'')'],... - 'Interruptible','off','BusyAction','Cancel',... - 'Position',[140 053 050 022].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Pushbutton','String','Cancel',... - 'Tag','D_Cancel',... - 'ToolTipString','cancel contrast definition',... - 'ForegroundColor','r',... - 'Callback',[cb 'ui_get_contrasts(conD, ''D_Cancel_CB'')'],... - 'Interruptible','off','BusyAction','Cancel',... - 'Position',[195 053 050 022].*WS); -H = [H,h]; -h = uicontrol(F,'Style','Pushbutton','String','OK',... - 'Tag','D_OK',... - 'ToolTipString','OK - press to accept newly defined contrast',... - 'ForegroundColor','m',... - 'Callback',[cb 'ui_get_contrasts(conD, ''D_OK_CB'')'],... - 'Interruptible','off','BusyAction','Cancel',... - 'Position',[250 053 050 022].*WS); -H = [H,h]; -set(findobj(H,'flat','Tag','DefineNew'),'UserData',H) - - -%-Finish up -%----------------------------------------------------------------------- -set(0,'CurrentFigure',cF) -varargout = {F,struct( 'hConList', hConList,... - 'hDesMtxAx', hDesMtxAx,... - 'hParEstAx', hParEstAx,... - 'hPrompt', hPrompt,... - 'hSTATmode', hSTATmode,... - 'hStatLin', hStatLin,... - 'hNew', hNew )}; - - -%======================================================================= -otherwise %-unknown action -%======================================================================= -error(['Illegal Action string: ',varargin{1}]) - - -%======================================================================= -end % - E N D -return -%======================================================================= - - -%======================================================================= -% Subfunctions -%======================================================================= -function sf_ImDesMtx(xX, h) -%-Picture design matrix - -axes(h) -if isfield(xX,'nKX') & ~isempty(xX.nKX) - hDesMtxIm = image((xX.nKX+1)*32); -else - hDesMtxIm = image(... - (spm_DesMtx('sca',xX.xKXs.X,xX.name)+1)*32); -end -set(h,'YTick',[],'XTick',[]) %-No Tick marks -set(h,'Tag','DesMtxAx','UserData',xX) %-Reset axis UserData after image -xlabel('Design matrix') -set(hDesMtxIm,'UserData',... - struct('X',xX.xKXs.X,'Xnames',{xX.name})) -set(hDesMtxIm,'ButtonDownFcn','spm_DesRep(''SurfDesMtx_CB'')') -return - -function sf_ImParEst(xX, h) -%-Picture design parameter estimability - -axes(h) -est = spm_SpUtil('IsCon',xX.xKXs); -nPar = length(est); - -hParEstIm = image((est+1)*32); -set(h, 'XLim',[0,nPar]+.5,'XTick',[1:nPar-1]+.5,'XTickLabel','',... - 'YLim',[0,1]+.5,'YDir','reverse','YTick',[],... - 'Box','on','TickDir','in','XGrid','on','GridLineStyle','-'); -xlabel('parameter estimability') -set(h,'Tag','ParEstAx') %-Reset 'Tag' after image cleared it -set(hParEstIm,'UserData',struct('est',est,'Xnames',{xX.name})) -set(hParEstIm,'ButtonDownFcn','spm_DesRep(''SurfEstIm_CB'')') -return - -function sf_SetD(D, changef, F) -% Sets new data into figure -if nargin < 2, changef = 0; end -if nargin < 3, F = get(findobj('Tag', 'mConMan'),'UserData'); end - -hD_Reset = findobj(F,'Tag','D_Reset'); -set(F, 'UserData', D); -set(hD_Reset, 'UserData', changef); -return diff --git a/lib/marsbar-0.44/@mardo/unfiltered_efficiency.m b/lib/marsbar-0.44/@mardo/unfiltered_efficiency.m deleted file mode 100644 index 45bb582..0000000 --- a/lib/marsbar-0.44/@mardo/unfiltered_efficiency.m +++ /dev/null @@ -1,17 +0,0 @@ -function e = unfiltered_efficiency(D, Ic) -% Calculate unfiltered efficiency for given SPM design and contrast - -if nargin < 2 - error('Need design and contrast number'); -end -if ~has_contrasts(D) - error('Need design with contrasts'); -end - -% Get contrast matrix to test for -xCon = get_contrasts(D); -con = xCon(Ic).c; - -X = design_matrix(D); -e = 1 / trace(con' * pinv(X' * X) * con); -return diff --git a/lib/marsbar-0.44/@mardo/verbose.m b/lib/marsbar-0.44/@mardo/verbose.m deleted file mode 100644 index 9438539..0000000 --- a/lib/marsbar-0.44/@mardo/verbose.m +++ /dev/null @@ -1,11 +0,0 @@ -function res = verbose(obj, data) -% get/set method for verbose field -% -% $Id$ - -if nargin > 1 - obj.verbose = data; - res = obj; -else - res = obj.verbose; -end diff --git a/lib/marsbar-0.44/@mardo_2/add_trial_f.m b/lib/marsbar-0.44/@mardo_2/add_trial_f.m deleted file mode 100644 index 2438aca..0000000 --- a/lib/marsbar-0.44/@mardo_2/add_trial_f.m +++ /dev/null @@ -1,36 +0,0 @@ -function [D, changef] = add_trial_f(D) -% method to add trial-specific F contrasts -% -% D - design to put contrasts into -% -% Returns -% D - design with any added contrasts -% changef - set to 1 if any contrasts have been added -% -% The routine only adds contrasts that are not already present -% -% $Id$ - -if ~strcmp(modality(D), 'fmri') - error('Can only set trial-specific F contrasts for FMRI designs'); -end -SPM = des_struct(D); -xX = SPM.xX; -[nScan nBeta] = size(xX.X); - -%-Append contrasts for fMRI - specified by SPM.Sess(s).Fc(i) -%----------------------------------------------------------------------- -xCon = []; -if isfield(SPM,'Sess') - for s = 1:length(SPM.Sess) - for i = 1:length(SPM.Sess(s).Fc) - iX0 = 1:nBeta; - iX = SPM.Sess(s).col(SPM.Sess(s).Fc(i).i); - iX0(iX) = []; - Fcname = sprintf('Sess(%d):%s',s,SPM.Sess(s).Fc(i).name); - xcon = spm_FcUtil('Set',Fcname,'F','iX0',iX0,xX.xKXs); - xCon = [xCon xcon]; - end - end -end -[D Ic changef] = add_contrasts(D, xCon); diff --git a/lib/marsbar-0.44/@mardo_2/apply_filter.m b/lib/marsbar-0.44/@mardo_2/apply_filter.m deleted file mode 100644 index ac1ce9d..0000000 --- a/lib/marsbar-0.44/@mardo_2/apply_filter.m +++ /dev/null @@ -1,71 +0,0 @@ -function Y = apply_filter(D, Y, flags) -% applies filter in design to data -% FORMAT Y = apply_filter(D, Y, flags) -% -% D - design, which includes a filter -% Y - data to filter (2D matrix or marsy data object) -% flags - string specifying one option, or cell array specifying more -% than one option, or struct with fields specifying options. -% Values for strings, cell contents or field names are -% 'no_whitening' - specifies not to use whitening matrix even -% if present in model -% 'sessions' - when used as struct field, value for field -% specifies sessions to apply filter for. The -% data size must match the length of the -% included sessions. -% -% Returns -% Y - filtered data -% -% $Id$ - -if nargin < 2 - error('Need data to filter'); -end -if nargin < 3 - flags = []; -end -if ~isempty(flags) - if ischar(flags), flags = {flags}; end - if iscell(flags) - flags = cell2struct(repmat({''}, size(flags)), flags, 1); - end -end -if ~is_fmri(D) - return -end -if ~has_filter(D) - error('This FMRI design does not contain a filter'); -end - -SPM = des_struct(D); -K = SPM.xX.K; -if ~has_whitener(D) | isfield(flags, 'no_whitening') - W = eye(n_time_points(D)); -else - W = SPM.xX.W; -end - -% Filtering from subset of sessions -if isfield(flags, 'sessions') - ss = flags.sessions; - if ~isempty(ss) - blk_rows = block_rows(D); - if any(ss < 1 | ss > length(blk_rows)) - error('Sessions appear to be out of range'); - end - K = K(ss); - K.row = blk_rows{ss} - blk_rows{ss}(1) + 1; - W = W(blk_rows{ss}, blk_rows{ss}); - end -end - -if isa(Y, 'marsy') % marsy object - rd = region_data(Y); - for r = 1:length(rd) - rd{r} = pr_spm_filter(K, W*rd{r}); - end - Y = region_data(Y, [], rd); -else % 2D matrix - Y = pr_spm_filter(K, W*Y); -end diff --git a/lib/marsbar-0.44/@mardo_2/autocorr.m b/lib/marsbar-0.44/@mardo_2/autocorr.m deleted file mode 100644 index cd9c7ea..0000000 --- a/lib/marsbar-0.44/@mardo_2/autocorr.m +++ /dev/null @@ -1,98 +0,0 @@ -function D = autocorr(D, autocorr_type, varargin) -% method to set autocorrelation types for design -% FORMAT D = autocorr(D, autocorr_type, varargin) -% -% D - design object -% autocorr_type - autocorrelation type specification, one of -% 'SPM' -% 'fmristat' -% 'none' -% varargin - parameters defining autocorrelation model. -% If autocorr type is 'SPM': -% varargin{1} should be vector with estimated AR -% coefficients (default is [0.2]) -% varargin{2} is optional, and is flag; non-zero value -% specifies voxel-wise covariance estimates (default 1) -% If autocorr type is 'fmristat' -% varargin{1} is scalar value for order of fmristat -% model (default is 1); -% -% $Id$ - -if nargin < 2 - error('Need autocorr type'); -end - -if ~is_fmri(D) - warning('Can only set autocorrelation for FMRI design types'); - return -end - -% Get design, put into some useful variables -v_f = verbose(D); -SPM = des_struct(D); -nscan = SPM.nscan; - -SPM.xVi.cov_calc = 'summary'; - -switch lower(autocorr_type) - case 'fmristat' - % Fit fmristat model AR(n) - if nargin < 3, varargin{1} = 1; end - cVi = varargin{1}; - if prod(size(cVi)) > 1 - error('Expecting scalar for fmristat order'); - end - SPM.xVi.Vi = struct('type', 'fmristat', 'order', cVi); - cVi = sprintf('fmristat AR(%d)',cVi); - f2cl = 'V'; % Field to CLear - - case 'spm' - % SPM AR coefficient(s) to be specified - if nargin < 3, varargin{1} = 0.2; end - if nargin < 4, varargin{2} = 1; end - cVi = varargin{1}; - if any(cVi > 1 | cVi < 0) - error('Rho estimates should be > 0 and < 1'); - end - SPM.xVi.Vi = pr_spm_ce(nscan, cVi); - cVi = sprintf('AR(%0.1f)',cVi(1)); - f2cl = 'V'; - if varargin{2} - SPM.xVi.cov_calc = 'vox'; - end - - case 'none' - % xVi.V is i.i.d - %--------------------------------------------------------------- - SPM.xVi.V = speye(sum(nscan)); - cVi = 'i.i.d'; - f2cl = 'Vi'; - - otherwise - error(['Eccentric autocorr type ' autocorr_type]); -end - -% If we've set V, need to clear Vi, because the -% estimate method takes the presence of Vi to mean that -% V can be cleared, with 'redo_covar' flag -% Conversely V needs to be cleared if Vi was estimated -if isfield(SPM.xVi, f2cl) - SPM.xVi = rmfield(SPM.xVi, f2cl); - if v_f, fprintf('Clearing previous %s matrix\n', f2cl); end -end - -% Also: remove previous W matrices -% Either will need to be recalculated or won't be used -if isfield(SPM.xX, 'W') - SPM.xX = rmfield(SPM.xX, 'W'); - if v_f, fprintf('Clearing previous W matrix\n'); end -end - -% fill into design -SPM.xVi.form = cVi; -xsDes = struct('Serial_correlations', SPM.xVi.form); -SPM.xsDes = mars_struct('ffillmerge', SPM.xsDes, xsDes); - -% put stuff into object -D = des_struct(D,SPM); diff --git a/lib/marsbar-0.44/@mardo_2/bf_dt.m b/lib/marsbar-0.44/@mardo_2/bf_dt.m deleted file mode 100644 index 160ab9b..0000000 --- a/lib/marsbar-0.44/@mardo_2/bf_dt.m +++ /dev/null @@ -1,7 +0,0 @@ -function d = bf_dt(D) -% method returns length of time bin for basis functions -% -% $Id$ - -SPM = des_struct(D); -d = mars_struct('getifthere', SPM, 'xBF', 'dt'); diff --git a/lib/marsbar-0.44/@mardo_2/block_cols.m b/lib/marsbar-0.44/@mardo_2/block_cols.m deleted file mode 100644 index 9da4157..0000000 --- a/lib/marsbar-0.44/@mardo_2/block_cols.m +++ /dev/null @@ -1,14 +0,0 @@ -function cols = block_cols(D) -% method gets design columns for block (session / subject) -% FORMAT cols = block_cols(D) -% -% Returns cell array of column indices (one per session) -% -% $Id$ - -if ~is_fmri(D) - error('Needs FMRI design'); -end - -SPM = des_struct(D); -cols = {SPM.Sess(:).col}; diff --git a/lib/marsbar-0.44/@mardo_2/block_rows.m b/lib/marsbar-0.44/@mardo_2/block_rows.m deleted file mode 100644 index 48caa0e..0000000 --- a/lib/marsbar-0.44/@mardo_2/block_rows.m +++ /dev/null @@ -1,20 +0,0 @@ -function rows = block_rows(D) -% returns cell array of rows for each (subject/session) block -% -% $Id$ - -SPM = des_struct(D); -if strcmp(modality(D), 'fmri') - Sess = SPM.Sess; - rows = {Sess(:).row}; -else % PET I guess - xX = SPM.xX; - if ~isfield(xX, 'I') - error('Expecting I field in SPM design'); - end - scol = xX.I(:, 3); % the subject column - subjnos = unique(scol); - for s = 1:length(subjnos); - rows{s} = find(scol == subjnos(s)); - end -end diff --git a/lib/marsbar-0.44/@mardo_2/can_mars_estimate.m b/lib/marsbar-0.44/@mardo_2/can_mars_estimate.m deleted file mode 100644 index b6fa024..0000000 --- a/lib/marsbar-0.44/@mardo_2/can_mars_estimate.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = can_mars_estimate(D) -% method returns 1 if design can be estimated in MarsBaR -% -% $Id$ - -tf = ~is_fmri(D) | (has_filter(D) & has_autocorr(D)); diff --git a/lib/marsbar-0.44/@mardo_2/compute_contrasts.m b/lib/marsbar-0.44/@mardo_2/compute_contrasts.m deleted file mode 100644 index 1c7ac87..0000000 --- a/lib/marsbar-0.44/@mardo_2/compute_contrasts.m +++ /dev/null @@ -1,51 +0,0 @@ -function [marsS] = compute_contrasts(marsDe, Ic) -% compute and return results of contrast statistics -% FORMAT marsS = compute_contrasts(marsDe, Ic) -% -% marsDe - design object -% Ic - indices into contrast structure -% -% Output -% marsS - statistic result structure -% -% For the 'con', 'stat' 'P' 'Pc' fields below, the results are matrices -% with one row per contrast, one column per ROI estimated -% -% The statistics results structure has fields -% 'con' - contrast value (numerator of t statistic, or ESS for F) -% 'stat' - t or F statistic value -% 'P' - uncorrected P value -% 'Pc' - P values corrected for number of ROIs -% 'MVres' - multivariate results structure with fields -% 'y_pre' - predicted temporal response -% 'y_obs' - observerd temporal response -% 'Pf' - probabability for last (rank of subspace) -% eigenvalues -% 'u' - principle components -% 'ds' - component weights (diag(S)) -% 'df' - degrees of freedom for Pf -% 'columns' - names of regions -% 'rows' - cell array of structs, one per contrast calculated, -% with fields: -% 'name' - contrast name -% 'stat' - statistic type (T|F) -% -% $Id$ - -SPM = des_struct(marsDe); -xCon = SPM.xCon; - -if nargin < 2 - Ic = 1:length(xCon); -end - -%- results -[marsS.con marsS.stat, marsS.P, marsS.Pc] = ... - pr_stat_compute(SPM, Ic); -marsS.MVres = pr_stat_compute_mv(SPM, Ic); - -marsS.columns = region_name(SPM.marsY); -for i = 1:length(Ic) - marsS.rows{i}.name = xCon(Ic(i)).name; - marsS.rows{i}.stat = xCon(Ic(i)).STAT; -end diff --git a/lib/marsbar-0.44/@mardo_2/convert_vols.m b/lib/marsbar-0.44/@mardo_2/convert_vols.m deleted file mode 100644 index f3b26fe..0000000 --- a/lib/marsbar-0.44/@mardo_2/convert_vols.m +++ /dev/null @@ -1,51 +0,0 @@ -function o = convert_vols(o, ver) -% method that converts vol structs in design and converts to format 'ver' -% FORMAT o = convert_fo(o, ver) -% -% Input -% o - design object -% ver - optional version for vols from '99' or '5' -% Defaults to version for current SPM version -% -% Output -% o - object with converted vols -% -% Example -% % Convert vols to current format -% o = convert_vols(o); -% -% % Convert to native format for SPM99 designs -% o = convert_vols(o, native_vol_ver(o)); -% -% $Id$ - -if nargin < 2 - ver = mars_vol_utils('current_ver'); -end - -SPM = des_struct(o); -SPM = sf_conv(SPM, ver, 'xY', 'VY'); -SPM = sf_conv(SPM, ver, 'xM', 'VM'); -SPM = sf_conv(SPM, ver, 'xVol', 'VRpv'); -SPM = sf_conv(SPM, ver, 'Vbeta'); -SPM = sf_conv(SPM, ver, 'VResMS'); -SPM = sf_conv(SPM, ver, 'VM'); -o = des_struct(o, SPM); - -xCon = get_contrasts(o); -if ~isempty(xCon) - for i = 1:length(xCon) - xCon(i) = sf_conv(xCon(i), ver, 'Vcon'); - xCon(i) = sf_conv(xCon(i), ver, 'Vspm'); - end -end -o = set_contrasts(o, xCon, 0); -return - -function S = sf_conv(S, ver, varargin) -V = mars_struct('getifthere', S, varargin{:}); -if ~isempty(V) - V = mars_vol_utils('convert', V, ver); - S = setfield(S, varargin{:}, V); -end -return diff --git a/lib/marsbar-0.44/@mardo_2/design_vol.m b/lib/marsbar-0.44/@mardo_2/design_vol.m deleted file mode 100644 index 4701d30..0000000 --- a/lib/marsbar-0.44/@mardo_2/design_vol.m +++ /dev/null @@ -1,32 +0,0 @@ -function V = design_vol(D, imgs) -% returns vols in appropriate format for saving in design -% FORMAT V = design_vol(D, imgs) -% -% Input -% D - mardo design object -% imgs - image names or vol structs -% -% Output -% V - paths relative to swd -% -% $Id$ - -if nargin < 2 - error('Need image information'); -end - -if iscell(imgs) - imgs = char(imgs); -end -if ischar(imgs) - imgs = full_vol(D, imgs); -end -if isstruct(imgs) - V = imgs; - fnames = spm_str_manip(strvcat(imgs(:).fname), 't'); - for i = 1:prod(size(imgs)) - V(i).fname = deblank(fnames(i,:)); - end -else - error('Odd input format for images'); -end diff --git a/lib/marsbar-0.44/@mardo_2/estimate.m b/lib/marsbar-0.44/@mardo_2/estimate.m deleted file mode 100644 index 877e1d6..0000000 --- a/lib/marsbar-0.44/@mardo_2/estimate.m +++ /dev/null @@ -1,103 +0,0 @@ -function [marsD] = estimate(marsD, marsY, params) -% estimate method - estimates GLM for SPM2 model -% -% marsD - SPM design object -% marsY - MarsBaR data object or 2D data matrix -% params - struct containing options, as fields -% redo_covar - if 1, remodels covariance -% redo_whitening - if 1, recalcalates whitening -% (by default, both are set to 1) -% -% e.g. -% % Estimate model on design D and data Y, using original covariance and -% % whitening -% E = estimate(D, Y, struct('reco_covar', 0, ... -% 'redo_whitening', 0); -% -% $Id$ - -def_params = struct(... - 'redo_covar', 1, ... - 'redo_whitening', 1); - -if nargin < 2 - error('Need data to estimate'); -end -if nargin < 3 - params = []; -end - -% Replicate original behaviour calling with cell array of strings -params = sf_call_compat(params); - -% Fill with defaults -params = mars_struct('ffillmerge', def_params, params); - -% ensure we have a data object -marsY = marsy(marsY); - -% check design is complete -if ~can_mars_estimate(marsD) - error('This design needs more information before it can be estimated'); -end - -% Check data and design dimensions -if n_time_points(marsY) ~= n_time_points(marsD) - error('The data and design must have the same number of rows'); -end - -% get SPM design structure -SPM = des_struct(marsD); - -% process params -if params.redo_covar - if isfield(SPM, 'xVi') - if isfield(SPM.xVi, 'V') & isfield(SPM.xVi, 'Vi') - SPM.xVi = rmfield(SPM.xVi, 'V'); - if verbose(marsD) - disp('Re-estimating covariance'); - end - end - end -end -if params.redo_whitening - if isfield(SPM.xX, 'W') - SPM.xX = rmfield(SPM.xX, 'W'); - if verbose(marsD) - disp('Re-estimating whitening filter'); - end - end -end - -SPM = pr_estimate(SPM, marsY); -SPM.marsY = marsY; -SPM.SPMid = sprintf('SPM2: MarsBaR estimation. mardo_2 version %s', ... - marsD.cvs_version); - -% return modified structure -marsD = des_struct(marsD, SPM); - -return - -function params = sf_call_compat(params) -% Replicates old calling behaviour, for backwards compatibility - -% Replicate result of passing empty cell array, but warn that this -% will be removed soon -if ischar(params) | iscell(params) - warning(['Cell / char form of params deprecated, ' ... - 'please use struct form instead']); -end -if iscell(params) & isempty(params) - warning(['Empty cell array changes default options; '... - 'This behaviour will change for future versions']); - params = struct(... - 'redo_covar', 0, ... - 'redo_whitening', 0); -end -if ischar(params)params = {params}; end -if iscell(params) - params = params(:); - params = cell2struct(num2cell(ones(size(params))), params, 1); -end -return diff --git a/lib/marsbar-0.44/@mardo_2/event_cols.m b/lib/marsbar-0.44/@mardo_2/event_cols.m deleted file mode 100644 index 6fe43f9..0000000 --- a/lib/marsbar-0.44/@mardo_2/event_cols.m +++ /dev/null @@ -1,18 +0,0 @@ -function I = event_cols(D, e_spec) -% method gets design columns for single event -% -% $Id$ - -if nargin < 2 - error('Need design and event spec'); -end -if ~is_fmri(D) - error('Needs FMRI design'); -end - -SPM = des_struct(D); -Sess = SPM.Sess; -bf = SPM.xBF.bf; -ss = e_spec(1); -en = e_spec(2); -I = Sess(ss).col(Sess(ss).Fc(en).i(1:size(bf,2))); diff --git a/lib/marsbar-0.44/@mardo_2/event_onsets.m b/lib/marsbar-0.44/@mardo_2/event_onsets.m deleted file mode 100644 index 5031442..0000000 --- a/lib/marsbar-0.44/@mardo_2/event_onsets.m +++ /dev/null @@ -1,40 +0,0 @@ -function [onsets, durations] = event_onsets(D, e_spec) -% method gets onsets and durations for event/session -% FORMAT [onsets durations] = event_onsets(D, e_spec) -% -% D - design object -% e_spec - event specification (see event_fitted for details) -% -% Returns -% onsets - onset times in TRs -% durations - duration of events in TRs -% -% $Id$ - -if nargin < 2 - error('Need design and event spec'); -end -if ~is_fmri(D) - error('Needs FMRI design'); -end -if prod(size(e_spec)) > 2 - error('Can only deal with one event at a time'); -end - -s = e_spec(1); -e = e_spec(2); -SPM = des_struct(D); - -U = SPM.Sess(s).U(e); -onsets = U.ons; -durations = U.dur; - -if strcmp(SPM.xBF.UNITS, 'secs') - TR = tr(D); - onsets = onsets / TR; - durations = durations / TR; -end - -if prod(size(durations)) == 1 - durations = ones(size(onsets)) * durations; -end diff --git a/lib/marsbar-0.44/@mardo_2/event_regressor.m b/lib/marsbar-0.44/@mardo_2/event_regressor.m deleted file mode 100644 index cf34eca..0000000 --- a/lib/marsbar-0.44/@mardo_2/event_regressor.m +++ /dev/null @@ -1,44 +0,0 @@ -function [X, dt] = event_regressor(D, e_spec, dur) -% method gets estimated regressor for single event -% FORMAT [X dt] = event_regressor(D, e_spec, dur) -% -% D - design object -% e_spec - event specification (see event_fitted for details) -% dur - event duration in seconds (default = 0) -% -% Returns -% X - event regressor for single event -% (one column per basis function used to model event) -% dt - time units (seconds per row in X) -% -% $Id$ - -if nargin < 2 - error('Need design and event spec'); -end -if nargin < 3 - dur = 0; -end -if ~is_fmri(D) - error('Needs FMRI design'); -end - -if size(e_spec, 1) == 1, e_spec = e_spec'; end - -SPM = des_struct(D); -Sess = SPM.Sess; -dt = SPM.xBF.dt; -bf = SPM.xBF.bf; -ss = e_spec(1); -en = e_spec(2); - -if ~dur - % SPM2 does a second's worth of spike for events without durations - sf = 1/dt; -else - sf = ones(round(dur/dt), 1); -end -X = []; -for b = 1:size(bf,2) - X = [X conv(sf, bf(:,b))]; -end diff --git a/lib/marsbar-0.44/@mardo_2/event_specs.m b/lib/marsbar-0.44/@mardo_2/event_specs.m deleted file mode 100644 index 8b14a4d..0000000 --- a/lib/marsbar-0.44/@mardo_2/event_specs.m +++ /dev/null @@ -1,31 +0,0 @@ -function [e_specs, e_names] = event_specs(D) -% method to return event specifications for all event in model -% FORMAT [e_specs, e_names] = event_specs(D) -% -% D - design object -% -% Returns -% e_specs - event specification 2 by N matrix where row 1 is the -% session number of the event, row 2 is the event number in -% the session -% -% e_names - names of each event -% -% $Id$ - -if ~is_fmri(D) - error('Needs FMRI design'); -end - -SPM = des_struct(D); -Sess = SPM.Sess; -nsess = length(Sess); - -e_specs = []; -e_names = {}; -e_ctr = 1; -for ss = 1:nsess - nevs = length(Sess(ss).U); - e_specs = [e_specs [ones(1, nevs) * ss; 1:nevs]]; - e_names = [e_names {Sess(ss).Fc(:).name}]; -end diff --git a/lib/marsbar-0.44/@mardo_2/event_x_fir.m b/lib/marsbar-0.44/@mardo_2/event_x_fir.m deleted file mode 100644 index 85a15f8..0000000 --- a/lib/marsbar-0.44/@mardo_2/event_x_fir.m +++ /dev/null @@ -1,96 +0,0 @@ -function Xn = event_x_fir(D, e_spec, bin_length, bin_no, opts) -% method to return FIR design matrix columns for session -% FORMAT Xn = event_x_fir(D, e_spec, bin_length, bin_no, opts) -% -% D - design object -% e_spec - event specification for single event -% [session no; event no] -% bin_length - bin length in seconds [TR] -% bin_no - number of bins for FIR [25 seconds / bin_length] -% opts - structure, containing fields with options -% 'single' - if field present, gives single FIR -% This option removes any duration information, and -% returns a simple per onset FIR model, where ones in the -% design matrix corresponds to 1 event at the given -% offset. See event_fitted_fir.m for more details. -% -% Returns -% Xn - columns in design matrix for FIR model -% -% $Id$ - -if nargin < 2 - error('Need event specfication'); -end -if nargin < 3 - bin_length = []; -end -if nargin < 4 - bin_no = []; -end -if nargin < 5 - opts = []; -end - -s = e_spec(1); -e = e_spec(2); -if isempty(bin_length) - bin_length = tr(D); -end -if isempty(bin_no) - bin_no = round(25/bin_length); -end - -SPM = des_struct(D); - -xBF = SPM.xBF; -xBF.name = 'Finite Impulse Response'; -xBF.order = bin_no; -xBF.length = xBF.order*bin_length; -xBF = pr_spm_get_bf(xBF); - -U = SPM.Sess(s).U(e); -k = SPM.nscan(s); - -% If all the durations are zero, the model is already single. The stick -% function values have been set to 1/dt though, which is confusing, so -% we'll reset the stick functions to have 1s -if ~any(U.dur), opts.single = 1; end - -if isfield(opts, 'single') - U.u = sf_ones_ons(U, xBF, k); - if verbose(D) - if any(diff(U.dur)) - warning(['Different event durations; ' ... - 'single FIR model likely to be invalid']); - end - end -else - U.u = U.u(:,1); -end - -Xn = pr_spm_volterra(U,xBF.bf,1); -Xn = Xn([0:(k - 1)]* xBF.T + xBF.T0 + 32,:); - -return - -function sf = sf_ones_ons(U, xBF, k) -% Return onsets with only 1s in start time bin for each event - -ons = U.ons; -T = xBF.T; -dt = xBF.dt; -switch xBF.UNITS - case 'scans' - TR = T*dt; - case 'secs' - TR = 1; -end - -ton = round(ons*TR/dt) + 32; -sf = sparse((k*T + 128),1); -for j = 1:length(ton) - sf(ton(j),:) = sf(ton(j),:) + 1; -end - -return diff --git a/lib/marsbar-0.44/@mardo_2/fill.m b/lib/marsbar-0.44/@mardo_2/fill.m deleted file mode 100644 index c4fec54..0000000 --- a/lib/marsbar-0.44/@mardo_2/fill.m +++ /dev/null @@ -1,291 +0,0 @@ -function D = fill(D, actions) -% fills missing entries from SPM FMRI design matrix -% FORMAT D = fill(D, actions) -% -% D - mardo object containing spm design -% actions - string or cell array of strings with actions: -% 'defaults' - fills empty parts of design with defaults -% (in fact this is always done) -% 'filter' - asks for and fills filter -% 'autocorr' - asks for and fills autocorrelation -% 'for_estimation' fill filter &| autocorr if not present -% 'images' - asks for and fills with images, mask, scaling -% -% Returns -% D - returned mardo SPM design -% -% Copied/pasted then rearranged from SPM2 spm_fmri_spm_ui -% Matthew Brett - 17/11/01 - MRS2TH -% -% $Id$ - -if nargin < 2 - actions = ''; -end -if ~is_fmri(D), return, end -if isempty(actions), actions = {'defaults'}; end -if ischar(actions), actions = {actions}; end -fe = find(ismember(actions, 'for_estimation')); -if ~isempty(fe) - A = []; - if is_fmri(D) - if ~has_filter(D), A = {'filter'}; end - if ~has_autocorr(D), A = [A {'autocorr'}]; end - end - actions(fe) = []; - actions = [actions(1:fe(1)-1) A actions(fe(1):end)]; -end -actions = [{'defaults'}, actions]; - -% Get design, put into some useful variables -v_f = verbose(D); -SPM = des_struct(D); -xX = SPM.xX; -have_sess = isfield(SPM, 'Sess'); -if have_sess, Sess = SPM.Sess; end - -% get file indices -%--------------------------------------------------------------- -row = block_rows(D); -nsess = length(row); -nscan = zeros(1,nsess); -for i = 1:nsess - nscan(i) = length(row{i}); -end - -done_list = {}; -for a = 1:length(actions) - if ismember(actions{a}, done_list), continue, end - done_list = [actions(a) done_list]; - switch lower(actions{a}) - case 'defaults' - - % prepare various default settings, offer to design - xM = []; % masking - xGX = []; % globals - sGXcalc = 'none'; % global calculation description - sGMsca = 'none'; % grand mean scaling description - Global = 'none'; % proportional scaling or no - - BFstr = ''; DSstr = ''; ntr = []; - if have_sess - % Number of trial types per session - for i = 1:nsess, ntr(i) = length(SPM.Sess(i).U); end - BFstr = SPM.xBF.name; - end - - xsDes = struct(... - 'Basis_functions', BFstr,... - 'Number_of_sessions', sprintf('%d',nsess),... - 'Trials_per_session', sprintf('%-3d',ntr),... - 'Global_calculation', sGXcalc,... - 'Grand_mean_scaling', sGMsca,... - 'Global_normalisation', Global); - - if isfield(SPM, 'xsDes') - xsDes = mars_struct('fillafromb', SPM.xsDes, xsDes); - end - - SPM.xsDes = xsDes; - SPM = mars_struct('merge', SPM, ... - struct('xGX', xGX,... - 'xM', xM)); - - case 'images' - [Finter,Fgraph,CmdLine] = spm('FnUIsetup','fMRI stats model setup',0); - % get filenames - %--------------------------------------------------------------- - P = []; - for i = 1:nsess - str = sprintf('select scans for session %0.0f',i); - q = spm_get(nscan(i),mars_veropts('get_img_ext'),str); - P = strvcat(P,q); - end - - % place in data field - %--------------------------------------------------------------- - SPM.xY.P = P; - - % Assemble remaining design parameters - %======================================================================= - - % Global normalization - %----------------------------------------------------------------------- - spm_input('Global intensity normalisation...',1,'d',mfilename) - str = 'remove Global effects'; - SPM.xGX.iGXcalc = spm_input(str,'+1','scale|none',{'Scaling' 'None'}); - SPM.xGX.sGXcalc = 'mean voxel value'; - SPM.xGX.sGMsca = 'session specific'; - - % Assemble other design parameters - %======================================================================= - spm_help('!ContextHelp',mfilename) - spm_input('Global intensity normalisation...',1,'d',mfilename); - - % get file identifiers and Global values - %======================================================================= - fprintf('%-40s: ','Mapping files') %-# - VY = spm_vol(SPM.xY.P); - fprintf('%30s\n','...done') %-# - - %-Check compatability of images - %----------------------------------------------------------------------- - [samef msg] = mars_vol_check(VY); - if ~samef, disp(char(msg)),error('Cannot use images'),end; - - %-place in xY - %----------------------------------------------------------------------- - SPM.xY.VY = VY; - - %-Compute Global variate - %======================================================================= - GM = 100; - q = length(VY); - g = zeros(q,1); - fprintf('%-40s: %30s','Calculating globals',' ') %-# - for i = 1:q - fprintf('%s%30s',repmat(sprintf('\b'),1,30),sprintf('%4d/%-4d',i,q)) %-# - g(i) = spm_global(VY(i)); - end - fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-# - - % scale if specified (otherwise session specific grand mean scaling) - %----------------------------------------------------------------------- - gSF = GM./g; - if strcmp(SPM.xGX.iGXcalc,'None') - for i = 1:nsess - gSF(SPM.Sess(i).row) = GM./mean(g(SPM.Sess(i).row)); - end - end - - %-Apply gSF to memory-mapped scalefactors to implement scaling - %----------------------------------------------------------------------- - for i = 1:q - SPM.xY.VY(i).pinfo(1:2,:) = SPM.xY.VY(i).pinfo(1:2,:)*gSF(i); - end - - %-place global variates in global structure - %----------------------------------------------------------------------- - SPM.xGX.rg = g; - SPM.xGX.GM = GM; - SPM.xGX.gSF = gSF; - - - %-Masking structure - %--------------------------------------------------------------- - SPM.xM = struct('T', ones(q,1),... - 'TH', g.*gSF,... - 'I', 0,... - 'VM', {[]},... - 'xs', struct('Masking','analysis threshold')); - - xsDes = struct(... - 'Global_calculation', SPM.xGX.sGXcalc,... - 'Grand_mean_scaling', SPM.xGX.sGMsca,... - 'Global_normalisation', SPM.xGX.iGXcalc); - - SPM.xsDes = mars_struct('ffillmerge',... - SPM.xsDes,... - xsDes); - - case 'filter' - % Get filter - if ~have_sess, return, end - - [Finter,Fgraph,CmdLine] = spm('FnUIsetup', 'FMRI model filter', 0); - - % TR if not set (it should be) - if ~mars_struct('isthere', SPM, 'xY', 'RT') - SPM.xY.RT = spm_input('Interscan interval {secs}','+1'); - end - SPM.xsDes.Interscan_interval = sprintf('%0.2f {s}',SPM.xY.RT); - - spm_input('High pass filter','+1','d',mfilename) - [SPM.xX.K SPM.xsDes.High_pass_Filter] = ... - pr_get_filter(SPM.xY.RT, SPM.Sess); - - case 'autocorr' - [Finter,Fgraph,CmdLine] = ... - spm('FnUIsetup','FMRI autocorrelation options',0); - - % Contruct Vi structure for non-sphericity ReML estimation - %=============================================================== - str = 'Correct for serial correlations?'; - cVi = {'none', 'SPM AR(0.2)','SPM AR (specify)', 'fmristat AR(n)'}; - cVi = spm_input(str,'+1','m',cVi, cVi); - - % create Vi struct - %----------------------------------------------------------------------- - vox_cov_possible = 0; - switch lower(cVi{1}) - - case 'fmristat ar(n)' - % Fit fmristat model AR(n) - %--------------------------------------------------------------- - cVi = spm_input('fmristat AR model order', '+1', 'e', 2); - SPM.xVi.Vi = struct('type', 'fmristat', 'order', cVi); - cVi = sprintf('fmristat AR(%d)',cVi); - f2cl = 'V'; % Field to CLear - - case 'spm ar (specify)' - % SPM AR coefficient(s) to be specified - %--------------------------------------------------------------- - cVi = spm_input('AR rho parameter(s)', '+1', 'e', 0.2); - SPM.xVi.Vi = pr_spm_ce(nscan,cVi); - cVi = sprintf('AR(%0.1f)',cVi(1)); - f2cl = 'V'; - vox_cov_possible = 1; - - case 'none' - % xVi.V is i.i.d - %--------------------------------------------------------------- - SPM.xVi.V = speye(sum(nscan)); - cVi = 'i.i.d'; - f2cl = 'Vi'; - - otherwise - % otherwise assume AR(0.2) in xVi.Vi - %--------------------------------------------------------------- - SPM.xVi.Vi = pr_spm_ce(nscan,0.2); - cVi = 'AR(0.2)'; - f2cl = 'V'; - vox_cov_possible = 1; - - end - - % If we've set V, need to clear Vi, because the - % estimate method takes the presence of Vi to mean that - % V can be cleared, with 'redo_covar' flag - % Conversely V needs to be cleared if Vi was estimated - if isfield(SPM.xVi, f2cl) - SPM.xVi = rmfield(SPM.xVi, f2cl); - if v_f, fprintf('Clearing previous %s matrix\n', f2cl); end - end - - % Also: remove previous W matrices - % Either will need to be recalculated or won't be used - if isfield(SPM.xX, 'W') - SPM.xX = rmfield(SPM.xX, 'W'); - if v_f, fprintf('Clearing previous W matrix\n'); end - end - - % Whether to average covariance estimates over voxels - SPM.xVi.cov_calc = 'summary'; - if vox_cov_possible - if spm_input('Use voxel data for covariance','+1','y/n', [1 0], 1); - SPM.xVi.cov_calc = 'vox'; - end - end - - % fill into design - SPM.xVi.form = cVi; - xsDes = struct('Serial_correlations', SPM.xVi.form); - SPM.xsDes = mars_struct('ffillmerge', SPM.xsDes, xsDes); - - otherwise - error(['Unpredictable: ' actions{a}]); - end -end - -% put stuff into object -D = des_struct(D,SPM); diff --git a/lib/marsbar-0.44/@mardo_2/fwhm.m b/lib/marsbar-0.44/@mardo_2/fwhm.m deleted file mode 100644 index 311eccc..0000000 --- a/lib/marsbar-0.44/@mardo_2/fwhm.m +++ /dev/null @@ -1,10 +0,0 @@ -function f = fwhm(o) -% method returns FWHM, or empty if not available -% -% $Id: tr.m,v 1.1 2004/01/26 22:08:55 matthewbrett Exp $ - -f = []; -SPM = des_struct(o); -if mars_struct('isthere', SPM, 'xVol', 'FWHM') - f = SPM.xVol.FWHM; -end diff --git a/lib/marsbar-0.44/@mardo_2/get_images.m b/lib/marsbar-0.44/@mardo_2/get_images.m deleted file mode 100644 index abf9922..0000000 --- a/lib/marsbar-0.44/@mardo_2/get_images.m +++ /dev/null @@ -1,8 +0,0 @@ -function VY = get_images(marsD) -% method to get image vols from design -% FORMAT VY = get_images(marsD) -% -% $Id$ - -D = des_struct(marsD); -VY = D.xY.VY; diff --git a/lib/marsbar-0.44/@mardo_2/has_autocorr.m b/lib/marsbar-0.44/@mardo_2/has_autocorr.m deleted file mode 100644 index b890dac..0000000 --- a/lib/marsbar-0.44/@mardo_2/has_autocorr.m +++ /dev/null @@ -1,10 +0,0 @@ -function tf = has_autocorr(o) -% returns 1 if object contains autocorrelation specification -% -% $Id$ - -tf = 0; -des = des_struct(o); -if isfield(des, 'xVi') - tf = isfield(des.xVi, 'Vi') | isfield(des.xVi, 'V'); -end diff --git a/lib/marsbar-0.44/@mardo_2/has_filter.m b/lib/marsbar-0.44/@mardo_2/has_filter.m deleted file mode 100644 index bdbd733..0000000 --- a/lib/marsbar-0.44/@mardo_2/has_filter.m +++ /dev/null @@ -1,10 +0,0 @@ -function tf = has_filter(o) -% returns 1 if object contains filter -% -% $Id$ - -tf = 0; -des = des_struct(o); -if isfield(des, 'xX') - tf = isfield(des.xX, 'K'); -end diff --git a/lib/marsbar-0.44/@mardo_2/has_images.m b/lib/marsbar-0.44/@mardo_2/has_images.m deleted file mode 100644 index 1277253..0000000 --- a/lib/marsbar-0.44/@mardo_2/has_images.m +++ /dev/null @@ -1,10 +0,0 @@ -function tf = has_images(o) -% returns 1 if design contains images -% -% $Id$ - -tf = 0; -des = des_struct(o); -if isfield(des, 'xY') - tf = isfield(des.xY, 'VY'); -end diff --git a/lib/marsbar-0.44/@mardo_2/has_whitener.m b/lib/marsbar-0.44/@mardo_2/has_whitener.m deleted file mode 100644 index f179ef8..0000000 --- a/lib/marsbar-0.44/@mardo_2/has_whitener.m +++ /dev/null @@ -1,10 +0,0 @@ -function tf = has_whitener(D) -% returns 1 if design has whitening filter -% -% $Id$ - -tf = 0; -SPM = des_struct(D); -if isfield(SPM, 'xX') - tf = isfield(SPM.xX, 'W'); -end diff --git a/lib/marsbar-0.44/@mardo_2/mardo_2.m b/lib/marsbar-0.44/@mardo_2/mardo_2.m deleted file mode 100644 index 01d8e83..0000000 --- a/lib/marsbar-0.44/@mardo_2/mardo_2.m +++ /dev/null @@ -1,123 +0,0 @@ -function [o, others] = mardo_2(params, others, varargin) -% class constructor for SPM2 MarsBaR design object -% FORMAT [o, others] = mardo_2(params, others, varargin) -% Inputs -% params - structure,containing fields, or SPM/MarsBaR design -% others - structure, containing other fields to define -% -% Outputs -% o - mardo_2 object (unless disowned) -% others - any unrecognized fields from params, for processing by -% children -% -% This object is called from the mardo object contructor -% with a mardo object as input. mardo_2 checks to see -% if the contained design is an SPM2 design, returns -% the object unchanged if not. If it is an SPM2 -% design, it claims ownership of the passed object. -% -% Note the third argument. If this call is a call as a constructor (i.e -% not an action string call), this can be the 'child_pass_f', which is 1 -% if this call is from a child, passing a mardo object to be handled by -% the mardo_2 class. In this case we just accept this design is for us, -% and don't do any SPM2 specific processing -% -% The constructor can also be called to give class functions, where the -% name of the class function is a character string which is one of: -% 'spm_filter' - applies spm_filter routine to passed args -% -% $Id$ - -myclass = 'mardo_2'; -cvs_v = marsbar('ver'); % was CVS version; now marsbar version - -% Default object structure -defstruct = []; - -if nargin < 1 - defstruct.cvs_version = cvs_v; - o = class(defstruct, myclass, mardo); - others = []; - return -end -if nargin < 2 - others = []; -end -if nargin < 3 - arg3 = 0; -else - arg3 = varargin{1}; -end - -% parse out string action calls (class functions) -if ischar(params) - switch params - case 'spm_filter' - if nargin < 2 - error('Need filter'); - elseif nargin < 3 - o = pr_spm_filter(others); - else - o = pr_spm_filter(others, arg3); - end - return - otherwise - error(sprintf('Is "%s" a filename? Use ``mardo`` to load from files',... - params)); - end -end - -% Deal with passed objects of this (or child) class -if isa(params, myclass) - o = params; - % Check for simple form of call - if isempty(others), return, end - - % Otherwise, we are being asked to set fields of object - % (Moot at the moment, as there are no fields specific for this object) - [p others] = mars_struct('split', others, defstruct); - return -end - -% Set child_pass_f -child_pass_f = arg3; - -% normal call is via mardo constructor -if isa(params, 'mardo') - % Check to see if this is a suitable design, return if not - des = des_struct(params); - if ~arg3 & ~my_design(des), o = params; return, end - % own - if isfield(des, 'SPM') - des = des.SPM; - end - uo = des_struct(params, des); - params = []; -else - uo = []; -end - -if ~isa(uo, 'mardo') % mardo object not passed - % umbrella object, parse out fields for (this object and children) - % third argument of 0 prevents recursive call back to here - [uo, params] = mardo(params, others, 0); -else - % fill params with other parameters - params = mars_struct('ffillmerge', params, others); -end - -% parse parameters into those for this object, children -[params, others] = mars_struct('ffillsplit', defstruct, params); - -% add cvs tag -params.cvs_version = cvs_v; - -% set the mardo object -o = class(params, myclass, uo); - -% convert vols to current format, if not passed from a child -if ~child_pass_f - o = convert_vols(o); -end - -return diff --git a/lib/marsbar-0.44/@mardo_2/mardo_99.m b/lib/marsbar-0.44/@mardo_2/mardo_99.m deleted file mode 100644 index 60cca6f..0000000 --- a/lib/marsbar-0.44/@mardo_2/mardo_99.m +++ /dev/null @@ -1,105 +0,0 @@ -function o = mardo_99(o) -% method to convert SPM2 design to SPM99 design -% -% The conversion is crude, and only transfers those fields -% known to be of use in MarsBaR estimation -% -% $Id$ - -% Process design -params = paramfields(o); -des = params.des_struct; - -% Transfer images, if present -if isfield(des,'xY') - des = mars_struct('merge', des, ... - mars_struct('split', des.xY, {'VY', 'RT'})); - des = rmfield(des, 'xY'); -end - -% move names -des.xX.Xnames = des.xX.name; - -% Strip unused fields -des.xX = mars_struct('strip', des.xX, {'W', 'name'}); - -% convert sessions (sort of) -if isfield(des, 'Sess') - S = des.Sess; - % get basis function stuff - BFstr = des.xBF.name; - bf = des.xBF.bf; - des.xX.dt = des.xBF.dt; - for s = 1:length(S) - Ss = S(s); - nconds = length(Ss.U); - % Rows, cols - S2{s}.row = Ss.row; - S2{s}.col = Ss.col; - % Set basis functions - S2{s}.BFstr = BFstr; - S2{s}.DSstr = 'Variable SOA '; - % Other comparable stuff - for t = 1:nconds - S2{s}.name(t) = Ss.U(t).name; - S2{s}.ons{t} = Ss.U(t).ons; - S2{s}.pst{t} = Ss.U(t).pst; - S2{s}.sf{t} = Ss.U(t).u(33:end,:); - S2{s}.ind{t} = Ss.Fc(t).i; - S2{s}.bf{t} = bf; - % Parametric modulation - if Ss.U(t).P.h - S2{s}.Pname{t} = Ss.U(t).P.name; - S2{s}.Pv{t} = Ss.U(t).P.P; - else - S2{s}.Pname{t} = ''; - S2{s}.Pv{t} = []; - end - end - % Not sensibly set stuff - S2{s}.rep = 0; - end - des.Sess = S2; -end - -% Remove basis function field -des = mars_struct('strip', des, {'xBF'}); - -% covariance priors -if isfield(des,'xVi') - fprintf('Removing SPM2 non-sphericity information\n'); - rmfield(des,'xVi'); -end - -% convert filter structure -if isfield(des.xX, 'K') - K = des.xX.K; - if isstruct(K) - def_filt = struct('RT',0,... - 'row',[],... - 'LChoice','none',... - 'LParam', 0,... - 'HChoice','specify',... - 'HParam',0); - for k = 1:length(K) - % split off useful fields - K2{k} = mars_struct('splitmerge',K(k),def_filt); - end - elseif K == 1 - K2 = eye(size(des.xX,1)); - else - K2 = K; - end - des.xX.K = K2; -end - -% Default F contrast field -des.F_iX0 = struct('iX0', [des.xX.iB des.xX.iG], ... - 'name', 'effects of interest'); - -% Need to identify as SPM99 design -des.SPMid = ['SPM99: Results imported from SPM2 design: ' des.SPMid]; - -% put into parent object -params.des_struct = des; -o = mardo_99(params); diff --git a/lib/marsbar-0.44/@mardo_2/mars_spm_graph.m b/lib/marsbar-0.44/@mardo_2/mars_spm_graph.m deleted file mode 100644 index 9017f5e..0000000 --- a/lib/marsbar-0.44/@mardo_2/mars_spm_graph.m +++ /dev/null @@ -1,591 +0,0 @@ -function [r_st,marsD,changef] = mars_spm_graph(marsD,rno,Ic) -% Graphical display of adjusted data -% FORMAT [r_st,marsD,changef] = mars_spm_graph(marsD,rno,Ic) -% -% marsD - SPM design object -% required fields in des_struct are: -% xX - Design Matrix structure -% - (see spm_spm.m for structure) -% betas - the betas! -% ResidualMS - the residual mean square -% xCon - contrast definitions -% - required fields are: -% .c - contrast vector/matrix -% (see spm_FcUtil.m for details of contrast structure... ) -% marsY - MarsBaR data object -% -% rno - region number (index for marsD.marsY) -% Ic - contrast number (optional) -% -% Returns -% r_st - return structure, with fields -% Y - fitted data for the selected voxel -% y - adjusted data for the selected voxel -% beta - parameter estimates -% Bcov - covariance of parameter estimates -% cbeta = betas multiplied by contrast -% marsD - design structure, with possibly added contrasts -% changef - set to 1 if design has changed -% -% see spm2 version of spm_graph for details -%_______________________________________________________________________ -% @(#)spm_graph.m 2.43 Karl Friston 03/12/19 -% -% $Id$ - -if ~is_mars_estimated(marsD) - error('Need estimated design for plot'); -end -if nargin < 2 - rno = []; -end -if nargin < 3 - Ic = []; -end -changef = 0; - -% make values ready for return -def_r_st = struct(... - 'Y', [],... - 'y', [],... - 'beta', [],... - 'SE', [],... - 'cbeta',[], ... - 'PSTH',[]); -cbeta = []; PSTH = []; - -% get stuff from object -SPM = des_struct(marsD); -xCon = SPM.xCon; - -% Check if we want to, and can, assume region no is 1 -if isempty(rno) - if n_regions(SPM.marsY) > 1 - error('Need to specify region number'); - end - rno = 1; -end - -% Get required data and filter -sY = summary_data(SPM.marsY); -y = apply_filter(marsD, sY(:, rno)); - -% Get design matrix for convenience -xX = SPM.xX; - -% Label for region -XYZstr = region_name(SPM.marsY, rno); -XYZstr = XYZstr{1}; - -%-Get parameter estimates, ResidualMS, (compute) fitted data & residuals -%======================================================================= - -%-Parameter estimates: beta = xX.pKX*xX.K*y; -%----------------------------------------------------------------------- -beta = SPM.betas(:, rno); - -%-Residual mean square: ResidualMS = sum(R.^2)/xX.trRV; -%----------------------------------------------------------------------- -ResidualMS = SPM.ResidualMS(rno); -Bcov = ResidualMS*SPM.xX.Bcov; - -%-Get Graphics figure handle -%----------------------------------------------------------------------- -Fgraph = spm_figure('GetWin','Graphics'); - - -%-Delete previous axis and their pagination controls (if any) -%----------------------------------------------------------------------- -spm_results_ui('Clear',Fgraph,2); - -%-Compute residuals -%----------------------------------------------------------------------- -if isempty(y) - - % make R = NaN so it will not be plotted - %--------------------------------------------------------------- - R = NaN*ones(size(SPM.xX.X,1),1); - -else - % residuals (non-whitened) - %--------------------------------------------------------------- - R = spm_sp('r',SPM.xX.xKXs,y); - -end - -%-Get parameter and hyperparameter estimates -%======================================================================= -%-Parameter estimates: beta = xX.pKX*xX.K*y; -%-Residual mean square: ResidualMS = sum(R.^2)/xX.trRV -%--------------------------------------------------------------- - -P05_Z = 1.6449; % = spm_invNcdf(1 - 0.05); -CI = P05_Z; - -%-Colour specifications and index; -%----------------------------------------------------------------------- -Col = [0 0 0; .8 .8 .8; 1 .5 .5]; - -%-Plot -%======================================================================= - -% find out what to plot -%----------------------------------------------------------------------- -Cplot = { 'Contrast estimates and 90% C.I.',... - 'Fitted responses',... - 'Event-related responses',... - 'Parametric responses',... - 'Volterra Kernels'}; - - -% ensure options are appropriate -%----------------------------------------------------------------------- -try - Sess = SPM.Sess; -catch - Cplot = Cplot(1:2); -end -Cplot = Cplot{spm_input('Plot',-1,'m',Cplot)}; - -switch Cplot - -% select contrast if -%---------------------------------------------------------------------- -case {'Contrast estimates and 90% C.I.','Fitted responses'} - - if isempty(Ic) - % determine which contrast - %--------------------------------------------------------------- - [Ic marsD changef] = ui_get_contrasts(... - marsD, 'T|F',1, 'Select contrast...', ' for plot', 1); - if changef, SPM.xCon = get_contrasts(marsD); end - end - TITLE = {Cplot SPM.xCon(Ic).name}; - -% select session and trial if -%---------------------------------------------------------------------- -case {'Event-related responses','Parametric responses','Volterra Kernels'} - - % get session - %-------------------------------------------------------------- - s = length(Sess); - if s > 1 - s = spm_input('which session','+1','n1',1,s); - end - - % effect names - %-------------------------------------------------------------- - switch Cplot - case 'Volterra Kernels' - u = length(Sess(s).Fc); - otherwise - u = length(Sess(s).U); - end - Uname = {}; - for i = 1:u - Uname{i} = Sess(s).Fc(i).name; - end - - % get effect - %-------------------------------------------------------------- - str = sprintf('which effect'); - u = spm_input(str,'+1','m',Uname); - - % bin size - %-------------------------------------------------------------- - dt = SPM.xBF.dt; - -end - -switch Cplot - -% plot parameter estimates -%---------------------------------------------------------------------- -case 'Contrast estimates and 90% C.I.' - - % compute contrast of parameter estimates and 90% C.I. - %-------------------------------------------------------------- - cbeta = SPM.xCon(Ic).c'*beta; - CI = CI*sqrt(diag(SPM.xCon(Ic).c'*Bcov*SPM.xCon(Ic).c)); - - % bar chart - %-------------------------------------------------------------- - figure(Fgraph) - subplot(2,1,2) - cla - hold on - - % estimates - %-------------------------------------------------------------- - h = bar(cbeta); - set(h,'FaceColor',Col(2,:)) - - % standard error - %-------------------------------------------------------------- - for j = 1:length(cbeta) - line([j j],([CI(j) 0 - CI(j)] + cbeta(j)),... - 'LineWidth',6,'Color',Col(3,:)) - end - - title(TITLE,'FontSize',12) - xlabel('contrast') - ylabel(['contrast estimate',XYZstr]) - set(gca,'XLim',[0.4 (length(cbeta) + 0.6)]) - hold off - - % set Y to empty so outputs are assigned - %------------------------------------------------------------- - Y = []; - -% all fitted effects or selected effects -%----------------------------------------------------------------------- -case 'Fitted responses' - - % predicted or adjusted response - %--------------------------------------------------------------- - str = 'predicted or adjusted response?'; - if spm_input(str,'!+1','b',{'predicted','adjusted'},[1 0]); - - % fitted (predicted) data (Y = X1*beta) - %-------------------------------------------------------- - Y = SPM.xX.X*SPM.xCon(Ic).c*pinv(SPM.xCon(Ic).c)*beta; - else - - % fitted (corrected) data (Y = X1o*beta) - %------------------------------------------------------- - Y = spm_FcUtil('Yc',SPM.xCon(Ic),SPM.xX.xKXs,beta); - - end - - % adjusted data - %--------------------------------------------------------------- - y = Y + R; - - % get ordinates - %--------------------------------------------------------------- - Xplot = { 'an explanatory variable',... - 'scan or time',... - 'a user specified ordinate'}; - Cx = spm_input('plot against','!+1','m',Xplot); - - % an explanatory variable - %--------------------------------------------------------------- - if Cx == 1 - - str = 'Which explanatory variable?'; - i = spm_input(str,'!+1','m',SPM.xX.name); - x = SPM.xX.xKXs.X(:,i); - XLAB = SPM.xX.name{i}; - - % scan or time - %--------------------------------------------------------------- - elseif Cx == 2 - - if isfield(SPM.xY,'RT') - x = SPM.xY.RT*[1:size(Y,1)]'; - XLAB = 'time {seconds}'; - else - x = [1:size(Y,1)]'; - XLAB = 'scan number'; - end - - % user specified - %--------------------------------------------------------------- - elseif Cx == 3 - - x = spm_input('enter ordinate','!+1','e','',size(Y,1)); - XLAB = 'ordinate'; - - end - - % plot - %--------------------------------------------------------------- - figure(Fgraph) - subplot(2,1,2) - cla - hold on - [p q] = sort(x); - if all(diff(x(q))) - plot(x(q),Y(q),'LineWidth',4,'Color',Col(2,:)); - plot(x(q),y(q),':','Color',Col(1,:)); - plot(x(q),y(q),'.','MarkerSize',8, 'Color',Col(3,:)); - - else - plot(x(q),Y(q),'.','MarkerSize',16,'Color',Col(1,:)); - plot(x(q),y(q),'.','MarkerSize',8, 'Color',Col(2,:)); - xlim = get(gca,'XLim'); - xlim = [-1 1]*diff(xlim)/4 + xlim; - set(gca,'XLim',xlim) - - end - title(TITLE,'FontSize',12) - xlabel(XLAB) - ylabel(['response',XYZstr]) - legend('fitted','plus error') - hold off - -% modeling evoked responses based on Sess -%---------------------------------------------------------------------- -case 'Event-related responses' - - % get plot type - %-------------------------------------------------------------- - Rplot = { 'fitted response and PSTH',... - 'fitted response and 90% C.I.',... - 'fitted response and adjusted data'}; - - if isempty(y) - TITLE = Rplot{2}; - else - TITLE = Rplot{spm_input('plot in terms of','+1','m',Rplot)}; - end - - % plot - %-------------------------------------------------------------- - switch TITLE - case 'fitted response and PSTH' - - - % build a simple FIR model subpartition (X); bin size = TR - %------------------------------------------------------ - str = 'bin size (secs)'; - BIN = sprintf('%0.2f',SPM.xY.RT); - BIN = spm_input(str,'!+1','r',BIN); - xBF = SPM.xBF; - U = Sess(s).U(u); - U.u = U.u(:,1); - xBF.name = 'Finite Impulse Response'; - xBF.order = round(32/BIN); - xBF.length = xBF.order*BIN; - xBF = pr_spm_get_bf(xBF); - BIN = xBF.length/xBF.order; - X = pr_spm_volterra(U,xBF.bf,1); - k = SPM.nscan(s); - X = X([0:(k - 1)]*SPM.xBF.T + SPM.xBF.T0 + 32,:); - - % place X in SPM.xX.X - %------------------------------------------------------ - jX = Sess(s).row; - iX = Sess(s).col(Sess(s).Fc(u).i); - iX0 = [1:size(SPM.xX.X,2)]; - iX0(iX) = []; - X = [X SPM.xX.X(jX,iX0)]; - X = SPM.xX.W(jX,jX)*X; - X = [X SPM.xX.K(s).X0]; - - % Re-estimate to get PSTH and CI - %------------------------------------------------------ - j = xBF.order; - xX = spm_sp('Set',X); - pX = spm_sp('x-',xX); - PSTH = pX*y(jX); - res = spm_sp('r',xX,y(jX)); - df = size(X,1) - size(X,2); - bcov = pX*pX'*sum(res.^2)/df; - PSTH = PSTH(1:j)/dt; - PST = [1:j]*BIN - BIN/2; - PCI = CI*sqrt(diag(bcov(1:j,(1:j))))/dt; - end - - % basis functions and parameters - %-------------------------------------------------------------- - X = SPM.xBF.bf/dt; - x = ([1:size(X,1)] - 1)*dt; - j = Sess(s).col(Sess(s).Fc(u).i(1:size(X,2))); - B = beta(j); - - % fitted responses with standard error - %-------------------------------------------------------------- - Y = X*B; - CI = CI*sqrt(diag(X*Bcov(j,j)*X')); - - % peristimulus times and adjusted data (y = Y + R) - %-------------------------------------------------------------- - pst = Sess(s).U(u).pst; - bin = round(pst/dt); - q = find((bin >= 0) & (bin < size(X,1))); - y = R(Sess(s).row(:)); - pst = pst(q); - y = y(q) + Y(bin(q) + 1); - - % plot - %-------------------------------------------------------------- - figure(Fgraph) - subplot(2,1,2) - hold on - switch TITLE - - case 'fitted response and PSTH' - %------------------------------------------------------ - errorbar(PST,PSTH,PCI) - plot(PST,PSTH,'LineWidth',4,'Color',Col(2,:)) - plot(x,Y,'-.','Color',Col(3,:)) - - case 'fitted response and 90% C.I.' - %------------------------------------------------------ - plot(x,Y,'Color',Col(2,:),'LineWidth',4) - plot(x,Y + CI,'-.',x,Y - CI,'-.','Color',Col(1,:)) - - case 'fitted response and adjusted data' - %------------------------------------------------------ - plot(x,Y,'Color',Col(2,:),'LineWidth',4) - plot(pst,y,'.','Color',Col(3,:)) - - end - - % label - %------------------------------------------------------------- - [i j] = max(Y); - text(ceil(1.1*x(j)),i,Sess(s).Fc(u).name,'FontSize',8); - title(TITLE,'FontSize',12) - xlabel('peristimulus time {secs}') - ylabel(['response',XYZstr]) - hold off - - -% modeling evoked responses based on Sess -%---------------------------------------------------------------------- -case 'Parametric responses' - - - % return gracefully if no parameters - %-------------------------------------------------------------- - if ~Sess(s).U(u).P(1).h, return, end - - % basis functions - %-------------------------------------------------------------- - bf = SPM.xBF.bf; - pst = ([1:size(bf,1)] - 1)*dt; - - % orthogonalised expansion of parameteric variable - %-------------------------------------------------------------- - str = 'which parameter'; - p = spm_input(str,'+1','m',{Sess(s).U(u).P.name}); - P = Sess(s).U(u).P(p).P; - q = []; - for i = 0:Sess(s).U(u).P(p).h; - q = [q spm_en(P).^i]; - end - q = spm_orth(q); - - - % parameter estimates for this effect - %-------------------------------------------------------------- - j = Sess(s).col(Sess(s).Fc(u).i); - B = beta(j); - - % reconstruct trial-specific responses - %-------------------------------------------------------------- - Y = zeros(size(bf,1),size(q,1)); - uj = Sess(s).U(u).P(p).i; - for i = 1:size(P,1) - U = sparse(1,uj,q(i,:),1,size(Sess(s).U(u).u,2)); - X = kron(U,bf); - Y(:,i) = X*B; - end - [P j] = sort(P); - Y = Y(:,j); - - % plot - %-------------------------------------------------------------- - figure(Fgraph) - subplot(2,2,3) - surf(pst,P,Y') - shading flat - title(Sess(s).U(u).name{1},'FontSize',12) - xlabel('PST {secs}') - ylabel(Sess(s).U(u).P(p).name) - zlabel(['responses',XYZstr]) - axis square - - % plot - %-------------------------------------------------------------- - subplot(2,2,4) - [j i] = max(mean(Y,2)); - plot(P,Y(i,:),'LineWidth',4,'Color',Col(2,:)) - str = sprintf('response at %0.1fs',i*dt); - title(str,'FontSize',12) - xlabel(Sess(s).U(u).P(p).name) - axis square - grid on - - -% modeling evoked responses based on Sess -%---------------------------------------------------------------------- -case 'Volterra Kernels' - - % Parameter estimates and basis functions - %------------------------------------------------------ - bf = SPM.xBF.bf/dt; - pst = ([1:size(bf,1)] - 1)*dt; - - % second order kernel - %-------------------------------------------------------------- - if u > length(Sess(s).U) - - % Parameter estimates and kernel - %------------------------------------------------------ - j = Sess(s).col(Sess(s).Fc(u).i); - B = beta(j); - i = 1; - Y = 0; - for p = 1:size(bf,2) - for q = 1:size(bf,2) - Y = Y + B(i)*bf(:,p)*bf(:,q)'; - i = i + 1; - end - end - - % plot - %------------------------------------------------------ - figure(Fgraph) - subplot(2,2,3) - imagesc(pst,pst,Y) - axis xy - axis image - - title('2nd order Kernel','FontSize',12); - xlabel('perstimulus time {secs}') - ylabel('perstimulus time {secs}') - - subplot(2,2,4) - plot(pst,Y) - axis square - grid on - - title(Sess(s).Fc(u).name,'FontSize',12); - xlabel('perstimulus time {secs}') - - - % first order kernel - %-------------------------------------------------------------- - else - j = Sess(s).col(Sess(s).Fc(u).i(1:size(bf,2))); - B = beta(j); - Y = bf*B; - - % plot - %------------------------------------------------------ - figure(Fgraph) - subplot(2,1,2) - plot(pst,Y) - grid on - axis square - - title({'1st order Volterra Kernel' Sess(s).Fc(u).name},... - 'FontSize',12); - xlabel('perstimulus time {secs}') - ylabel(['impluse response',XYZstr]) - end - -end - - -%-call Plot UI -%---------------------------------------------------------------------- -spm_results_ui('PlotUi',gca) - -% Complete return values -r_st = mars_struct('fillafromb', def_r_st, struct(... - 'Y', Y, 'y', y, 'beta', beta, 'Bcov', Bcov, ... - 'cbeta', cbeta, 'PSTH', PSTH)); diff --git a/lib/marsbar-0.44/@mardo_2/modality.m b/lib/marsbar-0.44/@mardo_2/modality.m deleted file mode 100644 index b4b7a05..0000000 --- a/lib/marsbar-0.44/@mardo_2/modality.m +++ /dev/null @@ -1,12 +0,0 @@ -function mod_str = modality(D) -% method returns modality of design -% -% $Id$ - -SPM = des_struct(D); -try - SPM.Sess(1); - mod_str = 'fmri'; -catch - mod_str = 'pet'; -end diff --git a/lib/marsbar-0.44/@mardo_2/private/my_design.m b/lib/marsbar-0.44/@mardo_2/private/my_design.m deleted file mode 100644 index 96abe80..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/my_design.m +++ /dev/null @@ -1,10 +0,0 @@ -function tf = my_design(des) -% returns 1 if design looks like it is of SPM99 type -% -% $Id$ - -tf = 0; -if isfield(des, 'SPM'), des = des.SPM; end -if isfield(des, 'SPMid') - tf = ~isempty(strmatch('SPM2', des.SPMid)); -end diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_estimate.m b/lib/marsbar-0.44/@mardo_2/private/pr_estimate.m deleted file mode 100644 index aeddcd0..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_estimate.m +++ /dev/null @@ -1,399 +0,0 @@ -function SPM = pr_estimate(SPM, marsY) -% Estimation of a General Linear Model -% FORMAT SPM = pr_estimate(SPM, marsY) -% Inputs -% SPM - SPM design structure -% marsY - marsY data object, or 2D data (Y) matrix -% -% Outputs -% SPM - modified estimated design structure, with data contained as -% field marsY -% -% Based on spm_spm from spm2: -% @(#)spm_spm.m 2.66 Andrew Holmes, Jean-Baptiste Poline, Karl Friston 03/03/27 -% -% There are some changes in this version -% 1) The specified Vi field, can contain either -% a cell array, in which case it is standard SPM covariance components, -% or a struct array, in which case it can specify other methods of -% estimating the covariance, in particular, real AR(n) estimation -% -% 2) The design will specify if the covariance should be calculated from -% the summarized time course(s), or from the component voxels, then -% averaged. Voxel time courses are used by default, and if -% SPM.xVi.cov_calc is set to 'vox', but summary time -% courses can be used by setting SPM.xVi.cov_calc to 'summary'. -% -% 3) Normally, if the W matrix is present, the V matrix should also be -% present. Because it is boring to calculate the V matrix and then WVW, -% if we know WVW is I, V can be present, but empty, in which case WVW is -% assumed to be I. It just saves time. -% -% $Id$ - -%-Say hello -%----------------------------------------------------------------------- -Finter = spm('FigName','Stats: estimation...'); spm('Pointer','Watch') - -%======================================================================= -% - A N A L Y S I S P R E L I M I N A R I E S -%======================================================================= - -%-Initialise -%======================================================================= -fprintf('%-40s: %30s','Initialising parameters','...computing') %-# -xX = SPM.xX; -[nScan nBeta] = size(xX.X); - -%-Check confounds (xX.K) and non-sphericity (xVi) -%----------------------------------------------------------------------- -if ~isfield(xX,'K') - xX.K = 1; -end -try - %-If covariance components are specified use them - %--------------------------------------------------------------- - xVi = SPM.xVi; -catch - - %-otherwise assume i.i.d. - %--------------------------------------------------------------- - xVi = struct( 'form', 'i.i.d.',... - 'V', speye(nScan,nScan)); - -end - -% Work out what we are going to do -have_W = isfield(xX, 'W'); -have_V = isfield(xVi, 'V'); - -% Work out type of covariance modelling. We get Vi, cov_type (as a string): -% one of 'SPM' or 'fmristat' and cov_vox, which is a flag set to 1 if all -% the voxel time courses should be used to calculate the resdiduals and -% covariance. -if ~have_V - if ~isfield(xVi, 'Vi') - error('No covariance specified, and no priors to calculate it'); - end - Vi = xVi.Vi; - if iscell(Vi) - cov_type = 'SPM'; - elseif ~isstruct(Vi) - error('Vi field should be cell or struct type') - elseif ~isfield(Vi, 'type') - error('Vi should have field specifying type'); - else - cov_type = Vi.type; - end - - % Covariance calculated on summary or voxel time courses - cov_vox = 1; - if isfield(xVi, 'cov_calc') - cov_vox = strcmpi(xVi.cov_calc, 'vox'); - end -else cov_vox = 0; end - -%-Get non-sphericity V -%======================================================================= -if have_V - %-If xVi.V is specified proceed directly to parameter estimation - %--------------------------------------------------------------- - V = xVi.V; - str = 'parameter estimation'; -else - % otherwise invoke ReML selecting voxels under i.i.d assumptions - %--------------------------------------------------------------- - V = speye(nScan,nScan); - str = '[hyper]parameter estimation'; -end - -%-Get whitening/Weighting matrix: If xX.W exists we will save WLS -% estimates. Get WVW also, which can be assumed if W is a whitening -% matrix -%----------------------------------------------------------------------- -if have_W - %-If W is specified, use it - %------------------------------------------------------- - W = xX.W; - if isempty(V) % V is only inv(W*W') - WVW = eye(nScan); - else - WVW = W*V*W'; - end -else - if have_V - % otherwise make W a whitening filter W*W' = inv(V) - %------------------------------------------------------- - [u s] = pr_spm_svd(xVi.V); - s = spdiags(1./sqrt(diag(s)),0,nScan,nScan); - W = u*s*u'; - W = W.*(abs(W) > 1e-6); - xX.W = W; - WVW = eye(nScan); - else - % unless xVi.V has not been estimated - requiring 2 passes - %------------------------------------------------------- - W = eye(nScan); - str = 'hyperparameter estimation (1st pass)'; - end -end - -%-Design space and projector matrix [pseudoinverse] for WLS -%======================================================================= -xX.xKXs = spm_sp('Set',pr_spm_filter(xX.K,W*xX.X)); % KWX -xX.pKX = spm_sp('x-',xX.xKXs); % projector - -%-If xVi.V is not defined compute Hsqr -%----------------------------------------------------------------------- -if ~isfield(xVi,'V') - Fcname = 'effects of interest'; - iX0 = [SPM.xX.iB SPM.xX.iG]; - xCon = spm_FcUtil('Set',Fcname,'F','iX0',iX0,xX.xKXs); - X1o = spm_FcUtil('X1o', xCon(1),xX.xKXs); - Hsqr = spm_FcUtil('Hsqr',xCon(1),xX.xKXs); - trRV = spm_SpUtil('trRV',xX.xKXs); - trMV = spm_SpUtil('trMV',X1o); -end - -fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-# - -%======================================================================= -% - F I T M O D E L & W R I T E P A R A M E T E R I M A G E S -%======================================================================= - -% Select whether to work with all voxel data in ROIs, or summary data -% Using all data only makes sense for intial estimation of whitening -if ~have_W & cov_vox - str = 'voxelwise'; - Y = region_data(marsY); - Y = [Y{:}]; -else - str = 'pooled'; - Y = summary_data(marsY); -end - -% Eliminate columns with zero variance -in_cols = any(diff(Y)); -if ~any(in_cols), error('No variance to estimate model'); end -Y = Y(:, in_cols); - -fprintf('%-40s: %30s\n','Covariance estimate',['...' str]) %-# -fprintf('%-40s: %30s','Model','...start') %-# - -n_roi = n_regions(marsY); - -%-Intialise variables used in the loop -%======================================================================= -[n S] = size(Y); % no of time courses -Cy = 0; % spatially whitened -CY = 0; % for ReML -EY = 0; % for ReML -%-Whiten/Weight data and remove filter confounds -%------------------------------------------------------- -fprintf('%s%30s',repmat(sprintf('\b'),1,30),'filtering') %-# - -KWY = pr_spm_filter(xX.K,W*Y); - -%-General linear model: Weighted least squares estimation -%------------------------------------------------------ -fprintf('%s%30s',repmat(sprintf('\b'),1,30),'estimation') %-# - -beta = xX.pKX*KWY; %-Parameter estimates -res = spm_sp('r',xX.xKXs,KWY); %-Residuals -ResSS = sum(res.^2); %-Residual SSQ -clear KWY %-Clear to save memory - - -%-If ReML hyperparameters are needed for xVi.V -%------------------------------------------------------- -if ~have_V - if n_roi > 1 - wstr = {'Pooling covariance estimate across ROIs',... - 'This is unlikely to be valid; A better approach',... - 'is to run estimation separately for each ROI'}; - fprintf('\n'); - warning(sprintf('%s\n', wstr{:})); - end - % Cy is whitened covariance matrix; only needed for SPM REML method - if strcmp(cov_type, 'SPM') - q = diag(sqrt(trRV./ResSS'),0); % spatial whitening - Y = Y * q; - Cy = Y*Y'; - end -end % have_V - -%-if we are saving the WLS parameters -%------------------------------------------------------- -if have_W - - %-sample covariance and mean of Y (all voxels) - %----------------------------------------------- - CY = Y*Y'; - EY = sum(Y,2); - -end % have_W -clear Y %-Clear to save memory - -fprintf('\n') %-# -spm_progress_bar('Clear') - -%======================================================================= -% - P O S T E S T I M A T I O N C L E A N U P -%======================================================================= -if S == 0, warning('No time courses - empty analysis!'), end - -%-average sample covariance and mean of Y (over voxels) -%----------------------------------------------------------------------- -CY = CY/S; -EY = EY/S; -CY = CY - EY*EY'; - -%-If not defined, compute non-sphericity V using ReML Hyperparameters -%======================================================================= -if ~have_V - - %-Estimate of residual correlations through hyperparameters - %--------------------------------------------------------------- - str = 'Temporal non-sphericity (over voxels)'; - fprintf('%-40s: %30s\n',str,'...estimation') %-# - Cy = Cy/S; - - % Estimate for separable designs and covariance components - %--------------------------------------------------------------- - if isstruct(xX.K) - - switch cov_type - case 'SPM' - % Store hyperparameters - m = length(Vi); - h = zeros(m,1); - case 'fmristat' - % Store AR coefficients - h = zeros(length(xX.K), Vi.order); - otherwise - error(['Did not recognize covariance type: ' cov_type]); - end - - V = sparse(nScan,nScan); - for i = 1:length(xX.K) - - % extract blocks from bases - %----------------------------------------------- - q = xX.K(i).row; - - % design space for estimation (with confounds in filter) - %----------------------------------------------- - Xp = xX.X(q,:); - try - Xp = [Xp xX.K(i).X0]; - end - - switch cov_type - case 'SPM' - % REML: extract blocks from bases - %----------------------------------------------- - p = []; - Qp = {}; - for j = 1:m - if nnz(xVi.Vi{j}(q,q)) - Qp{end + 1} = xVi.Vi{j}(q,q); - p = [p j]; - end - end - - % ReML itself - %----------------------------------------------- - fprintf('%-30s- %i\n',' ReML Block',i); - [Vp,hp] = pr_spm_reml(Cy(q,q),Xp,Qp); - V(q,q) = V(q,q) + Vp; - h(p) = hp; - - case 'fmristat' - % AR estimation - [h(i,:) W(q,q)] = pr_fmristat_ar(res(q,:),Xp,Vi.order); - - end - end - else - [V,h] = pr_spm_reml(Cy,xX.X,xVi.Vi); - end - - switch cov_type - case 'SPM' - % normalize non-sphericity and save hyperparameters - %--------------------------------------------------------------- - V = V*nScan/trace(V); - case 'fmristat' - % Set covariance matrix to empty, we have already calculated W - %--------------------------------------------------------------- - V = []; - SPM.xX.W = W; - end - - xVi.h = h; - xVi.V = V; % Save non-sphericity xVi.V - xVi.Cy = Cy; %-spatially whitened - SPM.xVi = xVi; % non-sphericity structure - - % If xX.W is not specified use W*W' = inv(V) to give ML estimators - %--------------------------------------------------------------- - if ~have_W - % clear everything except SPM, marsY; - vnames = who; - vnames = vnames(~ismember(vnames, {'SPM','marsY'})); - clear(vnames{:}); - SPM = pr_estimate(SPM,marsY); - return - end -end - - -%-Use non-sphericity xVi.V to compute [effective] degrees of freedom -%======================================================================= -xX.V = pr_spm_filter(xX.K,pr_spm_filter(xX.K,WVW)'); % KWVW'K' -[trRV trRVRV] = spm_SpUtil('trRV',xX.xKXs,xX.V); % trRV (for X) -xX.trRV = trRV; % -xX.trRVRV = trRVRV; %-Satterthwaite -xX.erdf = trRV^2/trRVRV; % approximation -xX.Bcov = xX.pKX*xX.V*xX.pKX'; % Cov(beta) - - -%-scale ResSS by 1/trRV -%----------------------------------------------------------------------- -ResMS = ResSS/xX.trRV; - -%-Create 1st contrast for 'effects of interest' (all if not specified) -%======================================================================= -Fcname = 'effects of interest'; -try - iX0 = [xX.iB xX.iG]; -catch - iX0 = []; -end -xCon = spm_FcUtil('Set',Fcname,'F','iX0',iX0,xX.xKXs); - -%-Compute scaled design matrix for display purposes -%----------------------------------------------------------------------- -xX.nKX = spm_DesMtx('sca',xX.xKXs.X,xX.name); - -%-place fields in SPM -%----------------------------------------------------------------------- -SPM.betas = ones(nBeta, n_roi) + NaN; -SPM.betas(:, in_cols) = beta; -SPM.ResidualMS = ones(1, n_roi) + NaN; -SPM.ResidualMS(in_cols) = ResMS; - -SPM.xVi = xVi; % non-sphericity structure -SPM.xVi.CY = CY; %-<(Y - )*(Y - )'> - -SPM.xX = xX; %-design structure - -SPM.xCon = xCon; %-contrast structure - -%======================================================================= -%- E N D: Cleanup GUI -%======================================================================= -fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-# -spm('FigName','Stats: done',Finter); spm('Pointer','Arrow') -fprintf('%-40s: %30s\n','Completed',spm('time')) %-# -fprintf('...use the results section for assessment\n\n') %-# diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_fmri_design.m b/lib/marsbar-0.44/@mardo_2/private/pr_fmri_design.m deleted file mode 100644 index 6dc547d..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_fmri_design.m +++ /dev/null @@ -1,201 +0,0 @@ -function [SPM] = pr_fmri_design(SPM) -% MarsBaR version of spm_fMRI design - asssembles a design for fMRI studies -% FORMAT [SPM] = pr_fmri_design(SPM) -% -% This file is a hardly edited version of: -% @(#)spm_fMRI_design.m 2.34 Karl Friston 03/01/30 -% See that (SPM2) version for comments etc -% -% $Id$ - -%-GUI setup -%----------------------------------------------------------------------- -SPMid = spm('SFnBanner',mfilename,marsbar('ver')); -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','fMRI stats model setup',0); -spm_help('!ContextHelp',mfilename) - -% construct Design matrix {X} - cycle over sessions -%======================================================================= - -% global parameters -%----------------------------------------------------------------------- -try - fMRI_T = SPM.xBF.T; - fMRI_T0 = SPM.xBF.T0; -catch - global defaults - d_fmri = mars_struct('getifthere', defaults, 'stats', 'fmri'); - if mars_struct('isthere', d_fmri, 't') - fMRI_T = d_fmri.t; - fMRI_T0 = d_fmri.t0; - else, - fMRI_T = 16; - fMRI_T0 = 1; - end; - SPM.xBF.T = fMRI_T; - SPM.xBF.T0 = fMRI_T0; -end - - -% get nscan and RT if not in SPM -%----------------------------------------------------------------------- -try - SPM.xY.RT; -catch - spm_input('Basic parameters...',1,'d',mfilename) - SPM.xY.RT = spm_input('Interscan interval {secs}','+1','r',[],1); -end -try - SPM.nscan; -catch - SPM.nscan = spm_input(['scans per session e.g. 64 64 64'],'+1'); -end - -% time units, dt = time bin {secs} -%----------------------------------------------------------------------- -SPM.xBF.dt = SPM.xY.RT/SPM.xBF.T; -try - SPM.xBF.UNITS; -catch - str = 'specify design in'; - SPM.xBF.UNITS = spm_input(str,'+1','scans|secs'); -end - -% separate specifications for non-relicated sessions -%----------------------------------------------------------------------- -rep = 0; -if length(SPM.nscan) > 1 & ~any(diff(SPM.nscan)) & ~isfield(SPM,'Sess') - str = 'are sessions replications'; - rep = spm_input(str,'+1','yes|no',[1 0]); -end - -% Get basis functions -%----------------------------------------------------------------------- -try - bf = SPM.xBF.bf; -catch - SPM.xBF = pr_spm_get_bf(SPM.xBF); - bf = SPM.xBF.bf; -end - -% 1st or 2nd order Volterra expansion? -%----------------------------------------------------------------------- -try - V = SPM.xBF.Volterra; -catch - str = 'model interactions (Volterra)'; - V = spm_input(str,'+1','y/n',[2 1]); - SPM.xBF.Volterra = V; -end - - -% get session specific design parameters -%======================================================================= -Xx = []; -Xb = []; -Xname = {}; -Bname = {}; -for s = 1:length(SPM.nscan) - - % number of scans for this session - %--------------------------------------------------------------- - k = SPM.nscan(s); - - if (s == 1) | ~rep - - % create convolved stimulus functions or inputs - %======================================================= - - % Get inputs, neuronal causes or stimulus functions U - %------------------------------------------------------- - U = pr_spm_get_ons(SPM,s); - - % Convolve stimulus functions with basis functions - %------------------------------------------------------- - [X,Xn,Fc] = pr_spm_volterra(U,bf,V); - - % Resample regressors at acquisition times (32 bin offset) - %------------------------------------------------------- - try - X = X([0:(k - 1)]*fMRI_T + fMRI_T0 + 32,:); - end - - - % get user specified regressors - %======================================================= - try - C = SPM.Sess(s).C.C; - Cname = SPM.Sess(s).C.name; - catch - - % covariates - C - %----------------------------------------------- - str = sprintf('Session %d',s); - spm_input('Other regressors',1,'d',str) - C = []; - c = spm_input('user specified','+1','w1',0); - while size(C,2) < c - str = sprintf('regressor %i',size(C,2) + 1); - C = [C spm_input(str,2,'e',[],[k Inf])]; - end - - % and their names - Cnames - %----------------------------------------------- - Cname = {}; - for i = 1:size(C,2) - str = sprintf('regressor %i',i); - Cname{i} = spm_input('name of','+0','s',str); - end - end - - % append mean-corrected regressors and names - %------------------------------------------------------- - X = [X spm_detrend(C)]; - Xn = {Xn{:} Cname{:}}; - - % Confounds: Session effects - %======================================================= - B = ones(k,1); - Bn{1} = sprintf('constant'); - - end - - % Session structure array - %--------------------------------------------------------------- - SPM.Sess(s).U = U; - SPM.Sess(s).C.C = C; - SPM.Sess(s).C.name = Cname; - SPM.Sess(s).row = size(Xx,1) + [1:k]; - SPM.Sess(s).col = size(Xx,2) + [1:size(X,2)]; - SPM.Sess(s).Fc = Fc; - - % Append names - %--------------------------------------------------------------- - for i = 1:length(Xn) - Xname{end + 1} = [sprintf('Sn(%i) ',s) Xn{i}]; - end - for i = 1:length(Bn) - Bname{end + 1} = [sprintf('Sn(%i) ',s) Bn{i}]; - end - - % append into Xx and Xb - %=============================================================== - Xx = blkdiag(Xx,X); - Xb = blkdiag(Xb,B); - -end %- for s - - -% finished -%----------------------------------------------------------------------- -SPM.xX.X = [Xx Xb]; -SPM.xX.iH = []; -SPM.xX.iC = [1:size(Xx,2)]; -SPM.xX.iB = [1:size(Xb,2)] + size(Xx,2); -SPM.xX.iG = []; -SPM.xX.name = {Xname{:} Bname{:}}; - - -%-End -%----------------------------------------------------------------------- -spm_input('!DeleteInputObj') diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_fmristat_ar.m b/lib/marsbar-0.44/@mardo_2/private/pr_fmristat_ar.m deleted file mode 100644 index 93d4e4a..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_fmristat_ar.m +++ /dev/null @@ -1,79 +0,0 @@ -function [rho,Vmhalf,V] = pr_fmristat_ar(res,X,nlags) -% function returns estimated AR coefficients using fmristat algorithm -% FORMAT [rho,Vmhalf,V] = pr_fmristat_ar(res,X,nlags) -% -% See http://www.math.mcgill.ca/keith/fmristat/ and -% fmrilm.m in fmristat package for code, and -% Worsley, K.J., Liao, C., Aston, J., Petre, V., Duncan, G.H., Morales, -% F., Evans, A.C. (2002). A general statistical analysis for fMRI -% data. NeuroImage, 15:1-15 - for description of the algorithm -% -% $Id$ - -% This is the copyright notice from fmrilm: -%############################################################################ -% COPYRIGHT: Copyright 2002 K.J. Worsley -% Department of Mathematics and Statistics, -% McConnell Brain Imaging Center, -% Montreal Neurological Institute, -% McGill University, Montreal, Quebec, Canada. -% worsley@math.mcgill.ca, liao@math.mcgill.ca -% -% Permission to use, copy, modify, and distribute this -% software and its documentation for any purpose and without -% fee is hereby granted, provided that the above copyright -% notice appear in all copies. The author and McGill University -% make no representations about the suitability of this -% software for any purpose. It is provided "as is" without -% express or implied warranty. -%############################################################################ - -if nargin < 2 - error('Need covariance and design'); -end -if nargin < 3 - nlags = 1; -end - -sX = spm_sp('Set', X); -R = spm_sp('r', sX); - -nlp1 = nlags+1; -[n nvox] = size(res); - -% Bias reduction -M=zeros(nlp1); -for i=1:(nlp1) - for j=1:(nlp1) - Di=(diag(ones(1,n-i+1),i-1)+diag(ones(1,n-i+1),-i+1))/(1+(i==1)); - Dj=(diag(ones(1,n-j+1),j-1)+diag(ones(1,n-j+1),-j+1))/(1+(j==1)); - M(i,j)=trace(R*Di*R*Dj)/(1+(i>1)); - end -end -invM = inv(M); - -a = zeros(nlp1,nvox); -for lag = 0:nlags - a(lag+1,:)= sum(res(1:(n-lag),:).*res((lag+1):n,:)); -end - -vhat = invM*a; -rho = vhat(2:end,:) ./ (ones(nlags, 1) * vhat(1,:)); -rho = mean(rho,2)'; - -if nargout > 1 - % Whitening matrix; Appendix A3 Worsley et al (2002) - % Modified according to fmrilm code - [Ainvt posdef] = chol(toeplitz([1 rho])); - nl=size(Ainvt,1); - A=inv(Ainvt'); - Vmhalf = zeros(n,n); - B=ones(n-nl,1)*A(nl,:); - Vmhalf(nl+1:end,:) = spdiags(B,1:nl,n-nl,n); - Vmhalf(1:nl,1:nl) = A; -end - -if nargout > 2 - % Estimated covariance - V = inv(Vmhalf*Vmhalf'); -end diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_get_filter.m b/lib/marsbar-0.44/@mardo_2/private/pr_get_filter.m deleted file mode 100644 index 7cc850a..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_get_filter.m +++ /dev/null @@ -1,51 +0,0 @@ -function [K, str] = pr_get_filter(RT, row) -% gets filter using spm_fmri_spm_ui routines -% FORMAT [K, str]= pr_get_filter(RT, row) -% or -% FORMAT [K, str]= pr_get_filter(RT, Sess) -% -% $Id$ - -if nargin < 2 - error('Need TR, row / Sess matrix'); -end - -% number of sessions -nsess = length(row); - -% rows from Sess -if isfield(row(1), 'row') - Sess = row; - row = {}; - for s = 1:nsess - row{s} = Sess(s).row; - end -else - Sess = []; -end - -switch spm_input('High-pass filter?','+1','b','none|specify'); - - case 'specify' - % default 128 seconds - %------------------------------------------------------- - HParam = 128*ones(1,nsess); - p_str = 'cutoff period (secs)'; - HParam = spm_input(p_str,'+1','e',HParam,[1 nsess]); - str = sprintf('Cutoff: %d {s}', HParam); - - case 'none' - % Inf seconds (i.e. constant term only) - %------------------------------------------------------- - HParam = Inf*ones(1,nsess); - str = 'none'; -end - -% create and set filter struct -%--------------------------------------------------------------- -for i = 1:nsess - K(i) = struct( 'HParam', HParam(i),... - 'row', row{i},... - 'RT', RT); -end -K = pr_spm_filter(K); diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_ce.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_ce.m deleted file mode 100644 index 6e28257..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_ce.m +++ /dev/null @@ -1,49 +0,0 @@ -function [C] = pr_spm_ce(v,a) -% return error covariance constraints for serially correlated data -% FORMAT [C] = spm_Ce(v,a) -% v - (1 x l) v(i) = number of obervations for ith block -% a - AR coeficient expansion point (default a = []) -% -% C{1} = h(1)*AR(a) -% C{2} = h(1)*AR(a) + h(2)*dAR(a)/da(1); -% C{3} = h(1)*AR(a) + h(2)*dAR(a)/da(1) + h(3)*dAR(a)/da(2); -% -% See also; spm_Q.m -%___________________________________________________________________________ -% @(#)spm_Ce.m 2.7 Karl Friston 03/03/15 - - -% defaults -%--------------------------------------------------------------------------- -if nargin == 1 - a = []; -end - - -% create blocks -%--------------------------------------------------------------------------- -C = {}; -l = length(v); -n = sum(v); -k = 0; -if l > 1 - for i = 1:l - dCda = spm_Ce(v(i),a); - for j = 1:length(dCda) - [x y q] = find(dCda{j}); - x = x + k; - y = y + k; - C{end + 1} = sparse(x,y,q,n,n); - end - k = v(i) + k; - end -else - % dCda - %================================================================== - C{1} = pr_spm_q(a,v); - dCda = pr_spm_diff('pr_spm_q',a,v,1); - for i = 1:length(a) - C{i + 1} = reshape(dCda(:,i),v,v); - end - -end diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_diff.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_diff.m deleted file mode 100644 index 9b24924..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_diff.m +++ /dev/null @@ -1,45 +0,0 @@ -function [J] = pr_spm_diff(varargin) -% matrix differential -% FORMAT [dfdx] = pr_spm_diff(f,x,...,P,n) -% -% f - [inline] function f(x,P) -% x - argument[s] -% P - parameter[s] -% n - argument or parameter to differentiate w.r.t. -% -% dfdx - df(x,P)/dx{n} -%___________________________________________________________________________ -% @(#)pr_spm_diff.m 2.1 Karl Friston 03/03/03 - - -% create inline object -%--------------------------------------------------------------------------- -f = fcnchk(varargin{1}); -x = varargin(2:(end - 1)); -n = varargin{end}; -dx = 1e-6; - -if length(n) == 1 - - % dfdx - %------------------------------------------------------------------ - f0 = feval(f,x{:}); - J = sparse(length(f0(:)),length(x{n}(:))); - for i = 1:length(x{n}(:)) - xi = x; - xi{n}(i) = xi{n}(i) + dx; - dfdx = (feval(f,xi{:}) - f0)/dx; - J(:,i) = sparse(dfdx(:)); - end -else - % dfdxdx - %------------------------------------------------------------------ - f0 = pr_spm_diff(f,x{:},n(1)); - J = cell(1,length(x{n(2)}(:))); - for i = 1:length(x{n(2)}(:)) - xi = x; - xi{n(2)}(i) = xi{n(2)}(i) + dx; - dfdx = (pr_spm_diff(f,xi{:},n(1)) - f0)/dx; - J{i} = sparse(dfdx); - end -end diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_filter.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_filter.m deleted file mode 100644 index c7759de..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_filter.m +++ /dev/null @@ -1,136 +0,0 @@ -function [vargout] = pr_spm_filter(K,Y) -% Removes low frequency confounds X0 -% FORMAT [Y] = pr_spm_filter(K,Y) -% FORMAT [K] = pr_spm_filter(K) -% -% K - filter matrix or: -% K(s) - struct array containing partition-specific specifications -% -% K(s).RT - observation interval in seconds -% K(s).row - row of Y constituting block/partition s -% K(s).LChoice - Low-pass filtering {'hrf' 'Gaussian' 'none'} -% K(s).LParam - Gaussian parameter in seconds -% K(s).HParam - cut-off period in seconds -% -% K(s).X0 - low frequencies to be removed (DCT) -% -% Y - data matrix -% -% K - filter structure -% Y - filtered data -%___________________________________________________________________________ -% -% pr_spm_filter implements high-pass filtering in an efficient way by -% using the residual forming matrix of X0 - low frequency confounds -%.pr_spm_filter also configures the filter structure in accord with the -% specification fields if called with one argument -%___________________________________________________________________________ -% @(#)pr_spm_filter.m 2.10 Karl Friston 03/03/04 - - -% set or apply -%--------------------------------------------------------------------------- -if nargin == 1 & isstruct(K) - - % set K.X0 - %------------------------------------------------------------------- - for s = 1:length(K) - - % make high pass filter - %----------------------------------------------------------- - k = length(K(s).row); - n = fix(2*(k*K(s).RT)/K(s).HParam + 1); - X0 = spm_dctmtx(k,n); - K(s).X0 = X0(:,2:end); - - % make low pass filter - %----------------------------------------------------------- - if isfield(K(s), 'LChoice') - switch K(s).LChoice - - case 'none' - %--------------------------------------------------- - h = 1; - d = 0; - - case 'hrf' - %--------------------------------------------------- - h = spm_hrf(K(s).RT); - h = [h; zeros(size(h))]; - g = abs(fft(h)); - h = real(ifft(g)); - h = fftshift(h)'; - n = length(h); - d = [1:n] - n/2 - 1; - - case 'Gaussian' - %--------------------------------------------------- - sigma = K(s).LParam/K(s).RT; - h = round(4*sigma); - h = exp(-[-h:h].^2/(2*sigma^2)); - n = length(h); - d = [1:n] - (n + 1)/2; - if n == 1, h = 1; end - - otherwise - %--------------------------------------------------- - error('Low pass Filter option unknown'); - return - end - % create and normalize low pass filter - %----------------------------------------------------------- - K(s).KL = spdiags(ones(k,1)*h,d,k,k); - K(s).KL = spdiags(1./sum(K(s).KL')',0,k,k)*K(s).KL; - - end - end - - % return structure - %------------------------------------------------------------------- - vargout = K; - -else - % apply - %------------------------------------------------------------------- - if isstruct(K) - - % ensure requisite feilds are present - %----------------------------------------------------------- - if ~isfield(K(1),'X0') | ... - (isfield(K(1),'LChoice') & ~isfield(K(1), 'KL')) - K = pr_spm_filter(K); - end - - for s = 1:length(K) - - % select data - %--------------------------------------------------- - y = Y(K(s).row,:); - - % apply low pass filter - %--------------------------------------------------- - if isfield(K(s), 'KL') - y = K(s).KL*y; - end - - % apply high pass filter - %--------------------------------------------------- - y = y - K(s).X0*(K(s).X0'*y); - - % reset filtered data in Y - %--------------------------------------------------- - Y(K(s).row,:) = y; - - end - - % K is simply a filter matrix - %------------------------------------------------------------------- - else - Y = K*Y; - end - - % return filtered data - %------------------------------------------------------------------- - vargout = Y; - -end diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_get_bf.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_get_bf.m deleted file mode 100644 index 9f2cc0b..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_get_bf.m +++ /dev/null @@ -1,180 +0,0 @@ -function [xBF] = pr_spm_get_bf(xBF) -% fills in basis function structure -% FORMAT [xBF] = spm_get_bf(xBF); -% -% xBF.dt - time bin length {seconds} -% xBF.name - description of basis functions specified -% xBF.length - window length (secs) -% xBF.order - order -% xBF.bf - Matrix of basis functions -% -% xBF.name 'hrf' -% 'hrf (with time derivative)' -% 'hrf (with time and dispersion derivatives)' -% 'Fourier set' -% 'Fourier set (Hanning)' -% 'Gamma functions' -% 'Finite Impulse Response'}; -% -% (any other specifiaction will default to hrf) -%_______________________________________________________________________ -% -% spm_get_bf prompts for basis functions to model event or epoch-related -% responses. The basis functions returned are unitary and orthonormal -% when defined as a function of peri-stimulus time in time-bins. -% It is at this point that the distinction between event and epoch-related -% responses enters. -%_______________________________________________________________________ -% @(#)spm_get_bf.m 2.22 Karl Friston 02/04/19 - -%-GUI setup -%----------------------------------------------------------------------- -spm_help('!ContextHelp',mfilename) - -% length of time bin -%----------------------------------------------------------------------- -if ~nargin - str = 'time bin for basis functions {secs}'; - xBF.dt = spm_input(str,'+1','r',1/16,1); -end -dt = xBF.dt; - - -% assemble basis functions -%======================================================================= - -% model event-related responses -%----------------------------------------------------------------------- -if ~isfield(xBF,'name') - spm_input('Hemodynamic Basis functions...',1,'d') - Ctype = { - 'hrf',... - 'hrf (with time derivative)',... - 'hrf (with time and dispersion derivatives)',... - 'Fourier set',... - 'Fourier set (Hanning)',... - 'Gamma functions',... - 'Finite Impulse Response'}; - str = 'Select basis set'; - Sel = spm_input(str,2,'m',Ctype); - xBF.name = Ctype{Sel}; -end - -% get order and length parameters -%----------------------------------------------------------------------- -switch xBF.name - - case { 'Fourier set','Fourier set (Hanning)',... - 'Gamma functions','Finite Impulse Response'} - %--------------------------------------------------------------- - try, l = xBF.length; - catch, l = spm_input('window length {secs}',3,'e',32); - xBF.length = l; - end - try, h = xBF.order; - catch, h = spm_input('order',4,'e',4); - xBF.order = h; - end -end - - - -% create basis functions -%----------------------------------------------------------------------- -switch xBF.name - - case {'Fourier set','Fourier set (Hanning)'} - %--------------------------------------------------------------- - pst = [0:dt:l]'; - pst = pst/max(pst); - - % hanning window - %--------------------------------------------------------------- - if strcmp(xBF.name,'Fourier set (Hanning)') - g = (1 - cos(2*pi*pst))/2; - else - g = ones(size(pst)); - end - - % zeroth and higher Fourier terms - %--------------------------------------------------------------- - bf = g; - for i = 1:h - bf = [bf g.*sin(i*2*pi*pst)]; - bf = [bf g.*cos(i*2*pi*pst)]; - end - - case {'Gamma functions'} - %--------------------------------------------------------------- - pst = [0:dt:l]'; - bf = spm_gamma_bf(pst,h); - - case {'Finite Impulse Response'} - %--------------------------------------------------------------- - bin = l/h; - bf = kron(eye(h),ones(round(bin/dt),1)); - - case {'NONE'} % innovation from SPM5 - %--------------------------------------------------------------- - bf = 1; - -otherwise - - % canonical hemodynaic response function - %--------------------------------------------------------------- - [bf p] = pr_spm_hrf(dt); - - % add time derivative - %--------------------------------------------------------------- - if findstr(xBF.name,'time') - - dp = 1; - p(6) = p(6) + dp; - D = (bf(:,1) - pr_spm_hrf(dt,p))/dp; - bf = [bf D(:)]; - p(6) = p(6) - dp; - - % add dispersion derivative - %-------------------------------------------------------- - if findstr(xBF.name,'dispersion') - - dp = 0.01; - p(3) = p(3) + dp; - D = (bf(:,1) - pr_spm_hrf(dt,p))/dp; - bf = [bf D(:)]; - end - end - - % length and order - %--------------------------------------------------------------- - xBF.length = size(bf,1)*dt; - xBF.order = size(bf,2); - -end - - -% Orthogonalize and fill in basis function structure -%------------------------------------------------------------------------ -xBF.bf = pr_spm_orth(bf); - - -%======================================================================= -%- S U B - F U N C T I O N S -%======================================================================= - -% compute Gamma functions functions -%----------------------------------------------------------------------- -function bf = spm_gamma_bf(u,h) -% returns basis functions used for Volterra expansion -% FORMAT bf = spm_gamma_bf(u,h); -% u - times {seconds} -% h - order -% bf - basis functions (mixture of Gammas) -%_______________________________________________________________________ -u = u(:); -bf = []; -for i = 2:(1 + h) - m = 2^i; - s = sqrt(m); - bf = [bf pr_spm_gpdf(u,(m/s)^2,m/s^2)]; -end diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_get_ons.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_get_ons.m deleted file mode 100644 index 8643d76..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_get_ons.m +++ /dev/null @@ -1,255 +0,0 @@ -function [U] = pr_spm_get_ons(SPM,s) -% returns input [designed effects] structures -% FORMAT [U] = spm_get_ons(SPM,s) -% -% s - session number (used by batch system) -% -% U - (1 x n) struct array of (n) trial-specific structures -% -% U(i).name - cell of names for each input or cause -% U(i).u - inputs or stimulus function matrix -% U(i).dt - time bin (seconds) -% U(i).ons - onsets (in SPM.xBF.UNITS) -% U(i).dur - durations (in SPM.xBF.UNITS) -% U(i).P - parameter struct. -% -% U(i).P(p).name - parameter name -% U(i).P(p).P - parameter vector -% U(i).P(p).h - order of polynomial expansion -% U(i).P(p).i - sub-indices of u pertaining to P -%_______________________________________________________________________ -% -% -% SLICE TIMIING -% -% With longs TRs you may want to shift the regressors so that they are -% aligned to a particular slice. This is effected by resetting the -% values of defaults.stats.fmri.t and defaults.stats.fmri.t0 in -% spm_defaults. defaults.stats.fmri.t is the number of time-bins per -% scan used when building regressors. Onsets are defined -% in temporal units of scans starting at 0. defaults.stats.fmri.t0 is -% the first time-bin at which the regressors are resampled to coincide -% with data acquisition. If defaults.stats.fmri.t0 = 1 then the -% regressors will be appropriate for the first slice. If you want to -% temporally realign the regressors so that they match responses in the -% middle slice then make defaults.stats.fmri.t0 = -% defaults.stats.fmri.t/2 (assuming there is a negligible gap between -% volume acquisitions. Default values are defaults.stats.fmri.t = 16 -% and defaults.stats.fmri.t0 = 1. -% -% -%_______________________________________________________________________ -% @(#)spm_get_ons.m 2.40 Karl Friston 03/07/03 - -%-GUI setup -%----------------------------------------------------------------------- -spm_help('!ContextHelp',mfilename) - -% time units -%----------------------------------------------------------------------- -k = SPM.nscan(s); -T = SPM.xBF.T; -dt = SPM.xBF.dt; -try - UNITS = SPM.xBF.UNITS; -catch - UNITS = 'scans'; -end -switch UNITS - - case 'scans' - %---------------------------------------------------------------- - TR = T*dt; - - case 'secs' - %---------------------------------------------------------------- - TR = 1; -end - -% get inputs and names (try SPM.Sess(s).U first) -%======================================================================= -try - U = SPM.Sess(s).U; - v = length(U); -catch - - %-prompt string - %--------------------------------------------------------------- - str = sprintf('Session %d: trial specification in %s',s,UNITS); - spm_input(str,1,'d') - - U = {}; - v = spm_input('number of conditions/trials',2,'w1'); -end - -% get trials -%----------------------------------------------------------------------- -for i = 1:v - - % get names - %--------------------------------------------------------------- - try - Uname = U(i).name(1); - catch - str = sprintf('name for condition/trial %d ?',i); - Uname = {spm_input(str,3,'s',sprintf('trial %d',i))}; - U(i).name = Uname; - end - - % get main [trial] effects - %================================================================ - - % onsets - %--------------------------------------------------------------- - try - ons = U(i).ons; - ons = ons(:); - catch - ons = []; - end - if ~length(ons) - str = ['vector of onsets - ' Uname{1}]; - ons = spm_input(str,4,'r',' ',[Inf 1]); - U(i).ons = ons(:); - - end - - % durations - %--------------------------------------------------------------- - try - dur = U(i).dur; - dur = dur(:); - catch - dur = []; - end - if ~length(dur) - str = 'duration[s] (events = 0)'; - while 1 - dur = spm_input(str,5,'r',' ',[Inf 1]); - if length(dur) == 1 - dur = dur*ones(size(ons)); - end - if length(dur) == length(ons), break, end - str = sprintf('enter a scalar or [%d] vector',... - length(ons)); - end - U(i).dur = dur; - end - - % peri-stimulus times {seconds} - %--------------------------------------------------------------- - pst = [1:k]*T*dt - ons(1)*TR; - for j = 1:length(ons) - w = [1:k]*T*dt - ons(j)*TR; - v = find(w >= -1); - pst(v) = w(v); - end - - - % add parameters x trial interactions - %================================================================ - - % get parameter stucture xP - %---------------------------------------------------------------- - try - xP = U(i).P; - Pname = xP(1).name; - - switch Pname - - case 'none' - %------------------------------------------------ - xP.name = 'time'; - xP.h = 0; - - end - - catch - - Pname = {'none','time','other'}; - Pname = spm_input('parametric modulation',6,'b',Pname); - - switch Pname - - case 'none' - %-------------------------------------------------------- - xP(1).name = 'none'; - xP(1).P = ons*TR; - xP(1).h = 0; - - case 'time' - %-------------------------------------------------------- - xP(1).name = 'time'; - xP(1).P = ons*TR; - xP(1).h = spm_input('polynomial order',8,'n1',1); - - case 'other' - %-------------------------------------------------------- - str = ['# parameters (' Uname{1} ')']; - for q = 1:spm_input(str,7,'n1',1); - - % get names and parametric variates - %------------------------------------------------ - str = sprintf('parameter %d name',q); - Pname = spm_input(str,7,'s'); - P = spm_input(Pname,7,'r',[],[length(ons),1]); - - % order of polynomial expansion h - %------------------------------------------------ - h = spm_input('polynomial order',8,'n1',1); - - % sub-indices and inputs - %------------------------------------------------ - xP(q).name = Pname; - xP(q).P = P(:); - xP(q).h = h; - - end - end % switch - - end % try - - % interaction with causes (u) - 1st = main effects - %---------------------------------------------------------------- - u = ons.^0; - for q = 1:length(xP) - xP(q).i = [1, ([1:xP(q).h] + size(u,2))]; - for j = 1:xP(q).h - P = spm_en(xP(q).P); - u = [u P.^j]; - str = sprintf('%sx%s^%d',Uname{1},xP.name,j); - Uname{end + 1} = str; - end - end - - % orthogonalize inputs - %--------------------------------------------------------------- - u = pr_spm_orth(u); - - % and scale so sum(u*dt) = number of events, if event-related - %--------------------------------------------------------------- - if ~any(dur) - u = u/dt; - end - - % create stimulus functions (32 bin offset) - %=============================================================== - ton = round(ons*TR/dt) + 32; % onsets - tof = round(dur*TR/dt) + ton + 1; % offset - sf = sparse((k*T + 128),size(u,2)); - for j = 1:length(ton) - sf(ton(j),:) = sf(ton(j),:) + u(j,:); - sf(tof(j),:) = sf(tof(j),:) - u(j,:); - end - sf = cumsum(sf); % integrate - sf = sf(1:(k*T + 32),:); % stimulus - - % place in ouputs structure - %--------------------------------------------------------------- - U(i).name = Uname; % - input names - U(i).dt = dt; % - time bin {seconds} - U(i).u = sf; % - stimulus function matrix - U(i).pst = pst; % - pst (seconds) - U(i).P = xP; % - parameter struct - -end % (v) diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_gpdf.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_gpdf.m deleted file mode 100644 index 6fb81e0..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_gpdf.m +++ /dev/null @@ -1,94 +0,0 @@ -function f = spm_Gpdf(x,h,l) -% Probability Density Function (PDF) of Gamma distribution -% FORMAT f = spm_Gpdf(g,h,l) -% -% x - Gamma-variate (Gamma has range [0,Inf) ) -% h - Shape parameter (h>0) -% l - Scale parameter (l>0) -% f - PDF of Gamma-distribution with shape & scale parameters h & l -%_______________________________________________________________________ -% -% spm_Gpdf implements the Probability Density Function of the Gamma -% distribution. -% -% Definition: -%----------------------------------------------------------------------- -% The PDF of the Gamma distribution with shape parameter h and scale l -% is defined for h>0 & l>0 and for x in [0,Inf) by: (See Evans et al., -% Ch18, but note that this reference uses the alternative -% parameterisation of the Gamma with scale parameter c=1/l) -% -% l^h * x^(h-1) exp(-lx) -% f(x) = --------------------- -% gamma(h) -% -% Variate relationships: (Evans et al., Ch18 & Ch8) -%----------------------------------------------------------------------- -% For natural (strictly +ve integer) shape h this is an Erlang distribution. -% -% The Standard Gamma distribution has a single parameter, the shape h. -% The scale taken as l=1. -% -% The Chi-squared distribution with v degrees of freedom is equivalent -% to the Gamma distribution with scale parameter 1/2 and shape parameter v/2. -% -% Algorithm: -%----------------------------------------------------------------------- -% Direct computation using logs to avoid roundoff errors. -% -% References: -%----------------------------------------------------------------------- -% Evans M, Hastings N, Peacock B (1993) -% "Statistical Distributions" -% 2nd Ed. Wiley, New York -% -% Abramowitz M, Stegun IA, (1964) -% "Handbook of Mathematical Functions" -% US Government Printing Office -% -% Press WH, Teukolsky SA, Vetterling AT, Flannery BP (1992) -% "Numerical Recipes in C" -% Cambridge -%_______________________________________________________________________ -% @(#)spm_Gpdf.m 2.2 Andrew Holmes 99/04/26 - -%-Format arguments, note & check sizes -%----------------------------------------------------------------------- -if nargin<3, error('Insufficient arguments'), end - -ad = [ndims(x);ndims(h);ndims(l)]; -rd = max(ad); -as = [ [size(x),ones(1,rd-ad(1))];... - [size(h),ones(1,rd-ad(2))];... - [size(l),ones(1,rd-ad(3))] ]; -rs = max(as); -xa = prod(as,2)>1; -if sum(xa)>1 & any(any(diff(as(xa,:)),1)) - error('non-scalar args must match in size'), end - -%-Computation -%----------------------------------------------------------------------- -%-Initialise result to zeros -f = zeros(rs); - -%-Only defined for strictly positive h & l. Return NaN if undefined. -md = ( ones(size(x)) & h>0 & l>0 ); -if any(~md(:)), f(~md) = NaN; - warning('Returning NaN for out of range arguments'), end - -%-Degenerate cases at x==0: h<1 => f=Inf; h==1 => f=l; h>1 => f=0 -ml = ( md & x==0 & h<1 ); -f(ml) = Inf; -ml = ( md & x==0 & h==1 ); if xa(3), mll=ml; else mll=1; end -f(ml) = l(mll); - -%-Compute where defined and x>0 -Q = find( md & x>0 ); -if isempty(Q), return, end -if xa(1), Qx=Q; else Qx=1; end -if xa(2), Qh=Q; else Qh=1; end -if xa(3), Ql=Q; else Ql=1; end - -%-Compute -f(Q) = exp( (h(Qh)-1).*log(x(Qx)) +h(Qh).*log(l(Ql)) - l(Ql).*x(Qx)... - -gammaln(h(Qh)) ); diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_hrf.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_hrf.m deleted file mode 100644 index c1c4041..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_hrf.m +++ /dev/null @@ -1,44 +0,0 @@ -function [hrf,p] = pr_spm_hrf(RT,P); -% returns a hemodynamic response function -% FORMAT [hrf,p] = pr_spm_hrf(RT,[p]); -% RT - scan repeat time -% p - parameters of the response function (two gamma functions) -% -% defaults -% (seconds) -% p(1) - delay of response (relative to onset) 6 -% p(2) - delay of undershoot (relative to onset) 16 -% p(3) - dispersion of response 1 -% p(4) - dispersion of undershoot 1 -% p(5) - ratio of response to undershoot 6 -% p(6) - onset (seconds) 0 -% p(7) - length of kernel (seconds) 32 -% -% hrf - hemodynamic response function -% p - parameters of the response function -%_______________________________________________________________________ -% @(#)spm_hrf.m 2.8 Karl Friston 02/07/31 - -% global parameter -%----------------------------------------------------------------------- -global defaults -if ~isempty(defaults), - fMRI_T = defaults.stats.fmri.t; -else, - fMRI_T = 16; -end; - -% default parameters -%----------------------------------------------------------------------- -p = [6 16 1 1 6 0 32]; -if nargin > 1 - p(1:length(P)) = P; -end - -% modelled hemodynamic response function - {mixture of Gammas} -%----------------------------------------------------------------------- -dt = RT/fMRI_T; -u = [0:(p(7)/dt)] - p(6)/dt; -hrf = spm_Gpdf(u,p(1)/p(3),dt/p(3)) - spm_Gpdf(u,p(2)/p(4),dt/p(4))/p(5); -hrf = hrf([0:(p(7)/RT)]*fMRI_T + 1); -hrf = hrf'/sum(hrf); diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_orth.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_orth.m deleted file mode 100644 index 7c2d4da..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_orth.m +++ /dev/null @@ -1,16 +0,0 @@ -function x = spm_orth(X) -% recursive orthogonalization of basis functions -% FORMAT x = spm_orth(X) -% -% serial orthogionalization starting with the first column -%_______________________________________________________________________ -% @(#)spm_orth.m 2.1 Karl Friston 02/02/07 - -x = X(:,1); -for i = 2:size(X,2) - D = X(:,i); - D = D - x*(pinv(x)*D); - if any(D) - x = [x D]; - end -end diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_q.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_q.m deleted file mode 100644 index 94584d1..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_q.m +++ /dev/null @@ -1,19 +0,0 @@ -function [Q] = pr_spm_q(A,n) -% returns an (n x n) autocorrelation matrix for an AR(p) process -% FORMAT [Q] = spm_Q(A,n) -% -% A - vector pf p AR coeficients -% n - size of Q -%___________________________________________________________________________ -% @(#)spm_Q.m 2.2 Karl Friston 03/03/03 - -% compute Q -%--------------------------------------------------------------------------- -p = length(A); -A = [1 -A(:)']; -K = inv(spdiags(ones(n,1)*A,-[0:p],n,n)); -K = K.*(abs(K) > 1e-4); -Q = K*K'; -D = spdiags(sqrt(1./diag(Q)),0,n,n); -Q = D*Q*D; -Q = Q.*(abs(Q) > 1e-4); diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_reml.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_reml.m deleted file mode 100644 index c0d0bf9..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_reml.m +++ /dev/null @@ -1,135 +0,0 @@ -function [Ce,h,W,u] = spm_reml(Cy,X,Q,TOL); -% REML estimation of covariance components from Cov{y} -% FORMAT [Ce,h,W,u] = spm_reml(Cy,X,Q,TOL); -% -% Cy - (m x m) data covariance matrix y*y' {y = (m x n) data matrix} -% X - (m x p) design matrix -% Q - {1 x q} covariance components -% TOL - Tolerance {default = 1e-6} -% -% Ce - (m x m) estimated errors = h(1)*Q{1} + h(2)*Q{2} + ... -% h - (q x 1) hyperparameters -% W - (q x q) W*n = precision of hyperparameter estimates -% u - {1 x p} estimable components C{i} = u(1,i)*Q{1} + u(2,i)*Q{2} +... -%___________________________________________________________________________ -% @(#)spm_reml.m 2.22 John Ashburner, Karl Friston 03/03/26 - -% set tolerance if not specified -%--------------------------------------------------------------------------- -if nargin < 4, TOL = 1e-6; end - -% ensure X is not rank deficient -%--------------------------------------------------------------------------- -X = full(X); -X = orth(X); -X = sparse(X); - -% find estimable components (encoded in the precision matrix W) -%--------------------------------------------------------------------------- -m = length(Q); -n = length(Cy); -W = zeros(m,m); -for i = 1:m - RQ{i} = Q{i} - X*(X'*Q{i}); -end -for i = 1:m -for j = i:m - dFdhh = sum(sum(RQ{i}.*RQ{j}')); - W(i,j) = dFdhh; - W(j,i) = dFdhh; -end -end - -% eliminate inestimable components -% NB: The threshold for normalized eigenvalues is 1e-6 in spm_svd -%--------------------------------------------------------------------------- -u = pr_spm_svd(W); -for i = 1:size(u,2) - C{i} = sparse(n,n); - for j = 1:m - C{i} = C{i} + Q{j}*u(j,i); - end -end -Q = C; - -% initialize hyperparameters (assuming Cov{e} = 1} -%--------------------------------------------------------------------------- -m = length(Q); -dFdh = zeros(m,1); -W = zeros(m,m); -C = []; -for i = 1:m - C = [C Q{i}(:)]; -end -I = speye(n,n); -h = inv(C'*C)*(C'*I(:)); - -% Iterative EM -%--------------------------------------------------------------------------- -for k = 1:32 - - % Q are variance components - %------------------------------------------------------------------ - Ce = sparse(n,n); - for i = 1:m - Ce = Ce + h(i)*Q{i}; - end - iCe = inv(Ce); - - % E-step: conditional covariance cov(B|y) {Cby} - %=================================================================== - iCeX = iCe*X; - Cby = inv(X'*iCeX); - - % M-step: ReML estimate of hyperparameters - %=================================================================== - - % Gradient dFd/h (first derivatives) - %------------------------------------------------------------------- - P = iCe - iCeX*Cby*iCeX'; - PCy = Cy*P'- speye(n,n); - for i = 1:m - - % dF/dh = -trace(dF/diCe*iCe*Q{i}*iCe) = - %--------------------------------------------------- - PQ{i} = P*Q{i}; - dFdh(i) = sum(sum(PCy.*PQ{i}))/2; - - end - - % Expected curvature E{ddF/dhh} (second derivatives) - %------------------------------------------------------------------- - for i = 1:m - for j = i:m - - % ddF/dhh = -trace{P*Q{i}*P*Q{j}} - %--------------------------------------------------- - dFdhh = sum(sum(PQ{i}.*PQ{j}))/2; - W(i,j) = dFdhh; - W(j,i) = dFdhh; - end - end - - % Fisher scoring: update dh = -inv(ddF/dhh)*dF/dh - %------------------------------------------------------------------- - dh = inv(W)*dFdh; - h = h + dh; - - % Convergence (or break if there is only one hyperparameter) - %=================================================================== - w = dFdh'*dFdh; - if w < TOL | m == 1, break, end - fprintf('%-30s: %i %30s%e\n',' ReML Iteration',k,'...',full(w)); -end - -% estimate of cov{e} -%--------------------------------------------------------------------------- -Ce = sparse(n,n); -for i = 1:m - Ce = Ce + h(i)*Q{i}; -end - -% rotate hyperparameter esimates and precision back -%--------------------------------------------------------------------------- -h = u*h; -W = u*W*u'; diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_svd.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_svd.m deleted file mode 100644 index c5af26a..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_svd.m +++ /dev/null @@ -1,94 +0,0 @@ -function [U,S,V] = spm_svd(X,U) -% computationally efficient SVD (that can handle sparse arguments) -% FORMAT [U,S,V] = spm_svd(X,u); -% X - {m x n} matrix -% u - threshold for normalized eigenvalues (default = 1e-6) -% -% U - {m x p} singular vectors -% V - {m x p} singular variates -% S - {p x p} singular values -%___________________________________________________________________________ -% @(#)spm_svd.m 2.2 Karl Friston 00/10/10 - - -% default threshold -%--------------------------------------------------------------------------- -if nargin < 2 - U = 1e-6; -end - -% deal with sparse matrices -%--------------------------------------------------------------------------- -[M N] = size(X); -p = find(any(X,2)); -q = find(any(X,1)); -X = X(p,q); - -% SVD -%--------------------------------------------------------------------------- -[i j s] = find(X); -[m n] = size(X); -if any(i - j) - - % off-leading diagonal elements - full SVD - %------------------------------------------------------------------- - X = full(X); - if m > n - - [v S v] = svd(spm_atranspa(X),0); - S = sparse(S); - s = diag(S); - s = s*length(s)/sum(s); - j = find(s >= U); - v = v(:,j); - u = spm_en(X*v); - S = sqrt(S(j,j)); - - elseif m < n - - [u S u] = svd(spm_atranspa(X'),0); - S = sparse(S); - s = diag(S); - s = s*length(s)/sum(s); - j = find(s >= U); - u = u(:,j); - v = spm_en(X'*u); - S = sqrt(S(j,j)); - - else - - [u S v] = svd(X,0); - S = sparse(S); - s = diag(S).^2; - s = s*length(s)/sum(s); - j = find(s >= U); - v = v(:,j); - u = u(:,j); - S = S(j,j); - end - -else - S = sparse(1:n,1:n,s,m,n); - u = speye(m,n); - v = speye(m,n); - [i j] = sort(-s); - S = S(j,j); - v = v(:,j); - u = u(:,j); - - s = diag(S).^2; - s = s*length(s)/sum(s); - j = find(s >= U); - v = v(:,j); - u = u(:,j); - S = S(j,j); - -end - -% replace in full matrices -%--------------------------------------------------------------------------- -j = length(j); -U = sparse(M,j); -V = sparse(N,j); -U(p,:) = u; -V(q,:) = v; diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_ui.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_ui.m deleted file mode 100644 index cfd2f92..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_ui.m +++ /dev/null @@ -1,1393 +0,0 @@ -function varargout = pr_spm_ui(varargin) -% MarsBaR: setting up the general linear model for independent data -% -% MarsBaR version copied with minor edits from: -% @(#)spm_spm_ui.m 2.49 Andrew Holmes 03/03/20 -% See that (SPM2) file for comments and help -% -% $Id$ - -%-Condition arguments -%----------------------------------------------------------------------- -if (nargin==0), Action = 'CFG'; else, Action = varargin{1}; end - -% For selecting images, later -img_flt = mars_veropts('get_img_ext'); - -switch lower(Action), case 'cfg' -%======================================================================= -% - C O N F I G U R E D E S I G N -%======================================================================= -% pr_spm_ui('CFG',D) -if nargin<2, D = []; else, D = varargin{2}; end - -%-GUI setup -%----------------------------------------------------------------------- -SPMid = spm('SFnBanner',mfilename,marsbar('ver')); -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Stats: Setup analysis',0); -spm_help('!ContextHelp',mfilename) - -%-Option definitions -%----------------------------------------------------------------------- -%-Generic factor names -sF = {'sF1','sF2','sF3','sF4'}; - -%-Covariate by factor interaction options -sCFI = {'';... %-1 - 'with sF1';'with sF2';'with sF3';'with sF4';... %-2:5 - 'with sF2 (within sF4)';'with sF3 (within sF4)'}; %-6,7 - -%-DesMtx argument components for covariate by factor interaction options -% (Used for CFI's Covariate Centering (CC), GMscale & Global normalisation) -CFIforms = { '[]', 'C', '{}';... %-1 - 'I(:,1)', 'FxC', '{D.sF{1}}';... %-2 - 'I(:,2)', 'FxC', '{D.sF{2}}';... %-3 - 'I(:,3)', 'FxC', '{D.sF{3}}';... %-4 - 'I(:,4)', 'FxC', '{D.sF{4}}';... %-5 - 'I(:,[4,2])', 'FxC', '{D.sF{4},D.sF{2}}';... %-6 - 'I(:,[4,3])', 'FxC', '{D.sF{4},D.sF{3}}' }; %-7 - -%-Centre (mean correction) options for covariates & globals (CC) -% (options 9-12 are for centering of global when using AnCova GloNorm) (GC) -sCC = { 'around overall mean';... %-1 - 'around sF1 means';... %-2 - 'around sF2 means';... %-3 - 'around sF3 means';... %-4 - 'around sF4 means';... %-5 - 'around sF2 (within sF4) means';... %-6 - 'around sF3 (within sF4) means';... %-7 - '';... %-8 - 'around user specified value';... %-9 - '(as implied by AnCova)';... %-10 - 'GM';... %-11 - '(redundant: not doing AnCova)'}'; %-12 -%-DesMtx I forms for covariate centering options -CCforms = {'ones(nScan,1)',CFIforms{2:end,1},''}'; - - -%-Global normalization options (options 1-7 match CFIforms) (GloNorm) -sGloNorm = { 'AnCova';... %-1 - 'AnCova by sF1';... %-2 - 'AnCova by sF2';... %-3 - 'AnCova by sF3';... %-4 - 'AnCova by sF4';... %-5 - 'AnCova by sF2 (within sF4)';... %-6 - 'AnCova by sF3 (within sF4)';... %-7 - 'proportional scaling';... %-8 - ''}; %-9 - -%-Grand mean scaling options (GMsca) -sGMsca = { 'scaling of overall grand mean';... %-1 - 'scaling of sF1 grand means';... %-2 - 'scaling of sF2 grand means';... %-3 - 'scaling of sF3 grand means';... %-4 - 'scaling of sF4 grand means';... %-5 - 'scaling of sF2 (within sF4) grand means';... %-6 - 'scaling of sF3 (within sF4) grand means';... %-7 - '(implicit in PropSca global normalisation)';... %-8 - '' }; %-9 -%-NB: Grand mean scaling by subject is redundent for proportional scaling - - -%-Global calculation options (GXcalc) -sGXcalc = { 'omit';... %-1 - 'user specified';... %-2 - 'mean voxel value (within per image fullmean/8 mask)'}; %-3 - - - -%======================================================================= -%-D E S I G N P A R A M E T E R S -%======================================================================= -%-Get design type -%----------------------------------------------------------------------- -if isempty(D) - - D = pr_spm_ui( ... - char(spm_input('Select design class...','+1','m',... - {'Basic stats','Standard PET designs','SPM96 PET designs'},... - {'DesDefs_Stats','DesDefs_PET','DesDefs_PET96'},2))); -end - -D = D(spm_input('Select design type...','+1','m',{D.DesName}')); - - -%-Set factor names for this design -%----------------------------------------------------------------------- -sCC = sf_estrrep(sCC,[sF',D.sF']); -sCFI = sf_estrrep(sCFI,[sF',D.sF']); -sGloNorm = sf_estrrep(sGloNorm,[sF',D.sF']); -sGMsca = sf_estrrep(sGMsca,[sF',D.sF']); - -%-Get filenames & factor indicies -%----------------------------------------------------------------------- -[P,I] = pr_spm_ui('Files&Indices',D.sF,D.n,D.b.aTime); -nScan = size(I,1); %-#obs - -%-Additional design parameters -%----------------------------------------------------------------------- -bL = any(diff(I,1),1); %-Multiple factor levels? - % NB: bL(2) might be thrown by user specified f1 levels - % (D.b.aTime & D.n(2)>1) - assumme user is consistent? -bFI = [bL(1),bL(2:3)&~bL(4),bL(4),bL([2,3])&bL(4)]; - %-Allowable interactions for covariates - %-Only offer interactions with multi-level factors, and - % don't offer by F2|F3 if bL(4)! - -%-Build Condition (H) and Block (B) partitions -%======================================================================= -eval(['[H,Hnames] = spm_DesMtx(',D.Hform,');']) -if rank(H)==nScan, error('unestimable condition effects'), end -eval(['[B,Bnames] = spm_DesMtx(',D.Bform,');']) -if rank(B)==nScan, error('unestimable block effects'), end - -%-Drop a constant H partition if B partition can model constant -if size(H,2)>0 & all(H(:)==1) & (rank([H B])==rank(B)) - H = []; Hnames = {}; - warning('Dropping redundant constant H partition') -end - - -%-Covariate partition(s): interest (C) & nuisance (G) excluding global -%======================================================================= -nC = D.nC; %-Default #covariates -C = {[],[]}; Cnames = {{},{}}; %-Covariate DesMtx partitions & names -xC = []; %-Struct array to hold raw covariates - - -dcname = {'CovInt','NusCov'}; %-Default root names for covariates -dstr = {'covariate','nuisance variable'}; - -GUIpos = spm_input('!NextPos'); -nc = [0,0]; -for i = 1:2 % 1:covariates of interest, 2:nuisance variables - - if isinf(nC(i)), nC(i)=spm_input(['# ',dstr{i},'s'],GUIpos,'w1'); end - - while nc(i) < nC(i) - - %-Create prompt, get covariate, get covariate name - %--------------------------------------------------------------- - if nC(i)==1, str=dstr{i}; else, str=sprintf('%s %d',dstr{i},nc(i)+1); end - c = spm_input(str,GUIpos,'r',[],[nScan,Inf]); - if any(isnan(c(:))), break, end %-NaN is dummy value to exit - nc(i) = nc(i)+1; %-#Covariates (so far) - if nC(i)>1, tstr = sprintf('%s^{%d}',dcname{i},nc(i)); - else, tstr = dcname{i}; end - cname = spm_input([str,' name?'],'+1','s',tstr); - rc = c; %-Save covariate value - rcname = cname; %-Save covariate name - - %-Interaction option? (if single covariate vector entered)? - %--------------------------------------------------------------- - if size(c,2) == 1 - if length(D.iCFI{i})>1 - %-User choice of interaction options, default is negative - %-Only offer interactions for appropriate factor combinations - iCFI = intersect(abs(D.iCFI{i}),find([1,bFI])); - dCFI = max([1,intersect(iCFI,-D.iCFI{i}(D.iCFI{i}<0))]); - iCFI = spm_input([str,': interaction?'],'+1','m',... - sCFI(iCFI),iCFI,find(iCFI==dCFI)); - else - iCFI = abs(D.iCFI{i}); %-AutoSelect default option - end - else - iCFI = 1; - end - - %-Centre covariate(s)? (Default centring to correspond to CFI) - % Always offer "no centering" as default for design matrix blocks - %--------------------------------------------------------------- - DiCC = D.iCC{i}; - if size(c,2)>1, DiCC = union(DiCC,-8); end - if length(DiCC)>1 - %-User has a choice of centering options - %-Only offer factor specific for appropriate factor combinations - iCC = intersect(abs(DiCC),find([1,bFI,1]) ); - %-Default is max -ve option in D, overridden by iCFI if CFI - if iCFI == 1, dCC = -DiCC(DiCC<0); else, dCC = iCFI; end - dCC = max([1,intersect(iCC,dCC)]); - iCC = spm_input([str,': centre?'],'+1','m',... - sCC(iCC),iCC,find(iCC==dCC)); - else - iCC = abs(DiCC); %-AutoSelect default option - end - %-Centre within factor levels as appropriate - if any(iCC == [1:7]), c = c - spm_meanby(c,eval(CCforms{iCC})); end - - %-Do any interaction (only for single covariate vectors) - %--------------------------------------------------------------- - if iCFI > 1 %-(NB:iCFI=1 if size(c,2)>1) - tI = [eval(CFIforms{iCFI,1}),c]; - tConst = CFIforms{iCFI,2}; - tFnames = [eval(CFIforms{iCFI,3}),{cname}]; - [c,cname] = spm_DesMtx(tI,tConst,tFnames); - elseif size(c,2)>1 %-Design matrix block - [null,cname] = spm_DesMtx(c,'X',cname); - else - cname = {cname}; - end - - %-Store raw covariate details in xC struct for reference - %-Pack c into appropriate DesMtx partition - %--------------------------------------------------------------- - %-Construct description string for covariate - str = {sprintf('%s: %s',str,rcname)}; - if size(rc,2)>1, str = {sprintf('%s (block of %d covariates)',... - str{:},size(rc,2))}; end - if iCC < 8, str=[str;{['used centered ',sCC{iCC}]}]; end - if iCFI> 1, str=[str;{['fitted as interaction ',sCFI{iCFI}]}]; end - - tmp = struct( 'rc',rc, 'rcname',rcname,... - 'c',c, 'cname',{cname},... - 'iCC',iCC, 'iCFI',iCFI,... - 'type',i,... - 'cols',[1:size(c,2)] + ... - size([H,C{1}],2) + ... - size([B,C{2}],2)*(i-1),... - 'descrip',{str} ); - if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end - C{i} = [C{i},c]; - Cnames{i} = [Cnames{i}; cname]; - - end % (while) - -end % (for) -clear c tI tConst tFnames -spm_input('!SetNextPos',GUIpos); - -%-Unpack into C & G design matrix sub-partitions -G = C{2}; Gnames = Cnames{2}; -C = C{1}; Cnames = Cnames{1}; - - -%-Options... -%======================================================================= -%-Global normalization options (GloNorm) -%----------------------------------------------------------------------- -if length(D.iGloNorm)>1 - %-User choice of global normalisation options, default is negative - %-Only offer factor specific for appropriate factor combinations - iGloNorm = intersect(abs(D.iGloNorm),find([1,bFI,1,1])); - dGloNorm = max([0,intersect(iGloNorm,-D.iGloNorm(D.iGloNorm<0))]); - iGloNorm = spm_input('GloNorm: Select global normalisation','+1','m',... - sGloNorm(iGloNorm),iGloNorm,find(iGloNorm==dGloNorm)); -else - iGloNorm = abs(D.iGloNorm); -end - - -%-Grand mean scaling options (GMsca) -%----------------------------------------------------------------------- -if iGloNorm==8 - iGMsca=8; %-grand mean scaling implicit in PropSca GloNorm -elseif length(D.iGMsca)==1 - iGMsca = abs(D.iGMsca); -else - %-User choice of grand mean scaling options - %-Only offer factor specific for appropriate factor combinations - iGMsca = intersect(abs(D.iGMsca),find([1,bFI,0,1])); - %-Default is max -ve option in D, overridden by iGloNorm if AnCova - if iGloNorm==9, dGMsca=-D.iGMsca(D.iGMsca<0); else, dGMsca=iGloNorm; end - dGMsca = max([0,intersect(iGMsca,dGMsca)]); - iGMsca = spm_input('GMsca: grand mean scaling','+1','m',... - sGMsca(iGMsca),iGMsca,find(iGMsca==dGMsca)); -end - - -%-Value for PropSca / GMsca (GM) -%----------------------------------------------------------------------- -if iGMsca == 9 %-Not scaling (GMsca or PropSca) - GM = 0; %-Set GM to zero when not scaling -else %-Ask user value of GM - if iGloNorm==8 - str = 'PropSca global mean to'; - else - str = [strrep(sGMsca{iGMsca},'scaling of','scale'),' to']; - end - GM = spm_input(str,'+1','r',D.GM,1); - %-If GM is zero then don't GMsca! or PropSca GloNorm - if GM==0, iGMsca=9; if iGloNorm==8, iGloNorm=9; end, end -end - -%-Sort out description strings for GloNorm and GMsca -%----------------------------------------------------------------------- -sGloNorm = sGloNorm{iGloNorm}; -sGMsca = sGMsca{iGMsca}; -if iGloNorm==8 - sGloNorm = sprintf('%s to %-4g',sGloNorm,GM); -elseif iGMsca<8 - sGMsca = sprintf('%s to %-4g',sGMsca,GM); -end - - -%-Global centering (for AnCova GloNorm) (GC) -%----------------------------------------------------------------------- -%-Specify the centering option for the global covariate for AnCova -%-Basically, if 'GMsca'ling then should centre to GM (iGC=11). Otherwise, -% should centre in similar fashion to AnCova (i.e. by the same factor(s)), -% such that models are seperable (iGC=10). This is particularly important -% for subject specific condition effects if then passed on to a second-level -% model. (See also spm_adjmean_ui.m) SPM96 (& earlier) used to just centre -% GX around its (overall) mean (iGC=1). - -%-This code allows more general options to be specified (but is a bit complex) -%-Setting D.iGC=[-10,-11] gives the standard choices above - -%-If not doing AnCova then GC is irrelevant -if ~any(iGloNorm == [1:7]) - iGC = 12; - gc = []; -else - %-Annotate options 10 & 11 with specific details - %--------------------------------------------------------------- - %-Tag '(as implied by AnCova)' with actual AnCova situation - sCC{10} = [sCC{iGloNorm},' (<= ',sGloNorm,')']; - %-Tag 'GM' case with actual GM & GMsca case - sCC{11} = sprintf('around GM=%g (i.e. %s after grand mean scaling)',... - GM,strrep(sCC{iGMsca},'around ','')); - - %-Constuct vector of allowable iGC - %--------------------------------------------------------------- - %-Weed out redundent factor combinations from pre-set allowable options - iGC = intersect(abs(D.iGC),find([1,bFI,1,1,1,1])); - %-Omit 'GM' option if didn't GMsca (iGMsca~=8 'cos doing AnCova) - if any(iGMsca==[8,9]), iGC = setdiff(iGC,11); end - %-Omit 'GM' option if same as '(as implied by AnCova)' - if iGloNorm==iGMsca, iGC = setdiff(iGC,11); end - - %-If there's a choice, set defaults (if any), & get answer - %--------------------------------------------------------------- - if length(iGC)>1 - dGC = max([0,intersect(iGC,-D.iGC(D.iGC<0))]); - str = 'Centre global covariate'; - if iGMsca<8, str = [str,' (after grand mean scaling)']; end - iGC = spm_input(str,'+1','m',sCC(iGC),iGC,find(iGC==dGC)); - elseif isempty(iGC) - error('Configuration error: empty iGC') - end - - %-If 'user specified' then get value - %--------------------------------------------------------------- - if iGC==9 - gc = spm_input('Centre globals around','+0','r',D.GM,1); - sCC{9} = sprintf('%s of %g',sCC{iGC},gc); - else - gc = 0; - end -end - - -%-Thresholds & masks defining voxels to analyse (MASK) -%======================================================================= -GUIpos = spm_input('!NextPos'); - -%-Analysis threshold mask -%----------------------------------------------------------------------- -%-Work out available options: -% -Inf=>None, real=>absolute, complex=>proportional, (i.e. times global) -M_T = D.M_.T; if isempty(M_T), M_T = [-Inf, 100, 0.8*sqrt(-1)]; end -M_T = { 'none', M_T(min(find(isinf(M_T))));... - 'absolute', M_T(min(find(isfinite(M_T)&(M_T==real(M_T)))));... - 'relative', M_T(min(find(isfinite(M_T)&(M_T~=real(M_T))))) }; - -%-Work out available options -%-If there's a choice between proportional and absolute then ask -%----------------------------------------------------------------------- -q = ~[isempty(M_T{1,2}), isempty(M_T{2,2}), isempty(M_T{3,2})]; - -if all(q(2:3)) - tmp = spm_input('Threshold masking',GUIpos,'b',M_T(q,1),find(q)); - q(setdiff([1:3],tmp))=0; -end - -%-Get mask value - note that at most one of q(2:3) is true -%----------------------------------------------------------------------- -if ~any(q) %-Oops - nothing specified! - M_T = -Inf; -elseif all(q==[1,0,0]) %-no threshold masking - M_T = -Inf; -else %-get mask value - if q(1), args = {'br1','None',-Inf,abs(M_T{1+find(q(2:3)),2})}; - else, args = {'r',abs(M_T{1+find(q(2:3)),2})}; end - if q(2) - M_T = spm_input('threshold',GUIpos,args{:}); - elseif q(3) - M_T = spm_input('threshold (relative to global)',GUIpos,... - args{:}); - if isfinite(M_T) & isreal(M_T), M_T=M_T*sqrt(-1); end - else - error('Shouldn''t get here!') - end -end - -%-Make a description string -%----------------------------------------------------------------------- -if isinf(M_T) - xsM.Analysis_threshold = 'None (-Inf)'; -elseif isreal(M_T) - xsM.Analysis_threshold = sprintf('images thresholded at %6g',M_T); -else - xsM.Analysis_threshold = sprintf(['images thresholded at %6g ',... - 'times global'],imag(M_T)); -end - - -%-Implicit masking: Ignore zero voxels in low data-types? -%----------------------------------------------------------------------- -% (Implicit mask is NaN in higher data-types.) -type = mars_vol_utils('type', spm_vol(P{1,1})); -if ~spm_type(type,'nanrep') - switch D.M_.I - case Inf, M_I = spm_input('Implicit mask (ignore zero''s)?',... - '+1','y/n',[1,0],1); %-Ask - case {0,1}, M_I = D.M_.I; %-Pre-specified - otherwise, error('unrecognised D.M_.I type') - end - - if M_I, xsM.Implicit_masking = 'Yes: zero''s treated as missing'; - else, xsm.Implicit_masking = 'No'; end -else - M_I = 1; - xsM.Implicit_masking = 'Yes: NaN''s treated as missing'; -end - - -%-Explicit mask images (map them later...) -%----------------------------------------------------------------------- -switch(D.M_.X) -case Inf, M_X = spm_input('explicitly mask images?','+1','y/n',[1,0],2); -case {0,1}, M_X = D.M_.X; -otherwise, error('unrecognised D.M_.X type') -end -if M_X, M_P = spm_get(Inf,img_flt,{'select mask images'}); else, M_P = {}; end - - -%-Global calculation (GXcalc) -%======================================================================= -iGXcalc = abs(D.iGXcalc); -%-Only offer "omit" option if not doing any GloNorm, GMsca or PropTHRESH -if ~(iGloNorm==9 & iGMsca==9 & (isinf(M_T)|isreal(M_T))) - iGXcalc = intersect(iGXcalc,[2:size(sGXcalc,1)]); -end -if isempty(iGXcalc) - error('no GXcalc options') -elseif length(iGXcalc)>1 - %-User choice of global calculation options, default is negative - dGXcalc = max([1,intersect(iGXcalc,-D.iGXcalc(D.iGXcalc<0))]); - iGXcalc = spm_input('Global calculation','+1','m',... - sGXcalc(iGXcalc),iGXcalc,find(iGXcalc==dGXcalc)); -else - iGXcalc = abs(D.iGXcalc); -end - -if iGXcalc==2 %-Get user specified globals - g = spm_input('globals','+0','r',[],[nScan,1]); -end -sGXcalc = sGXcalc{iGXcalc}; - - -% Non-sphericity correction -%======================================================================= - -% if there are multilevel factors, ask for correction -%----------------------------------------------------------------------- -if length(find(max(I) > 1)) > 1 - xVi.iid = spm_input('non-sphericity correction?','+1','y/n',[0,1],1); -else - xVi.iid = 1; -end - - -if xVi.iid - - % i.i.d. assumptions where xVi.V = 1 - %--------------------------------------------------------------- - xVi.V = speye(nScan); - -else - % otherwise, we have repeated measures design - %=============================================================== - nL = max(I); % number of levels - mL = find(nL > 1); % multilevel factors - xVi.I = I; - xVi.sF = D.sF; - xVi.var = sparse(1,4); - xVi.dep = sparse(1,4); - - - % eliminate replication factor from mL - %--------------------------------------------------------------- - for i = 1:4 - mstr{i} = sprintf('%s (%i)',D.sF{i},nL(i)); - end - str = 'replications are over?'; - rep = spm_input(str,'+1','m',mstr(mL),1:length(mL)); - - % and ask whether repeated measures are independent - %--------------------------------------------------------------- - str = 'correlated repeated measures'; - dep = spm_input(str,'+1','b',{'yes','no'},[1 0],1); - - - %-Place covariance components Q{:} in xVi.Vi - %--------------------------------------------------------------- - mL(rep) = []; - xVi.var(mL) = 1; - xVi.dep(mL) = dep; - xVi = spm_non_sphericity(xVi); - -end - - -%======================================================================= -% - C O N F I G U R E D E S I G N -%======================================================================= -spm('FigName','Stats: configuring',Finter,CmdLine); -spm('Pointer','Watch'); - - -%-Images & image info: Map Y image files and check consistency of -% dimensions and orientation / voxel size -%======================================================================= -fprintf('%-40s: ','Mapping files') %-# -VY = spm_vol(char(P)); - - -%-Check compatability of images -%----------------------------------------------------------------------- -[samef msg] = mars_vol_check(VY); -if ~samef, disp(char(msg)),error('Cannot use images'),end; - -fprintf('%30s\n','...done') %-# - - -%-Global values, scaling and global normalisation -%======================================================================= -%-Compute global values -%----------------------------------------------------------------------- -switch iGXcalc, case 1 - %-Don't compute => no GMsca (iGMsca==9) or GloNorm (iGloNorm==9) - g = []; -case 2 - %-User specified globals -case 3 - %-Compute as mean voxel value (within per image fullmean/8 mask) - g = zeros(nScan,1 ); - fprintf('%-40s: %30s','Calculating globals',' ') %-# - for i = 1:nScan - str = sprintf('%3d/%-3d',i,nScan); - fprintf('%s%30s',repmat(sprintf('\b'),1,30),str)%-# - g(i) = spm_global(VY(i)); - end - fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-# -otherwise - error('illegal iGXcalc') -end -rg = g; - - -fprintf('%-40s: ','Design configuration') %-# - - -%-Scaling: compute global scaling factors gSF required to implement proportional -% scaling global normalisation (PropSca) or grand mean scaling (GMsca), -% as specified by iGMsca (& iGloNorm) -%----------------------------------------------------------------------- -switch iGMsca, case 8 - %-Proportional scaling global normalisation - if iGloNorm~=8, error('iGloNorm-iGMsca(8) mismatch for PropSca'), end - gSF = GM./g; - g = GM*ones(nScan,1); -case {1,2,3,4,5,6,7} - %-Grand mean scaling according to iGMsca - gSF = GM./spm_meanby(g,eval(CCforms{iGMsca})); - g = g.*gSF; -case 9 - %-No grand mean scaling - gSF = ones(nScan,1); -otherwise - error('illegal iGMsca') -end - - -%-Apply gSF to memory-mapped scalefactors to implement scaling -%----------------------------------------------------------------------- -for i = 1:nScan - VY(i).pinfo(1:2,:) = VY(i).pinfo(1:2,:)*gSF(i); -end - - -%-AnCova: Construct global nuisance covariates partition (if AnCova) -%----------------------------------------------------------------------- -if any(iGloNorm == [1:7]) - - %-Centre global covariate as requested - %--------------------------------------------------------------- - switch iGC, case {1,2,3,4,5,6,7} %-Standard sCC options - gc = spm_meanby(g,eval(CCforms{iGC})); - case 8 %-No centering - gc = 0; - case 9 %-User specified centre - %-gc set above - case 10 %-As implied by AnCova option - gc = spm_meanby(g,eval(CCforms{iGloNorm})); - case 11 %-Around GM - gc = GM; - otherwise %-unknown iGC - error('unexpected iGC value') - end - - - %-AnCova - add scaled centred global to DesMtx `G' partition - %--------------------------------------------------------------- - rcname = 'global'; - tI = [eval(CFIforms{iGloNorm,1}),g - gc]; - tConst = CFIforms{iGloNorm,2}; - tFnames = [eval(CFIforms{iGloNorm,3}),{rcname}]; - [f,gnames] = spm_DesMtx(tI,tConst,tFnames); - clear tI tConst tFnames - - %-Save GX info in xC struct for reference - %--------------------------------------------------------------- - str = {sprintf('%s: %s',dstr{2},rcname)}; - if any(iGMsca==[1:7]), str=[str;{['(after ',sGMsca,')']}]; end - if iGC ~= 8, str=[str;{['used centered ',sCC{iGC}]}]; end - if iGloNorm > 1 - str=[str;{['fitted as interaction ',sCFI{iGloNorm}]}]; - end - tmp = struct( 'rc',rg.*gSF, 'rcname',rcname,... - 'c',f, 'cname' ,{gnames},... - 'iCC',iGC, 'iCFI' ,iGloNorm,... - 'type', 3,... - 'cols',[1:size(f,2)] + size([H C B G],2),... - 'descrip', {str} ); - - G = [G,f]; Gnames = [Gnames; gnames]; - if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end - - -elseif iGloNorm==8 | iGXcalc>1 - - %-Globals calculated, but not AnCova: Make a note of globals - %--------------------------------------------------------------- - if iGloNorm==8 - str = { 'global values: (used for proportional scaling)';... - '("raw" unscaled globals shown)'}; - elseif isfinite(M_T) & ~isreal(M_T) - str = { 'global values: (used to compute analysis threshold)'}; - else - str = { 'global values: (computed but not used)'}; - end - - rcname ='global'; - tmp = struct( 'rc',rg, 'rcname',rcname,... - 'c',{[]}, 'cname' ,{{}},... - 'iCC',0, 'iCFI' ,0,... - 'type', 3,... - 'cols', {[]},... - 'descrip', {str} ); - - if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end -end - - -%-Save info on global calculation in xGX structure -%----------------------------------------------------------------------- -xGX = struct(... - 'iGXcalc',iGXcalc, 'sGXcalc',sGXcalc, 'rg',rg,... - 'iGMsca',iGMsca, 'sGMsca',sGMsca, 'GM',GM,'gSF',gSF,... - 'iGC', iGC, 'sGC', sCC{iGC}, 'gc', gc,... - 'iGloNorm',iGloNorm, 'sGloNorm',sGloNorm); - - - -%-Construct masking information structure and compute actual analysis -% threshold using scaled globals (rg.*gSF) -%----------------------------------------------------------------------- -if isreal(M_T), M_TH = M_T * ones(nScan,1); %-NB: -Inf is real -else, M_TH = imag(M_T) * (rg.*gSF); end - -if ~isempty(M_P) - VM = spm_vol(char(M_P)); - xsM.Explicit_masking = [{'Yes: mask images :'};{VM.fname}']; -else - VM = []; - xsM.Explicit_masking = 'No'; -end -xM = struct('T',M_T, 'TH',M_TH, 'I',M_I, 'VM',{VM}, 'xs',xsM); - - -%-Construct full design matrix (X), parameter names and structure (xX) -%======================================================================= -X = [H C B G]; -tmp = cumsum([size(H,2), size(C,2), size(B,2), size(G,2)]); -xX = struct( 'X', X,... - 'iH', [1:size(H,2)],... - 'iC', [1:size(C,2)] + tmp(1),... - 'iB', [1:size(B,2)] + tmp(2),... - 'iG', [1:size(G,2)] + tmp(3),... - 'name', {[Hnames; Cnames; Bnames; Gnames]},... - 'I', I,... - 'sF', {D.sF}); - - -%-Design description (an nx2 cellstr) - for saving and display -%======================================================================= -tmp = { sprintf('%d condition, +%d covariate, +%d block, +%d nuisance',... - size(H,2),size(C,2),size(B,2),size(G,2));... - sprintf('%d total, having %d degrees of freedom',... - size(X,2),rank(X));... - sprintf('leaving %d degrees of freedom from %d images',... - size(X,1)-rank(X),size(X,1)) }; -xsDes = struct( 'Design', {D.DesName},... - 'Global_calculation', {sGXcalc},... - 'Grand_mean_scaling', {sGMsca},... - 'Global_normalisation', {sGloNorm},... - 'Parameters', {tmp} ); - - -fprintf('%30s\n','...done') %-# - - - -%-Assemble SPM structure -%======================================================================= -SPM.xY.P = P; % filenames -SPM.xY.VY = VY; % mapped data -SPM.nscan = size(xX.X,1); % scan number -SPM.xX = xX; % design structure -SPM.xC = xC; % covariate structure -SPM.xGX = xGX; % global structure -SPM.xVi = xVi; % non-sphericity structure -SPM.xM = xM; % mask structure -SPM.xsDes = xsDes; % description -SPM.SPMid = SPMid; % version - -varargout = {SPM}; - -%-End: Cleanup GUI -%======================================================================= -spm_clf(Finter) -spm('Pointer','Arrow') -fprintf('%-40s: %30s\n','Completed',spm('time')) %-# -spm('FigName','Stats: configured',Finter,CmdLine); -spm('Pointer','Arrow') -fprintf('\n\n') - - - -case 'files&indices' -%======================================================================= -% - Get files and factor indices -%======================================================================= -% [P,I] = pr_spm_ui('Files&Indices',DsF,Dn,DbaTime,nV) -% DbaTime=D.b.aTime; Dn=D.n; DsF=D.sF; -if nargin<5, nV = 1; else, nV = varargin{5}; end -if nargin<4, DbaTime = 1; else, DbaTime = varargin{4}; end -if nargin<3, Dn = [Inf,Inf,Inf,Inf]; else, Dn=varargin{3}; end -if nargin<2, DsF = {'Fac1','Fac2','Fac3','Fac4'}; else, DsF=varargin{2}; end - -%-Initialise variables -%----------------------------------------------------------------------- -i4 = []; % factor 4 index (usually group) -i3 = []; % factor 3 index (usually subject), per f4 -i2 = []; % factor 2 index (usually condition), per f3/f4 -i1 = []; % factor 1 index (usually replication), per f2/f3/f4 -P = {}; % cell array of string filenames - -%-Accrue filenames and factor level indicator vectors -%----------------------------------------------------------------------- -bMV = nV>1; -if isinf(Dn(4)), n4 = spm_input(['#',DsF{4},'''s'],'+1','n1'); - else, n4 = Dn(4); end -bL4 = n4>1; - -ti2 = ''; -GUIpos = spm_input('!NextPos'); -for j4 = 1:n4 - spm_input('!SetNextPos',GUIpos); - sF4P=''; if bL4, sF4P=[DsF{4},' ',int2str(j4),': ']; end - if isinf(Dn(3)), n3=spm_input([sF4P,'#',DsF{3},'''s'],'+1','n1'); - else, n3 = Dn(3); end - bL3 = n3>1; - - if DbaTime & Dn(2)>1 - %disp('NB:selecting in time order - manually specify conditions') - %-NB: This means f2 levels might not be 1:n2 - GUIpos2 = spm_input('!NextPos'); - for j3 = 1:n3 - sF3P=''; if bL3, sF3P=[DsF{3},' ',int2str(j3),': ']; end - str = [sF4P,sF3P]; - tP = {}; - n21 = Dn(2)*Dn(1); - for v=1:nV - vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end - ttP = spm_get(n21,img_flt,{[str,'select images',vstr]}); - n21 = length(ttP); - tP = [tP,ttP]; - end - ti2 = spm_input([str,' ',DsF{2},'?'],GUIpos2,'c',ti2',n21,Dn(2)); - %-Work out i1 & check - [tl2,null,j] = unique(ti2); - tn1 = zeros(size(tl2)); ti1 = zeros(size(ti2)); - for i=1:length(tl2) - tn1(i)=sum(j==i); ti1(ti2==tl2(i))=1:tn1(i); end - if isfinite(Dn(1)) & any(tn1~=Dn(1)) - %-#i1 levels mismatches specification in Dn(1) - error(sprintf('#%s not %d as pre-specified',DsF{1},Dn(1))) - end - P = [P;tP]; - i4 = [i4; j4*ones(n21,1)]; - i3 = [i3; j3*ones(n21,1)]; - i2 = [i2; ti2]; - i1 = [i1; ti1]; - end - - else - - if isinf(Dn(2)) - n2 = spm_input([sF4P,'#',DsF{2},'''s'],'+1','n1'); - else - n2 = Dn(2); - end - bL2 = n2>1; - - if n2==1 & Dn(1)==1 %-single scan per f3 (subj) - %disp('NB:single scan per f3') - str = [sF4P,'select images, ',DsF{3},' 1-',int2str(n3)]; - tP = {}; - for v=1:nV - vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end - ttP = spm_get(n3,img_flt,{[str,vstr]}); - tP = [tP,ttP]; - end - P = [P;tP]; - i4 = [i4; j4*ones(n3,1)]; - i3 = [i3; [1:n3]']; - i2 = [i2; ones(n3,1)]; - i1 = [i1; ones(n3,1)]; - else - %-multi scan per f3 (subj) case - %disp('NB:multi scan per f3') - for j3 = 1:n3 - sF3P=''; if bL3, sF3P=[DsF{3},' ',int2str(j3),': ']; end - if Dn(1)==1 - %-No f1 (repl) within f2 (cond) - %disp('NB:no f1 within f2') - str = [sF4P,sF3P,'select images: ',DsF{2},... - ' 1-',int2str(n2)]; - tP = {}; - for v=1:nV - vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end - ttP = spm_get(n2,img_flt,{[str,vstr]}); - tP = [tP,ttP]; - end - P = [P;tP]; - i4 = [i4; j4*ones(n2,1)]; - i3 = [i3; j3*ones(n2,1)]; - i2 = [i2; [1:n2]']; - i1 = [i1; ones(n2,1)]; - else - %-multi f1 (repl) within f2 (cond) - %disp('NB:f1 within f2') - for j2 = 1:n2 - sF2P=''; - if bL2, sF2P=[DsF{2},' ',int2str(j2),': ']; end - str = [sF4P,sF3P,sF2P,' select images...']; - tP = {}; - n1 = Dn(1); - for v=1:nV - vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end - ttP = spm_get(n1,img_flt,{[str,vstr]}); - n1 = length(ttP); - tP = [tP,ttP]; - end - P = [P;tP]; - i4 = [i4; j4*ones(n1,1)]; - i3 = [i3; j3*ones(n1,1)]; - i2 = [i2; j2*ones(n1,1)]; - i1 = [i1; [1:n1]']; - end % (for j2) - end % (if Dn(1)==1) - end % (for j3) - end % (if n2==1 &...) - end % (if DbaTime & Dn(2)>1) -end % (for j4) -varargout = {P,[i1,i2,i3,i4]}; - - -case 'desdefs_stats' -%======================================================================= -% - Basic Stats Design definitions... -%======================================================================= -% D = pr_spm_ui('DesDefs_Stats'); -% These are the basic Stats design definitions... - -%-Note: struct expands cell array values to give multiple records: -% => must embed cell arrays within another cell array! -%-Negative indices indicate defaults (first used) - -D = struct(... - 'DesName','One sample t-test',... - 'n', [Inf 1 1 1], 'sF',{{'obs','','',''}},... - 'Hform', 'I(:,2),''-'',''mean''',... - 'Bform', '[]',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',-Inf,'I',Inf,'X',Inf),... - 'b',struct('aTime',0)); - -D = [D, struct(... - 'DesName','Two sample t-test',... - 'n', [Inf 2 1 1], 'sF',{{'obs','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',1))]; - -D = [D, struct(... - 'DesName','Paired t-test',... - 'n', [1 2 Inf 1], 'sF',{{'','cond','pair',''}},... - 'Hform', 'I(:,2),''-'',''condition''',... - 'Bform', 'I(:,3),''-'',''\gamma''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','One way Anova',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', '[]',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','One way Anova (with constant)',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','One way Anova (Within-subjects)',... - 'n', [1 Inf Inf 1],'sF',{{'repl','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','Simple regression (correlation)',... - 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,2),''-'',''\mu''',... - 'nC',[1,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - - -D = [D, struct(... - 'DesName','Multiple regression',... - 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},... - 'Hform', '[]',... - 'Bform', '[]',... - 'nC',[Inf,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','Multiple regression (with constant)',... - 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,2),''-'',''\mu''',... - 'nC',[Inf,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','AnCova',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,1],'iCC',{{8,1}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - -varargout = {D}; - - -case 'desdefs_pet' -%======================================================================= -% - Standard (SPM99) PET/SPECT Design definitions... -%======================================================================= -% D = pr_spm_ui('DesDefs_PET'); -% These are the standard PET design definitions... - -%-Single subject -%----------------------------------------------------------------------- -D = struct(... - 'DesName','Single-subject: conditions & covariates',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[Inf,Inf],'iCC',{{[-1,3,8],[-1,8]}},'iCFI',{{[1,3],1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1)); - -D = [D, struct(... - 'DesName','Single-subject: covariates only',... - 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[Inf,Inf],'iCC',{{[-1,8],[-1,8]}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1))]; - -%-Multi-subject -%----------------------------------------------------------------------- -D = [D, struct(... - 'DesName','Multi-subj: conditions & covariates',... - 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{[1,3,4,8],[1,4,8]}},'iCFI',{{[1,3,-4],[1,-4]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,... - 'iGloNorm',[4,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1))]; - -D = [D, struct(... - 'DesName','Multi-subj: cond x subj interaction & covariates',... - 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},... - 'Hform', 'I(:,[3,2]),''-'',{''subj'',''cond''}',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{[1,3,4,8],[1,4,8]}},'iCFI',{{[1,3,-4],[1,-4]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,... - 'iGloNorm',[4,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1))]; - -D = [D, struct(... - 'DesName','Multi-subj: covariates only',... - 'n',[Inf 1 Inf 1], 'sF',{{'repl','','subject',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{[1,4,8],[1,4,8]}},'iCFI',{{[1,-4],[1,-4]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,... - 'iGloNorm',[4,8:9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -%-Multi-group -%----------------------------------------------------------------------- -D = [D, struct(... - 'DesName','Multi-group: conditions & covariates',... - 'n',[Inf Inf Inf Inf], 'sF',{{'repl','condition','subject','group'}},... - 'Hform', 'I(:,[4,2]),''-'',{''stud'',''cond''}',... - 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{[5:8],[5,7,8]}},'iCFI',{{[1,5,6,-7],[1,5,-7]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-7,9],'GM',50,... - 'iGloNorm',[7,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1))]; - -D = [D, struct(... - 'DesName','Multi-group: covariates only',... - 'n',[Inf 1 Inf Inf], 'sF',{{'repl','','subject','group'}},... - 'Hform', '[]',... - 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{[5,7,8],[5,7,8]}},'iCFI',{{[1,5,-7],[1,5,-7]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-7,9],'GM',50,... - 'iGloNorm',[7,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -%-Population comparisons -%----------------------------------------------------------------------- -D = [D, struct(... - 'DesName',... - 'Population main effect: 2 cond''s, 1 scan/cond (paired t-test)',... - 'n',[1 2 Inf 1], 'sF',{{'','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName',... - 'Dodgy population main effect: >2 cond''s, 1 scan/cond',... - 'n',[1 Inf Inf 1], 'sF',{{'','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','Compare-populations: 1 scan/subject (two sample t-test)',... - 'n',[Inf 2 1 1], 'sF',{{'subject','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','Compare-populations: 1 scan/subject (AnCova)',... - 'n',[Inf 2 1 1], 'sF',{{'subject','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,Inf],'iCC',{{8,1}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -%-The Full Monty! -%----------------------------------------------------------------------- -D = [D, struct(... - 'DesName','The Full Monty...',... - 'n',[Inf Inf Inf Inf], 'sF',{{'repl','cond','subj','group'}},... - 'Hform', 'I(:,[4,2]),''-'',{''stud'',''cond''}',... - 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{[1:8],[1:8]}},'iCFI',{{[1:7],[1:7]}},... - 'iGXcalc',[1,2,3],'iGMsca',[1:7],'GM',50,... - 'iGloNorm',[1:9],'iGC',[1:11],... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',1))]; - - -varargout = {D}; - -case 'desdefs_pet96' -%======================================================================= -% - SPM96 PET/SPECT Design definitions... -%======================================================================= -% D = pr_spm_ui('DesDefs_PET96'); - -%-Single subject -%----------------------------------------------------------------------- -D = struct(... - 'DesName','SPM96:Single-subject: replicated conditions',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0)); - -D = [D, struct(... - 'DesName','SPM96:Single-subject: replicated conditions & covariates',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Single-subject: covariates only',... - 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -%-Multi-subject -%----------------------------------------------------------------------- -D = [D, struct(... - 'DesName','SPM96:Multi-subject: different conditions',... - 'n', [1 Inf Inf 1], 'sF',{{'','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''scancond''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-subject: replicated conditions',... - 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-subject: different conditions & covariates',... - 'n', [1 Inf Inf 1], 'sF',{{'','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,4],[1,4]}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-subject: replicated conditions & covariates',... - 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''condition''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,3,4],[1,4]}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-subject: covariates only',... - 'n',[Inf 1 Inf 1], 'sF',{{'repl','','subject',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{[1,4,8],[1,4,8]}},'iCFI',{{[1,4],[1,4]}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -%-Multi-study -%----------------------------------------------------------------------- -D = [D, struct(... - 'DesName','SPM96:Multi-study: different conditions',... - 'n',[1 Inf Inf Inf], 'sF',{{'','cond','subj','study'}},... - 'Hform', 'I(:,[4,2]),''-'',{''study'',''cond''}',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-study: replicated conditions',... - 'n',[Inf Inf Inf Inf], 'sF',{{'repl','cond','subj','study'}},... - 'Hform', 'I(:,[4,2]),''-'',{''study'',''condition''}',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-study: different conditions & covariates',... - 'n',[1 Inf Inf Inf], 'sF',{{'','cond','subj','study'}},... - 'Hform', 'I(:,[4,2]),''-'',{''study'',''cond''}',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,6,7],[1,5,7]}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-study: replicated conditions & covariates',... - 'n',[Inf Inf Inf Inf], 'sF',{{'','cond','subj','study'}},... - 'Hform', 'I(:,[4,2]),''-'',{''study'',''condition''}',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,6,7],[1,5,7]}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-study: covariates only',... - 'n',[Inf 1 Inf Inf], 'sF',{{'repl','','subj','study'}},... - 'Hform', '[]',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,7],[1,5,7]}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -%-Group comparisons -%----------------------------------------------------------------------- -D = [D, struct(... - 'DesName','SPM96:Compare-groups: 1 scan per subject',... - 'n',[Inf Inf 1 1], 'sF',{{'subject','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', '[]',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -varargout = {D}; - - -otherwise -%======================================================================= -% - U N K N O W N A C T I O N -%======================================================================= -warning(['Illegal Action string: ',Action]) - - -%======================================================================= -% - E N D -%======================================================================= -end - - - - -%======================================================================= -%- S U B - F U N C T I O N S -%======================================================================= - -function str = sf_estrrep(str,srstr) -%======================================================================= -for i = 1:size(srstr,1) - str = strrep(str,srstr{i,1},srstr{i,2}); -end diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_volterra.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_volterra.m deleted file mode 100644 index 2ed9fb5..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_volterra.m +++ /dev/null @@ -1,91 +0,0 @@ -function [X,Xname,Fc] = spm_Volterra(U,bf,V) -% generalized convolution of inputs (U) with basis set (bf) -% FORMAT [X,Xname,Fc] = spm_Volterra(U,bf,V); -% U - input structure array -% bf - Basis functions -% V - [1 or 2] order of Volterra expansion [default = 1] -% -% X - Design Matrix -% Xname - names of regressors [columns] in X -% Fc(j).i - indices pertaining to input i (and interactions) -% Fc(j).name - names pertaining to input i (and interactions) -%___________________________________________________________________________ -% -% For first order expansions spm_Volterra simply convolves the causes -% (e.g. stick functions) in U.u by the basis functions in bf to create -% a design matrix X. For second order expansions new entries appear -% in ind, bf and name that correspond to the interaction among the -% orginal causes. The basis functions for these efects are two dimensional -% and are used to assemble the second order kernel in spm_graph.m. -% Second order effects are computed for only the first column of U.u. -%___________________________________________________________________________ -% @(#)spm_Volterra.m 2.3 Karl Friston 02/04/19 - - -% 1st order terms -%--------------------------------------------------------------------------- -if nargin == 2, V == 1; end - -% Construct X -%=========================================================================== - -% 1st order terms -%--------------------------------------------------------------------------- -X = []; -Xname = {}; -ind = {}; -Uname = {}; -Fc = {}; -for i = 1:length(U) - ind = []; - for k = 1:size(U(i).u,2) - for p = 1:size(bf,2) - x = U(i).u(:,k); - d = 1:length(x); - x = conv(full(x),bf(:,p)); - x = x(d); - X = [X x]; - - % indices and regressor names - %----------------------------------------------------------- - str = sprintf('%s*bf(%i)',U(i).name{k},p); - Xname{end + 1} = str; - ind(end + 1) = size(X,2); - end - end - Fc(end + 1).i = ind; - Fc(end).name = U(i).name{1}; -end - -% return if first order -%--------------------------------------------------------------------------- -if V == 1, return, end - -% 2nd order terms -%--------------------------------------------------------------------------- -for i = 1:length(U) -for j = i:length(U) - ind = []; - for p = 1:size(bf,2) - for q = 1:size(bf,2) - x = U(i).u(:,1); - y = U(j).u(:,1); - x = conv(full(x),bf(:,p)); - y = conv(full(y),bf(:,q)); - x = x(d); - y = y(d); - X = [X x.*y]; - - % indices and regressor names - %----------------------------------------------------------- - str = sprintf('%s*bf(%i)x%s*bf(%i)',... - U(i).name{1},p,... - U(j).name{1},q); - Xname{end + 1} = str; - ind(end + 1) = size(X,2); - end - end - Fc(end + 1).i = ind; - Fc(end).name = [U(i).name{1} 'x' U(j).name{1}]; -end -end diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_stat_compute.m b/lib/marsbar-0.44/@mardo_2/private/pr_stat_compute.m deleted file mode 100644 index dcc2247..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_stat_compute.m +++ /dev/null @@ -1,81 +0,0 @@ -function [con,stat,Ps,Pc] = pr_stat_compute(SPM,Ic) -% private function to compute statistics for SPM2 design -% FORMAT [con stat Ps Pc] = pr_stat_compute(SPM,Ic) -% -% Input -% SPM - SPM design structure -% Ic - indices into contrast structure (xCon in SPM) -% -% Output -% con - contrast value (ess for F test) -% stat - statistic value -% Ps - uncorrected p value -% Pc - P value Bonferroni corrected for number of columns analyzed -% -% Based on: -% @(#)spm_contrasts.m 2.3 Andrew Holmes, Karl Friston & Jean-Baptiste Poline 02/12/30 -% -% $Id$ - -%-Get contrast definitions (if available) -%----------------------------------------------------------------------- -try - xCon = SPM.xCon; -catch - xCon = []; -end - -%-set all contrasts by default -%----------------------------------------------------------------------- -if nargin < 2 - Ic = 1:length(xCon); -end -if any(Ic > length(xCon)) - error('Indices too large for contrast structure'); -end - -% OLS estimators and error variance estimate -%---------------------------------------------------------------- -betas = SPM.betas; -Hp = SPM.ResidualMS; - -%-Compute contrast and statistic parameters -%======================================================================= -df = [NaN SPM.xX.erdf]; -for i = 1:length(Ic) - - %-Canonicalise contrast structure with required fields - %------------------------------------------------------------------- - ic = Ic(i); - X1o = spm_FcUtil('X1o',xCon(ic),SPM.xX.xKXs); - [trMV,trMVMV] = spm_SpUtil('trMV',X1o,SPM.xX.V); - df(1) = trMV^2/trMVMV; % eidf - - switch(xCon(ic).STAT) - - case {'T'} %-Implement contrast as sum of betas - - con(i,:) = xCon(ic).c'*betas; - VcB = xCon(ic).c'*SPM.xX.Bcov*xCon(ic).c; - stat(i,:) = con(i,:)./sqrt(Hp*VcB); - Ps(i,:) = 1 - spm_Tcdf(stat(i,:),df(2)); - - case 'F' %-Implement ESS - - %-Residual (in parameter space) forming mtx - %----------------------------------------------------------- - h = spm_FcUtil('Hsqr',xCon(ic),SPM.xX.xKXs); - con(i,:) = sum((h * betas).^2, 1); - stat(i,:) = con(i,:) ./ Hp / trMV; - Ps(i,:) = (1 - spm_Fcdf(stat(i,:),df)); - - otherwise - %--------------------------------------------------------------- - error(['unknown STAT "',xCon(ic).STAT,'"']) - - end % (switch(xCon...) -end - -% Compute corrected Bonferroni (corrected for number of regions) -n = size(betas, 2); -Pc = 1-(1-Ps).^n; diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_stat_compute_mv.m b/lib/marsbar-0.44/@mardo_2/private/pr_stat_compute_mv.m deleted file mode 100644 index 8726e26..0000000 --- a/lib/marsbar-0.44/@mardo_2/private/pr_stat_compute_mv.m +++ /dev/null @@ -1,153 +0,0 @@ -function [MVres] = pr_stat_compute_mv(SPM,Ic) -% private function to compute mutlivariate statistics across ROIs -% FORMAT [MVres] = pr_stat_compute_mv(SPM,Ic) -% -% Input -% SPM - SPM design structure -% Ic - indices into contrast structure (xCon in SPM) -% -% Output -% MVres - mulitvariate result structure -% -% $Id$ - -%-Get contrast definitions (if available) -%----------------------------------------------------------------------- -try - xCon = SPM.xCon; -catch - xCon = []; -end - -%-set all contrasts by default -%----------------------------------------------------------------------- -if nargin < 2 - Ic = 1:length(xCon); -end -if any(Ic > length(xCon)) - error('Indices too large for contrast structure'); -end - - -% Get relevant fields from design -xCon = xCon(Ic); -Xs = SPM.xX.xKXs; -V = SPM.xX.V; -betas = SPM.betas; -ResidualMS = SPM.ResidualMS; -Y = summary_data(SPM.marsY); - -% setup calculation -[nBetas nROI] = size(betas); -nCon = length(xCon); -[trRV trRVRV] = spm_SpUtil('trRV',Xs,V); -erdf = trRV^2/trRVRV; -RMS = sqrt(ResidualMS); - -%-------------------------------------------------------------------- -%- Multivariate analysis -%-------------------------------------------------------------------- - -MVres = struct('y_pre',[], 'y_obs', [], 'Pf', [], 'u', [], 'ds', [] ); - -if nCon == 1, return, end - -YpY = Y'*Y; - -for ii = 1:nCon - - xC = xCon(ii); - - %-------------------------------------------------------------------- - [NF, nu, h, d, M12, XG, sXG] = sf_model_mlm(Xs, V, nROI, xC, erdf); - - %-------------------------------------------------------------------- - %- Compute svd - %-------------------------------------------------------------------- - %- fprintf('%-40s\n','Computing Principal Components') - - Z = ((NF*betas)./(ones(size(NF,1),1)*RMS)); - S = Z*Z'; - S = S/sum(nROI); - [u s u] = svd(S,0); - ds = diag(s); - clear s; - - - %-------------------------------------------------------------------- - %- STATISTICS if any ... - %-------------------------------------------------------------------- - %- Fq : F values for the last q eigein values. - %- P : P values.for the last q eigein values. - - Fq = zeros(1,h); - for q = 0:h-1; - nu1 = d*(h-q); - nu2 = d*nu - (d-1)*(4*(h-q)+2*nu)/(h-q+2); - Fq(q+1) = ((nu-2)/nu) * nu2/(nu2-2)*sum(ds(q+1:h))/(h-q); - end - Pf = 1 - spm_Fcdf(Fq,nu1,nu2); - - - %- fprintf('%-40s\n','Computing predicted and observed temporal reponse') -%keyboard - - y_pre = (pinv(XG)'* M12 * u)*diag(sqrt(ds)); % predicted temporal reponse - - gV = (diag(1./sqrt(ds))*Z)'*u; - y_obs = (Y./(ones(size(Y,1),1)*RMS)/nROI)*gV; - - %- save results for this constrast - MVres(ii).y_pre = y_pre; - MVres(ii).y_obs = y_obs; - MVres(ii).Pf = Pf; - MVres(ii).u = u; - MVres(ii).ds = ds; - MVres(ii).df = [nu1 nu2]; - -end - - - - - - -%=================================================================== -function [NF,nu,h,d,M12,XG,sXG] = sf_model_mlm(Xs, V, nROI, xC, erdf); -% Set sub-space of interest and the related matrix of normalisation. -% FORMAT [NF,nu,h,d,M12,XG] = mm_model(); -%- nu, h, d : degrees of freedom -%- NF : matrix of normalisation -%=================================================================== - - -%-------------------------------------------------------------------- -%- SET, COMPUTE,NORMALIZE SPACES OF INTEREST -%-------------------------------------------------------------------- -%- set X10 and XG -%- XG= X -PG(X), PG projection operator on XG (cf. eq 1, 2) -%-------------------------------------------------------------------- -sX1o = spm_sp('set',spm_FcUtil('X1o',xC,Xs)); -sXG = spm_sp('set',spm_FcUtil('X0',xC,Xs)); -X1o = spm_sp('oP',sX1o,Xs.X); -XG = spm_sp('r',sXG,Xs.X); - -%- Compute Normalized effexts : M1/2=X'G*V*XG (cf eq 3) -%-------------------------------------------------------------------- -% warning off; -up = spm_sp('ox',sX1o); ; %- PG=up*up' -qi = up'*Xs.X; -sigma = up'*V*up; -M12 = (chol(sigma)*qi)'; -M_12 = pinv(M12); - -%- Compute NF : normalise factor (cf eq 4) -%-------------------------------------------------------------------- -NF = M_12*spm_sp('X',Xs)'*spm_sp('r',sXG,spm_sp('X',Xs)); - -%- degrees of freedom -%- nROI : number of ROI (corresponds to the number of Resels) -%-------------------------------------------------------------------- -d = nROI*(4*log(2)/pi)^(3/2); -h = sX1o.rk; %-rank of the sub-space of interest. -nu = erdf; diff --git a/lib/marsbar-0.44/@mardo_2/save_spm.m b/lib/marsbar-0.44/@mardo_2/save_spm.m deleted file mode 100644 index d93e2fd..0000000 --- a/lib/marsbar-0.44/@mardo_2/save_spm.m +++ /dev/null @@ -1,42 +0,0 @@ -function tf = save_spm(D, fname); -% method to save design as SPM format design structure -% FORMAT tf = save_spm(D, fname); -% -% Inputs -% D - design object -% fname - filename -% -% Outputs -% tf - flag ==1 if successful -% -% $Id$ - -if nargin < 2 - fname = 'SPM.mat'; -end - -% Convert vols to native format -D = convert_vols(D, native_vol_ver(D)); - -SPM = des_struct(D); -if ~mars_utils('isabspath', fname) - Swd = mars_struct('getifthere', SPM, 'swd'); - if isempty(Swd) - error('No path passed, and none in design'); - end - fname = fullfile(Swd, fname); -else - SPM.swd = fileparts(fname); -end - - -try - if verbose(D) - fprintf('Saving design to file %s\n', fname); - end - save(fname, 'SPM'); - tf = 1; -catch - warning(lasterr); - tf = 0; -end diff --git a/lib/marsbar-0.44/@mardo_2/savestruct.m b/lib/marsbar-0.44/@mardo_2/savestruct.m deleted file mode 100644 index c167474..0000000 --- a/lib/marsbar-0.44/@mardo_2/savestruct.m +++ /dev/null @@ -1,28 +0,0 @@ -function savestruct(obj, filename) -% saves data in def_struct into .mat file with variable name SPM -% FORMAT savestruct(object, matname) -% -% $Id$ - -if nargin ~= 2 - error('Need matfile name'); -end - -% allow args to be in reverse order -if ischar(obj) - tmp = obj; - obj = filename; - filename = tmp; -end - -% Convert vols to native format -obj = convert_vols(obj, native_vol_ver(obj)); - -% unobjectify marsy object before save -SPM = des_struct(obj); -if isfield(SPM, 'marsY') - SPM.marsY = y_struct(SPM.marsY); -end - -save(filename,'SPM'); -return diff --git a/lib/marsbar-0.44/@mardo_2/set_images.m b/lib/marsbar-0.44/@mardo_2/set_images.m deleted file mode 100644 index e0e0b42..0000000 --- a/lib/marsbar-0.44/@mardo_2/set_images.m +++ /dev/null @@ -1,12 +0,0 @@ -function marsD = set_images(marsD, VY) -% method to set image vols to design -% -% $Id% - -if nargin < 2 - error('Need image volumes'); -end -D = des_struct(marsD); -D.xY.VY = VY; -D.xY.P = strvcat(VY(:).fname); -marsD = des_struct(marsD, D); diff --git a/lib/marsbar-0.44/@mardo_2/tr.m b/lib/marsbar-0.44/@mardo_2/tr.m deleted file mode 100644 index d57c08f..0000000 --- a/lib/marsbar-0.44/@mardo_2/tr.m +++ /dev/null @@ -1,10 +0,0 @@ -function t = tr(o) -% method returns TR in seconds, or empty if not available -% -% $Id$ - -t = []; -SPM = des_struct(o); -if mars_struct('isthere', SPM, 'xY', 'RT') - t = SPM.xY.RT; -end diff --git a/lib/marsbar-0.44/@mardo_2/type.m b/lib/marsbar-0.44/@mardo_2/type.m deleted file mode 100644 index 38dd59e..0000000 --- a/lib/marsbar-0.44/@mardo_2/type.m +++ /dev/null @@ -1,6 +0,0 @@ -function str = type(o) -% returns SPM version string corresponding to design type -% -% $Id$ - -str = 'SPM2'; diff --git a/lib/marsbar-0.44/@mardo_2/ui_build.m b/lib/marsbar-0.44/@mardo_2/ui_build.m deleted file mode 100644 index d3c8ff6..0000000 --- a/lib/marsbar-0.44/@mardo_2/ui_build.m +++ /dev/null @@ -1,27 +0,0 @@ -function D = ui_build(D, dtype) -% method to create / fill design via GUI -% FORMAT D = ui_build(D, dtype) -% -% D - design object -% dtype - one of 'PET', 'FMRI', 'Basic') -% -% Returns -% D - design object with new design -% -% $Id$ - -if nargin < 2 - error('Need design type'); -end - -switch lower(dtype) - case 'pet' - SPM = pr_spm_ui('cfg',spm_spm_ui('DesDefs_PET')); - case 'basic' - SPM = pr_spm_ui('cfg',spm_spm_ui('DesDefs_Stats')); - case 'fmri' - SPM = pr_fmri_design; - otherwise - error(['Did not recognize design type: ' dtype]); -end -D = des_struct(D, SPM); diff --git a/lib/marsbar-0.44/@mardo_2/ui_get_event.m b/lib/marsbar-0.44/@mardo_2/ui_get_event.m deleted file mode 100644 index 41c344b..0000000 --- a/lib/marsbar-0.44/@mardo_2/ui_get_event.m +++ /dev/null @@ -1,39 +0,0 @@ -function [e_spec, e_name] = ui_get_event(D) -% method to select an event -% FORMAT [e_spec, e_name] = ui_get_event(D) -% D - design -% -% Returns -% e_spec - 2 by 1 matrix with -% e_epec(1) - session number -% e_spec(2) - event number in session -% e_name - name of event -% -% $Id$ - -if ~is_fmri(D) - error('Need FMRI design'); -end -SPM = des_struct(D); -Sess = SPM.Sess; - -% get session -%-------------------------------------------------------------- -s = length(Sess); -if s > 1 - s = spm_input('which session','+1','n1',1,s); -end - -u = length(Sess(s).U); -Uname = {}; -for i = 1:u - Uname{i} = Sess(s).Fc(i).name; -end - -% get effect -%-------------------------------------------------------------- -str = sprintf('which effect'); -u = spm_input(str,'+1','m',Uname); - -e_spec = [s u]'; -e_name = Uname{u}; diff --git a/lib/marsbar-0.44/@mardo_2/ui_get_filter.m b/lib/marsbar-0.44/@mardo_2/ui_get_filter.m deleted file mode 100644 index ba1e37a..0000000 --- a/lib/marsbar-0.44/@mardo_2/ui_get_filter.m +++ /dev/null @@ -1,23 +0,0 @@ -function [D,descrip] = ui_get_filter(D) -% method to get filter via GUI -% FORMAT [D,descrip] = ui_get_filter(D) -% -% Input -% D - design -% -% Returns -% D - design with modified filter -% descrip - cell array of strings describing filter -% -% $Id$ - -SPM = des_struct(D); -[SPM.xX.K str] = pr_get_filter(SPM.xY.RT, SPM.Sess); -if ~isfield(SPM, 'xsDes') - SPM.xsDes = []; -end -SPM.xsDes.High_pass_Filter = str; - -% return args -D = des_struct(D, SPM); -descrip = {str}; diff --git a/lib/marsbar-0.44/@mardo_2/ui_report.m b/lib/marsbar-0.44/@mardo_2/ui_report.m deleted file mode 100644 index 5a7b6f2..0000000 --- a/lib/marsbar-0.44/@mardo_2/ui_report.m +++ /dev/null @@ -1,960 +0,0 @@ -function varargout = ui_report(D, varargin) -% method for SPM2 design reporting -% -% Copied with minor edits from: -% @(#)spm_DesRep.m 2.31 Andrew Holmes 03/03/28 -% -% See that file for detailed commentary -% -% $Id$ - -%-Format arguments -%----------------------------------------------------------------------- -if nargin < 2 - action = 'desrepui'; -else - action = varargin{1}; -end - -%-Generic CallBack code -%----------------------------------------------------------------------- -cb = 'tmp = get(findobj(''Tag'', ''DesRepUI''),''UserData''); '; - -% simplify access to design -SPM = des_struct(D); - -% Add empty fields where necessary -try - SPM.xC; -catch - SPM.xC = {}; -end -try - SPM.xsDes; -catch - SPM.xsDes = []; -end - -switch lower(action) - -%======================================================================= -case 'desrepui' %-Design reporting UI -%======================================================================= -% h = ui_report(D, 'DesRepUI') -% h = ui_report(D, 'DesRepUI',SPM) - -%-Add a scaled design matrix to the design data structure -%----------------------------------------------------------------------- -if ~isfield(SPM.xX,'nKX') - SPM.xX.nKX = spm_DesMtx('Sca',SPM.xX.X,SPM.xX.name); -end - -% put back into design object -D = des_struct(D, SPM); - -%-Draw menu -%======================================================================= - -%-Get Interactive window and delete any previous DesRepUI menu -%----------------------------------------------------------------------- -Finter = spm_figure('GetWin','Interactive'); -delete(findobj(get(Finter,'Children'),'flat','Tag','DesRepUI')) - -%-Draw top level menu -%----------------------------------------------------------------------- -hC = uimenu(Finter,'Label','Design',... - 'Separator','on',... - 'Tag','DesRepUI',... - 'UserData',D,... - 'HandleVisibility','on'); - -%-DesMtx -%----------------------------------------------------------------------- -hDesMtx = uimenu(hC,'Label','Design Matrix','Accelerator','D',... - 'CallBack',[cb,... - 'ui_report(tmp, ''DesMtx'')'],... - 'UserData',hC,... - 'HandleVisibility','off'); - -%-Design matrix orthogonality -%----------------------------------------------------------------------- -h = uimenu(hC,'Label','Design orthogonality','Accelerator','O',... - 'CallBack',[cb,... - 'ui_report(tmp, ''DesOrth'')'],... - 'UserData',hC,... - 'HandleVisibility','off'); - -%-Explore design -%----------------------------------------------------------------------- -hExplore = uimenu(hC,'Label','Explore','HandleVisibility','off'); - -switch modality(D) -case 'pet' - hFnF = uimenu(hExplore,'Label','Files and factors','Accelerator','F',... - 'CallBack',[cb,... - 'ui_report(tmp, ''Files&Factors'')'],... - 'UserData',hC,... - 'HandleVisibility','off'); - hCovs = uimenu(hExplore,'Label','Covariates','Accelerator','C',... - 'CallBack',[cb,... - 'ui_report(tmp, ''Covs'')'],... - 'UserData',hC,... - 'HandleVisibility','off'); - if isempty(SPM.xC), set(hCovs,'Enable','off'), end -case 'fmri' - for j = 1:length(SPM.Sess) - h = uimenu(hExplore,'Label',sprintf('Session %.0f ',j),... - 'HandleVisibility','off'); - for k = 1:length(SPM.Sess(j).Fc) - uimenu(h,'Label',SPM.Sess(j).Fc(k).name,... - 'CallBack',[cb,... - sprintf('ui_report_fmri(tmp,%d,%d);',j,k)],... - 'UserData',hC,... - 'HandleVisibility','off') - end - end -end - - -%-Clear, Quit, Help -%----------------------------------------------------------------------- -uimenu(hC,'Label','Clear','Accelerator','L','Separator','on',... - 'CallBack','spm_results_ui(''Clear'')',... - 'HandleVisibility','off'); -uimenu(hC,'Label','Help','Separator','on',... - 'CallBack','spm_help(''spm_DesRep'')',... - 'HandleVisibility','off'); - -%-Pop open 'Interactive' window -%----------------------------------------------------------------------- -figure(Finter) - -%-Return handle of menu -%----------------------------------------------------------------------- -varargout = {hC}; - - -%======================================================================= -case 'files&factors' %-Summarise files & factors -%======================================================================= -% ui_report(D, 'Files&Factors',fnames,I,xC,sF,xs) -fnames = image_names(D); -if isempty(fnames) - fnames = cell(size(SPM.xX.X, 1), 1); -end - -I = SPM.xX.I; -xC = SPM.xC; -sF = SPM.xX.sF; -xs = SPM.xsDes; %-Structure of description strings - -[fnames,CPath] = spm_str_manip(fnames,'c'); %-extract common path component -nScan = size(I,1); %-#images -bL = any(diff(I,1),1); %-Multiple factor levels? - -%-Get graphics window & window scaling -Fgraph = spm_figure('GetWin','Graphics'); -spm_results_ui('Clear',Fgraph,0) -FS = spm('FontSizes'); - -%-Display header information -%----------------------------------------------------------------------- -hTax = axes('Position',[0.03,0.85,0.94,0.1],... - 'DefaultTextFontSize',FS(9),... - 'XLim',[0,1],'YLim',[0,1],... - 'Visible','off'); - -text(0.5,1,'Statistical analysis: Image files & covariates...',... - 'Fontsize',FS(14),'Fontweight','Bold',... - 'HorizontalAlignment','center') - -dx1 = 0.05; -dx2 = 0.08; - -x = 0; text(x+.02,.1,'image #','Rotation',90) -if bL(4), x=x+dx1; text(x+.01,.1,sF{4},'Rotation',90), end -if bL(3), x=x+dx1; text(x+.01,.1,sF{3},'Rotation',90), end -if bL(2), x=x+dx1; text(x+.01,.1,sF{2},'Rotation',90), end -if bL(1), x=x+dx1; text(x+.01,.1,sF{1},'Rotation',90), end - -for j = 1:length(xC) - n = size(xC(j).rc,2); - if n>1, tmp=xC(j).cname; else, tmp={xC(j).rcname}; end - for k=1:n - x=x+dx2; - text(x,.1,tmp{k},'Rotation',90,'Interpreter','TeX') - end -end - -x=x+dx2; -text(x,0.65,'Base directory:','FontWeight','Bold') -text(x,0.5,CPath,'FontSize',FS(8)) -text(x,0.2,'filename tails...') - -line('XData',[0 1],'YData',[0 0],'LineWidth',3,'Color','r') - -%-Tabulate file & covariate information -%----------------------------------------------------------------------- -hAx = axes('Position',[0.03,0.05,0.94,0.8],... - 'DefaultTextFontSize',FS(8),... - 'Units','points',... - 'Visible','off'); -AxPos = get(hAx,'Position'); set(hAx,'YLim',[0,AxPos(4)]) - -dy = FS(9); y0 = floor(AxPos(4)) -dy; y = y0; - -for i = 1:nScan - - %-Scan indices - x = 0; text(x,y,sprintf('%03d',i)) - if bL(4), x=x+dx1; text(x,y,sprintf('%02d',I(i,4))), end - if bL(3), x=x+dx1; text(x,y,sprintf('%02d',I(i,3))), end - if bL(2), x=x+dx1; text(x,y,sprintf('%02d',I(i,2))), end - if bL(1), x=x+dx1; text(x,y,sprintf('%02d',I(i,1))), end - - %-Covariates - for j = 1:length(xC) - for k=1:size(xC(j).rc,2) - x=x+dx2; - text(x,y,sprintf('%6g',xC(j).rc(i,k)),... - 'HorizontalAlignment','Center') - end - end - - %-Filename tail(s) - could be multivariate - x=x+dx2; - text(x,y,fnames{i}) - y=y-dy; - - %-Paginate if necessary - if y1 - text(0.5,0,sprintf('Page %d/%d',spm_figure('#page')*[1,1]),... - 'FontSize',FS(8),'FontAngle','italic') - spm_figure('NewPage',[hAx;get(hAx,'Children')]) -end - -%-Pop up the Graphics window -%----------------------------------------------------------------------- -figure(Fgraph) - - - -%======================================================================= -case {'desmtx','desorth'} %-Display design matrix / design orthogonality -%======================================================================= -% ui_report(D, 'DesMtx',xX,fnames,xs) -% ui_report(D, 'DesOrth',xX) - -xX = SPM.xX; -fnames = image_names(D); -xs = SPM.xsDes; %-Structure of description strings - -desmtx = strcmp(lower(varargin{1}),'desmtx'); - - -%-Locate DesMtx (X), scaled DesMtx (nX) & get parameter names (Xnames) -%----------------------------------------------------------------------- -if isfield(xX,'xKXs') & ... - ~isempty(xX.xKXs) & isstruct(xX.xKXs) - iX = 1; - [nScan,nPar] = size(xX.xKXs.X); -elseif isfield(xX,'X') & ~isempty(xX.X) - iX = 0; - [nScan,nPar] = size(xX.X); -else - error('Can''t find DesMtx in this structure!') -end - -if isfield(xX,'nKX') & ~isempty(xX.nKX) - inX = 1; else, inX = 0; end - -if isfield(xX,'name') & ~isempty(xX.name) - Xnames = xX.name; else, Xnames = {}; end - - -%-Compute design orthogonality matrix if DesOrth -%----------------------------------------------------------------------- -if ~desmtx - if iX - tmp = sqrt(sum(xX.xKXs.X.^2)); - O = xX.xKXs.X'*xX.xKXs.X./kron(tmp',tmp); - tmp = sum(xX.xKXs.X); - else - tmp = sqrt(sum(xX.X.^2)); - O = xX.X'*xX.X./kron(tmp',tmp); - tmp = sum(xX.X); - end - tmp = abs(tmp)1 - ColorOrder = get(hAx,'ColorOrder'); - text(0.3,y,'Key :',... - 'HorizontalAlignment','Right',... - 'FontWeight','Bold','FontSize',FS(9)) - for j = 1:size(xC(i).rc,2) - color = ColorOrder(mod(j-1,size(ColorOrder,1))+1,:); - if size(xC(i).rc,2)==length(xC(i).cname) - str = xC(i).cname{j}; - else - str = sprintf('column %d',j); - end - text(0.31,y,str,'FontSize',FS(9),... - 'Color',color) - text(0.5,xC(i).rc(1,j),[str,' \rightarrow'],... - 'Parent',hAx,... - 'FontSize',FS(8),'FontWeight','Bold',... - 'HorizontalAlignment','Right',... - 'Interpreter','TeX',... - 'Color',color) - y=y-dy; - end - y=y-dy; - end - - - %-Associated parameters - %--------------------------------------------------------------- - text(0.3,y,'Design matrix columns :',... - 'HorizontalAlignment','Right',... - 'FontWeight','Bold','FontSize',FS(9)) - if isempty(xC(i).cols) - text(0.31,y,'(none)','FontSize',FS(9)) - else - for j = xC(i).cols - text(0.31,y,sprintf('%d : %s',j,Xnames{j}),... - 'FontSize',FS(9),'Interpreter','TeX') - y=y-dy; - end - end - y=y-dy; - - - %-Highlight parameter names - %--------------------------------------------------------------- - hCurPNames = hPNames(xC(i).cols); - set(hCurPNames,'Color','r','FontWeight','Bold','FontSize',FS(8)) - - - %-Paginate (if more than one covariate) - %--------------------------------------------------------------- - if length(xC)>1 - spm_figure('NewPage',[hSTitle; hAx; get(hAx,'Children');... - hCurPNames; hDAx; get(hDAx,'Children')]); - end - -end - -%-Pop up the Graphics window -%----------------------------------------------------------------------- -figure(Fgraph) - - -%======================================================================= -case 'scantick' -%======================================================================= -% ui_report(D, 'ScanTick',nScan,lim) -% ( Show at most 32, showing every 2nd/3rd/4th/... as necessary to pair ) -% ( down to <32 items. Always show last item so #images is indicated. ) -if nargin<3, lim=32; else, lim=varargin{3}; end -if nargin<2, error('insufficient arguments'), end -nScan = varargin{2}; - -p = max(1,ceil(nScan/lim)); -s = 1:p:nScan; s(end)=nScan; - -varargout = {s,lim}; - - -%======================================================================= -case {'surfdesmtx_cb','surfdesmtxmo_cb','surfdesmtxup_cb'} %-Surf DesMtx -%======================================================================= -% ui_report(D, 'SurfDesMtx_CB') -% ui_report(D, 'SurfDesMtxMo_CB') -% ui_report(D, 'SurfDesMtxUp_CB') - -h = get(gca,'Xlabel'); - -if strcmp(lower(varargin{1}),'surfdesmtxup_cb') - UD = get(h,'UserData'); - set(h,'String',UD.String,'Interpreter',UD.Interpreter,... - 'UserData',UD.UserData) - set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','') - return -end - - -if strcmp(lower(varargin{1}),'surfdesmtx_cb') - UD = struct( 'String', get(h,'String'),... - 'Interpreter', get(h,'Interpreter'),... - 'UserData', get(h,'UserData')); - set(h,'UserData',UD) - set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfDesMtxMo_CB'')'],... - 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfDesMtxUp_CB'')']) -end - -mm = [get(gca,'YLim')',get(gca,'XLim')']+[.5,.5;-.5,-.5]; -ij = get(gca,'CurrentPoint'); -ij = round(min(max(ij(1,[2,1]),mm(1,:)),mm(2,:))); - -istr = 'none'; -switch get(gcbf,'SelectionType') -case 'normal' - try, str = sprintf('X(%d,%d) = %g',ij(1),ij(2),... - subsref(get(gco,'UserData'),... - struct('type',{'.','()'},'subs',{'X',{ij(1),ij(2)}}))); - catch, str='(no cached design matrix to surf)'; end -case 'extend' - try, str = sprintf('Image %d: %s',ij(1),... - spm_str_manip(... - subsref(get(gco,'UserData'),... - struct('type',{'.','()'},... - 'subs',{'fnames',{ij(1),':'}})),'Ca40')); - catch, str='(no cached image filenames to surf)'; end -case 'alt' - try, str = sprintf('Parameter %d: %s',ij(2),... - subsref(get(gco,'UserData'),... - struct('type',{'.','{}'},'subs',{'Xnames',{ij(2)}}))); - istr = 'tex'; - catch, str='(no cached parameter names to surf)'; end -case 'open' - try, assignin('base','ans',subsref(get(gco,'UserData'),... - struct('type',{'.'},'subs',{'X'}))) - evalin('base','ans') - catch, fprintf('%s GUI: can''t find design matrix\n',mfilename) - end - return -end - -set(h,'String',str,'Interpreter',istr) - - -%======================================================================= -case {'surfestim_cb','surfestimmo_cb','surfestimup_cb'} %-Surf ParEstIm -%======================================================================= -% ui_report(D, 'SurfEstIm_CB') -% ui_report(D, 'SurfEstImMo_CB') -% ui_report(D, 'SurfEstImUp_CB') - -h = get(gca,'Xlabel'); - -if strcmp(lower(varargin{1}),'surfestimup_cb') - UD = get(h,'UserData'); - set(h,'String',UD.String,'Interpreter',UD.Interpreter,... - 'UserData',UD.UserData) - set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','') - return -end - -if strcmp(lower(varargin{1}),'surfestim_cb') - UD = struct( 'String', get(h,'String'),... - 'Interpreter', get(h,'Interpreter'),... - 'UserData', get(h,'UserData')); - set(h,'UserData',UD) - set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfEstImMo_CB'')'],... - 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfEstImUp_CB'')']) -end - -mm = [get(gca,'XLim')]+[.5,-.5]; -i = get(gca,'CurrentPoint'); -i = round(min(max(i(1,1),mm(1)),mm(2))); - -istr = 'none'; -switch get(gcbf,'SelectionType') -case 'normal' - try, tmp = {' (not unique)',' (unique)'}; - str = sprintf('Parameter %d : %s%s',... - i,... - subsref(get(gco,'UserData'),... - struct('type',{'.','{}'},'subs',{'Xnames',{i}})),... - tmp{subsref(get(gco,'UserData'),... - struct('type',{'.','()'},'subs',{'est',{i}}))+1}); - istr = 'tex'; - catch, str='(no cached data to surf)'; end -case {'extend','alt'} - return -case 'open' - try, UD = get(gco,'UserData'); - assignin('base','ans',... - subsref(get(gco,'UserData'),... - struct('type',{'.'},'subs',{'est'}))) - evalin('base','ans') - catch, fprintf('%s GUI: can''t find design orthogonality\n',mfilename) - end - return -end - -set(h,'String',str,'Interpreter',istr) - - - -%======================================================================= -case {'surfdeso_cb','surfdesomo_cb','surfdesoup_cb'} %-Surf DesOrthIm -%======================================================================= -% ui_report(D, 'SurfDesO_CB') -% ui_report(D, 'SurfDesOMo_CB') -% ui_report(D, 'SurfDesOUp_CB') - -h = get(gca,'Xlabel'); - -if strcmp(lower(varargin{1}),'surfdesoup_cb') - UD = get(h,'UserData'); - set(h,'String',UD.String,'Interpreter',UD.Interpreter,... - 'UserData',UD.UserData) - set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','') - return -end - -if strcmp(lower(varargin{1}),'surfdeso_cb') - UD = struct( 'String', get(h,'String'),... - 'Interpreter', get(h,'Interpreter'),... - 'UserData', get(h,'UserData')); - set(h,'UserData',UD) - set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfDesOMo_CB'')'],... - 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfDesOUp_CB'')']) -end - -mm = [get(gca,'YLim')',get(gca,'XLim')']+[.5,.5;-.5,-.5]; -ij = get(gca,'CurrentPoint'); -ij = round(min(max(ij(1,[2,1]),mm(1,:)),mm(2,:))); -if ij(1)>ij(2), return, end - -istr = 'none'; -switch get(gcbf,'SelectionType') -case 'normal' - try - UD = get(gco,'UserData'); - if abs(abs(UD.O(ij(1),ij(2)))-1) < eps*1e1 - str = '{\bf colinear}'; - elseif abs(UD.O(ij(1),ij(2))) < eps*1e1 - str = '{\bf orthogonal}'; - else - str = '{\bf not orthogonal}'; - end - if ~diff(ij), str=[str,' {\it(same column)}']; end - if UD.bC(ij(1),ij(2)), tmp=' ={\it r}'; else, tmp=''; end - str = { sprintf('{\\bf %s} (col %d) & {\\bf %s} (col %d)',... - UD.Xnames{ij(1)},ij(1),... - UD.Xnames{ij(2)},ij(2)),... - sprintf('cos(\\theta)%s = %1.2f',... - tmp,UD.O(ij(1),ij(2))),... - ['\rightarrow ',str]}; - istr = 'tex'; - catch, str='(no cached data to surf)'; end -case {'extend','alt'} - return -case 'open' - try, UD = get(gco,'UserData'); - assignin('base','ans',UD.O) - evalin('base','ans') - catch, fprintf('%s GUI: can''t find design orthogonality\n',mfilename) - end - return -end - -set(h,'String',str,'Interpreter',istr) - - -%======================================================================= -case {'surfcon_cb','surfconmo_cb','surfconup_cb'} %-Surf Contrast -%======================================================================= -% ui_report(D, 'SurfCon_CB') -% ui_report(D, 'SurfConOMo_CB') -% ui_report(D, 'SurfConOUp_CB') - -cUD = get(gco,'UserData'); -if ~isstruct(cUD) | ~isfield(cUD,'h') - warning('contrast GUI objects setup incorrectly'), return -end -h = cUD.h; - -if strcmp(lower(varargin{1}),'surfconup_cb') - UD = get(h,'UserData'); - set(h,'String',UD.String,'Interpreter',UD.Interpreter,... - 'UserData',UD.UserData) - set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','') - return -end - -if strcmp(lower(varargin{1}),'surfcon_cb') - UD = struct( 'String', get(h,'String'),... - 'Interpreter', get(h,'Interpreter'),... - 'UserData', get(h,'UserData')); - set(h,'UserData',UD) - set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfConMo_CB'')'],... - 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfConUp_CB'')']) -end - -mm = [get(gca,'YLim')',get(gca,'XLim')']+[.5,.5;-.5,-.5]; -ij = get(gca,'CurrentPoint'); -ij = round(min(max(ij(1,[2,1]),mm(1,:)),mm(2,:))); - -istr = 'none'; -switch get(gcbf,'SelectionType') -case 'normal' - try - if cUD.i>0, str = sprintf('%d',cUD.i); else, str = ''; end - switch get(gco,'Type') - case 'image' - str = sprintf('%s\\{F\\}: {\\bf%s} (%d,%d) = %.2f',... - str,cUD.xCon.name,ij(2),ij(1),... - cUD.xCon.c(ij(2),ij(1))); - case 'patch' - str = sprintf('%s\\{T\\}: {\\bf%s} (%d) = %.2f',... - str,cUD.xCon.name,ij(2),... - cUD.xCon.c(ij(2))); - otherwise, error('unexpected object type') - end - istr = 'TeX'; - catch, str='(no cached data to surf)'; end -case {'alt','extend'} - return -case 'open' - try, assignin('base','ans',cUD.xCon.c') - evalin('base','ans') - catch, fprintf('%s GUI: can''t find contrast\n',mfilename) - end - return -end - -set(h,'String',str,'Interpreter',istr) - - -%======================================================================= -otherwise %-Unknown action string -%======================================================================= -error(['Unknown action string: ',varargin{1}]) - - - -%======================================================================= -end diff --git a/lib/marsbar-0.44/@mardo_2/ui_report_fmri.m b/lib/marsbar-0.44/@mardo_2/ui_report_fmri.m deleted file mode 100644 index c0148a7..0000000 --- a/lib/marsbar-0.44/@mardo_2/ui_report_fmri.m +++ /dev/null @@ -1,135 +0,0 @@ -function ui_report_fmri(D,s,i) -% Interactive review of fMRI design matrix -% FORMAT ui_report_fmri(D,s,i) -% -% Copied with minor edits from: -% @(#)spm_fMRI_design_show.m 2.22 Karl Friston 03/02/21 -% -% $Id$ - -SPM = des_struct(D); -Sess = SPM.Sess; - -% Do not proceed unless there are trials specified -%----------------------------------------------------------------------- -for j = 1:length(Sess) - if ~length(Sess(j).U) - spm('alert*','User-specifed regressors only!',mfilename,sqrt(-1)); - return - end -end - -%-Defaults: Setup GUI if not called by spm_DesRep (with s and i) -%----------------------------------------------------------------------- -if nargin < 3 - s = 1; - i = 1; - - %-Get Interactive window and delete any previous DesRepUI menu - %--------------------------------------------------------------- - Finter = spm_figure('GetWin','Interactive'); - delete(findobj(get(Finter,'Children'),'flat','Tag','DesRepUI')) - - %-Create menu - %--------------------------------------------------------------- - hC = uimenu(Finter,'Label','Explore fMRI design',... - 'Separator','on',... - 'Tag','DesRepUI',... - 'UserData',D,... - 'HandleVisibility','on'); - for j = 1:length(Sess) - h = uimenu(hC,'Label',sprintf('Session %.0f ',j),... - 'HandleVisibility','off'); - for k = 1:length(Sess(j).Fc) - cb = ['tmp = get(get(gcbo,''UserData''),',... - '''UserData''); ',... - sprintf(['ui_report_fmri(',... - 'tmp,%d,%d);'],j,k)]; - uimenu(h,'Label',Sess(j).Fc(k).name,... - 'CallBack',cb,... - 'UserData',hC,... - 'HandleVisibility','off') - end - end -end - - -%-Graphics... -%======================================================================= - -%-Get Graphics window -%----------------------------------------------------------------------- -Fgraph = spm_figure('GetWin','Graphics'); -spm_results_ui('Clear',Fgraph,0) - - -% Trial-specific regressors - time domain -%----------------------------------------------------------------------- -sX = SPM.xX.X(Sess(s).row,Sess(s).col); -rX = sX(:,Sess(s).Fc(i).i); -subplot(2,2,1) -plot(Sess(s).row,rX) -xlabel('scan') -ylabel('regressor[s]') -title({'Time domain',['regressors for ' Sess(s).Fc(i).name]}) -grid on -axis tight - -% Trial-specific regressors - frequency domain -%----------------------------------------------------------------------- -subplot(2,2,2) -gX = abs(fft(rX)).^2; -gX = gX*diag(1./sum(gX)); -q = size(gX,1); -Hz = [0:(q - 1)]/(q*SPM.xY.RT); -q = 2:fix(q/2); -plot(Hz(q),gX(q,:)) -patch([0 1 1 0]/128,[0 0 1 1]*max(max(gX)),[1 1 1]*.9) -xlabel('Frequency (Hz)') -ylabel('relative spectral density') -title({'Frequency domain','128 second High-pass filter'}) -grid on -axis tight - - -% if trial (as opposed to trial x trial interaction) -%----------------------------------------------------------------------- -if length(Sess(s).U) >= i - - % Basis set and peristimulus sampling - %--------------------------------------------------------------- - subplot(2,2,3) - dt = Sess(s).U(i).dt; - RT = SPM.xY.RT; - t = [1:size(SPM.xBF.bf,1)]*dt; - pst = Sess(s).U(i).pst; - plot(t,SPM.xBF.bf,pst,0*pst,'.','MarkerSize',16) - str = sprintf('TR = %0.2fsecs',RT); - xlabel({'time (secs)' str sprintf('%0.0fms time bins',1000*dt)}) - title({'Basis set and peristimulus sampling' SPM.xBF.name}) - axis tight - grid on - - % if a paramteric variate is specified - %--------------------------------------------------------------- - for p = 1:length(Sess(s).U(i).P) - - if Sess(s).U(i).P(p).h - - % onsets and parametric modulation - %------------------------------------------------------- - subplot(2,2,4) - ons = Sess(s).U(i).ons; - plot(ons,Sess(s).U(i).P(p).P,'.','MarkerSize',8) - xlabel('time {secs}') - title('parameters') - grid on - hold on - - end - end -end - -%-Pop up Graphics figure window -%----------------------------------------------------------------------- -figure(Fgraph); diff --git a/lib/marsbar-0.44/@mardo_5/autocorr.m b/lib/marsbar-0.44/@mardo_5/autocorr.m deleted file mode 100644 index 2f73c16..0000000 --- a/lib/marsbar-0.44/@mardo_5/autocorr.m +++ /dev/null @@ -1,98 +0,0 @@ -function D = autocorr(D, autocorr_type, varargin) -% method to set autocorrelation types for design -% FORMAT D = autocorr(D, autocorr_type, varargin) -% -% D - design object -% autocorr_type - autocorrelation type specification, one of -% 'SPM' -% 'fmristat' -% 'none' -% varargin - parameters defining autocorrelation model. -% If autocorr type is 'SPM': -% varargin{1} should be vector with estimated AR -% coefficients (default is [0.2]) -% varargin{2} is optional, and is flag; non-zero value -% specifies voxel-wise covariance estimates (default 1) -% If autocorr type is 'fmristat' -% varargin{1} is scalar value for order of fmristat -% model (default is 1); -% -% $Id: autocorr.m 539 2004-12-02 18:46:37Z matthewbrett $ - -if nargin < 2 - error('Need autocorr type'); -end - -if ~is_fmri(D) - warning('Can only set autocorrelation for FMRI design types'); - return -end - -% Get design, put into some useful variables -v_f = verbose(D); -SPM = des_struct(D); -nscan = SPM.nscan; - -SPM.xVi.cov_calc = 'summary'; - -switch lower(autocorr_type) - case 'fmristat' - % Fit fmristat model AR(n) - if nargin < 3, varargin{1} = 1; end - cVi = varargin{1}; - if prod(size(cVi)) > 1 - error('Expecting scalar for fmristat order'); - end - SPM.xVi.Vi = struct('type', 'fmristat', 'order', cVi); - cVi = sprintf('fmristat AR(%d)',cVi); - f2cl = 'V'; % Field to CLear - - case 'spm' - % SPM AR coefficient(s) to be specified - if nargin < 3, varargin{1} = 0.2; end - if nargin < 4, varargin{2} = 1; end - cVi = varargin{1}; - if any(cVi > 1 | cVi < 0) - error('Rho estimates should be > 0 and < 1'); - end - SPM.xVi.Vi = pr_spm_ce(nscan, cVi); - cVi = sprintf('AR(%0.1f)',cVi(1)); - f2cl = 'V'; - if varargin{2} - SPM.xVi.cov_calc = 'vox'; - end - - case 'none' - % xVi.V is i.i.d - %--------------------------------------------------------------- - SPM.xVi.V = speye(sum(nscan)); - cVi = 'i.i.d'; - f2cl = 'Vi'; - - otherwise - error(['Eccentric autocorr type ' autocorr_type]); -end - -% If we've set V, need to clear Vi, because the -% estimate method takes the presence of Vi to mean that -% V can be cleared, with 'redo_covar' flag -% Conversely V needs to be cleared if Vi was estimated -if isfield(SPM.xVi, f2cl) - SPM.xVi = rmfield(SPM.xVi, f2cl); - if v_f, fprintf('Clearing previous %s matrix\n', f2cl); end -end - -% Also: remove previous W matrices -% Either will need to be recalculated or won't be used -if isfield(SPM.xX, 'W') - SPM.xX = rmfield(SPM.xX, 'W'); - if v_f, fprintf('Clearing previous W matrix\n'); end -end - -% fill into design -SPM.xVi.form = cVi; -xsDes = struct('Serial_correlations', SPM.xVi.form); -SPM.xsDes = mars_struct('ffillmerge', SPM.xsDes, xsDes); - -% put stuff into object -D = des_struct(D,SPM); diff --git a/lib/marsbar-0.44/@mardo_5/convert_vols.m b/lib/marsbar-0.44/@mardo_5/convert_vols.m deleted file mode 100644 index f3b26fe..0000000 --- a/lib/marsbar-0.44/@mardo_5/convert_vols.m +++ /dev/null @@ -1,51 +0,0 @@ -function o = convert_vols(o, ver) -% method that converts vol structs in design and converts to format 'ver' -% FORMAT o = convert_fo(o, ver) -% -% Input -% o - design object -% ver - optional version for vols from '99' or '5' -% Defaults to version for current SPM version -% -% Output -% o - object with converted vols -% -% Example -% % Convert vols to current format -% o = convert_vols(o); -% -% % Convert to native format for SPM99 designs -% o = convert_vols(o, native_vol_ver(o)); -% -% $Id$ - -if nargin < 2 - ver = mars_vol_utils('current_ver'); -end - -SPM = des_struct(o); -SPM = sf_conv(SPM, ver, 'xY', 'VY'); -SPM = sf_conv(SPM, ver, 'xM', 'VM'); -SPM = sf_conv(SPM, ver, 'xVol', 'VRpv'); -SPM = sf_conv(SPM, ver, 'Vbeta'); -SPM = sf_conv(SPM, ver, 'VResMS'); -SPM = sf_conv(SPM, ver, 'VM'); -o = des_struct(o, SPM); - -xCon = get_contrasts(o); -if ~isempty(xCon) - for i = 1:length(xCon) - xCon(i) = sf_conv(xCon(i), ver, 'Vcon'); - xCon(i) = sf_conv(xCon(i), ver, 'Vspm'); - end -end -o = set_contrasts(o, xCon, 0); -return - -function S = sf_conv(S, ver, varargin) -V = mars_struct('getifthere', S, varargin{:}); -if ~isempty(V) - V = mars_vol_utils('convert', V, ver); - S = setfield(S, varargin{:}, V); -end -return diff --git a/lib/marsbar-0.44/@mardo_5/estimate.m b/lib/marsbar-0.44/@mardo_5/estimate.m deleted file mode 100644 index d6e6f85..0000000 --- a/lib/marsbar-0.44/@mardo_5/estimate.m +++ /dev/null @@ -1,103 +0,0 @@ -function [marsD] = estimate(marsD, marsY, params) -% estimate method - estimates GLM for SPM2 model -% -% marsD - SPM design object -% marsY - MarsBaR data object or 2D data matrix -% params - struct containing options, as fields -% redo_covar - if 1, remodels covariance -% redo_whitening - if 1, recalcalates whitening -% (by default, both are set to 1) -% -% e.g. -% % Estimate model on design D and data Y, using original covariance and -% % whitening -% E = estimate(D, Y, struct('reco_covar', 0, ... -% 'redo_whitening', 0); -% -% $Id: estimate.m 515 2004-11-17 02:04:34Z matthewbrett $ - -def_params = struct(... - 'redo_covar', 1, ... - 'redo_whitening', 1); - -if nargin < 2 - error('Need data to estimate'); -end -if nargin < 3 - params = []; -end - -% Replicate original behaviour calling with cell array of strings -params = sf_call_compat(params); - -% Fill with defaults -params = mars_struct('ffillmerge', def_params, params); - -% ensure we have a data object -marsY = marsy(marsY); - -% check design is complete -if ~can_mars_estimate(marsD) - error('This design needs more information before it can be estimated'); -end - -% Check data and design dimensions -if n_time_points(marsY) ~= n_time_points(marsD) - error('The data and design must have the same number of rows'); -end - -% get SPM design structure -SPM = des_struct(marsD); - -% process params -if params.redo_covar - if isfield(SPM, 'xVi') - if isfield(SPM.xVi, 'V') & isfield(SPM.xVi, 'Vi') - SPM.xVi = rmfield(SPM.xVi, 'V'); - if verbose(marsD) - disp('Re-estimating covariance'); - end - end - end -end -if params.redo_whitening - if isfield(SPM.xX, 'W') - SPM.xX = rmfield(SPM.xX, 'W'); - if verbose(marsD) - disp('Re-estimating whitening filter'); - end - end -end - -SPM = pr_estimate(SPM, marsY); -SPM.marsY = marsY; -SPM.SPMid = sprintf('SPM2: MarsBaR estimation. mardo_2 version %s', ... - marsD.cvs_version); - -% return modified structure -marsD = des_struct(marsD, SPM); - -return - -function params = sf_call_compat(params) -% Replicates old calling behaviour, for backwards compatibility - -% Replicate result of passing empty cell array, but warn that this -% will be removed soon -if ischar(params) | iscell(params) - warning(['Cell / char form of params deprecated, ' ... - 'please use struct form instead']); -end -if iscell(params) & isempty(params) - warning(['Empty cell array changes default options; '... - 'This behaviour will change for future versions']); - params = struct(... - 'redo_covar', 0, ... - 'redo_whitening', 0); -end -if ischar(params)params = {params}; end -if iscell(params) - params = params(:); - params = cell2struct(num2cell(ones(size(params))), params, 1); -end -return diff --git a/lib/marsbar-0.44/@mardo_5/fill.m b/lib/marsbar-0.44/@mardo_5/fill.m deleted file mode 100644 index 5b178fe..0000000 --- a/lib/marsbar-0.44/@mardo_5/fill.m +++ /dev/null @@ -1,291 +0,0 @@ -function D = fill(D, actions) -% fills missing entries from SPM FMRI design matrix -% FORMAT D = fill(D, actions) -% -% D - mardo object containing spm design -% actions - string or cell array of strings with actions: -% 'defaults' - fills empty parts of design with defaults -% (in fact this is always done) -% 'filter' - asks for and fills filter -% 'autocorr' - asks for and fills autocorrelation -% 'for_estimation' fill filter &| autocorr if not present -% 'images' - asks for and fills with images, mask, scaling -% -% Returns -% D - returned mardo SPM design -% -% Copied/pasted then rearranged from SPM2 spm_fmri_spm_ui -% Matthew Brett - 17/11/01 - MRS2TH -% -% $Id: fill.m 543 2004-12-14 08:58:05Z matthewbrett $ - -if nargin < 2 - actions = ''; -end -if ~is_fmri(D), return, end -if isempty(actions), actions = {'defaults'}; end -if ischar(actions), actions = {actions}; end -fe = find(ismember(actions, 'for_estimation')); -if ~isempty(fe) - A = []; - if is_fmri(D) - if ~has_filter(D), A = {'filter'}; end - if ~has_autocorr(D), A = [A {'autocorr'}]; end - end - actions(fe) = []; - actions = [actions(1:fe(1)-1) A actions(fe(1):end)]; -end -actions = [{'defaults'}, actions]; - -% Get design, put into some useful variables -v_f = verbose(D); -SPM = des_struct(D); -xX = SPM.xX; -have_sess = isfield(SPM, 'Sess'); -if have_sess, Sess = SPM.Sess; end - -% get file indices -%--------------------------------------------------------------- -row = block_rows(D); -nsess = length(row); -nscan = zeros(1,nsess); -for i = 1:nsess - nscan(i) = length(row{i}); -end - -done_list = {}; -for a = 1:length(actions) - if ismember(actions{a}, done_list), continue, end - done_list = [actions(a) done_list]; - switch lower(actions{a}) - case 'defaults' - - % prepare various default settings, offer to design - xM = []; % masking - xGX = []; % globals - sGXcalc = 'none'; % global calculation description - sGMsca = 'none'; % grand mean scaling description - Global = 'none'; % proportional scaling or no - - BFstr = ''; DSstr = ''; ntr = []; - if have_sess - % Number of trial types per session - for i = 1:nsess, ntr(i) = length(SPM.Sess(i).U); end - BFstr = SPM.xBF.name; - end - - xsDes = struct(... - 'Basis_functions', BFstr,... - 'Number_of_sessions', sprintf('%d',nsess),... - 'Trials_per_session', sprintf('%-3d',ntr),... - 'Global_calculation', sGXcalc,... - 'Grand_mean_scaling', sGMsca,... - 'Global_normalisation', Global); - - if isfield(SPM, 'xsDes') - xsDes = mars_struct('fillafromb', SPM.xsDes, xsDes); - end - - SPM.xsDes = xsDes; - SPM = mars_struct('merge', SPM, ... - struct('xGX', xGX,... - 'xM', xM)); - - case 'images' - [Finter,Fgraph,CmdLine] = spm('FnUIsetup','fMRI stats model setup',0); - % get filenames - %--------------------------------------------------------------- - P = []; - for i = 1:nsess - str = sprintf('select scans for session %0.0f',i); - q = spm_get(nscan(i),mars_veropts('get_img_ext'),str); - P = strvcat(P,q); - end - - % place in data field - %--------------------------------------------------------------- - SPM.xY.P = P; - - % Assemble remaining design parameters - %======================================================================= - - % Global normalization - %----------------------------------------------------------------------- - spm_input('Global intensity normalisation...',1,'d',mfilename) - str = 'remove Global effects'; - SPM.xGX.iGXcalc = spm_input(str,'+1','scale|none',{'Scaling' 'None'}); - SPM.xGX.sGXcalc = 'mean voxel value'; - SPM.xGX.sGMsca = 'session specific'; - - % Assemble other design parameters - %======================================================================= - spm_help('!ContextHelp',mfilename) - spm_input('Global intensity normalisation...',1,'d',mfilename); - - % get file identifiers and Global values - %======================================================================= - fprintf('%-40s: ','Mapping files') %-# - VY = spm_vol(SPM.xY.P); - fprintf('%30s\n','...done') %-# - - %-Check compatability of images - %----------------------------------------------------------------------- - [samef msg] = mars_vol_check(VY); - if ~samef, disp(char(msg)),error('Cannot use images'),end; - - %-place in xY - %----------------------------------------------------------------------- - SPM.xY.VY = VY; - - %-Compute Global variate - %======================================================================= - GM = 100; - q = length(VY); - g = zeros(q,1); - fprintf('%-40s: %30s','Calculating globals',' ') %-# - for i = 1:q - fprintf('%s%30s',repmat(sprintf('\b'),1,30),sprintf('%4d/%-4d',i,q)) %-# - g(i) = spm_global(VY(i)); - end - fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-# - - % scale if specified (otherwise session specific grand mean scaling) - %----------------------------------------------------------------------- - gSF = GM./g; - if strcmp(SPM.xGX.iGXcalc,'None') - for i = 1:nsess - gSF(SPM.Sess(i).row) = GM./mean(g(SPM.Sess(i).row)); - end - end - - %-Apply gSF to memory-mapped scalefactors to implement scaling - %----------------------------------------------------------------------- - for i = 1:q - SPM.xY.VY(i).pinfo(1:2,:) = SPM.xY.VY(i).pinfo(1:2,:)*gSF(i); - end - - %-place global variates in global structure - %----------------------------------------------------------------------- - SPM.xGX.rg = g; - SPM.xGX.GM = GM; - SPM.xGX.gSF = gSF; - - - %-Masking structure - %--------------------------------------------------------------- - SPM.xM = struct('T', ones(q,1),... - 'TH', g.*gSF,... - 'I', 0,... - 'VM', {[]},... - 'xs', struct('Masking','analysis threshold')); - - xsDes = struct(... - 'Global_calculation', SPM.xGX.sGXcalc,... - 'Grand_mean_scaling', SPM.xGX.sGMsca,... - 'Global_normalisation', SPM.xGX.iGXcalc); - - SPM.xsDes = mars_struct('ffillmerge',... - SPM.xsDes,... - xsDes); - - case 'filter' - % Get filter - if ~have_sess, return, end - - [Finter,Fgraph,CmdLine] = spm('FnUIsetup', 'FMRI model filter', 0); - - % TR if not set (it should be) - if ~mars_struct('isthere', SPM, 'xY', 'RT') - SPM.xY.RT = spm_input('Interscan interval {secs}','+1'); - end - SPM.xsDes.Interscan_interval = sprintf('%0.2f {s}',SPM.xY.RT); - - spm_input('High pass filter','+1','d',mfilename) - [SPM.xX.K SPM.xsDes.High_pass_Filter] = ... - pr_get_filter(SPM.xY.RT, SPM.Sess); - - case 'autocorr' - [Finter,Fgraph,CmdLine] = ... - spm('FnUIsetup','FMRI autocorrelation options',0); - - % Contruct Vi structure for non-sphericity ReML estimation - %=============================================================== - str = 'Correct for serial correlations?'; - cVi = {'none', 'SPM AR(0.2)','SPM AR (specify)', 'fmristat AR(n)'}; - cVi = spm_input(str,'+1','m',cVi, cVi); - - % create Vi struct - %----------------------------------------------------------------------- - vox_cov_possible = 0; - switch lower(cVi{1}) - - case 'fmristat ar(n)' - % Fit fmristat model AR(n) - %--------------------------------------------------------------- - cVi = spm_input('fmristat AR model order', '+1', 'e', 2); - SPM.xVi.Vi = struct('type', 'fmristat', 'order', cVi); - cVi = sprintf('fmristat AR(%d)',cVi); - f2cl = 'V'; % Field to CLear - - case 'spm ar (specify)' - % SPM AR coefficient(s) to be specified - %--------------------------------------------------------------- - cVi = spm_input('AR rho parameter(s)', '+1', 'e', 0.2); - SPM.xVi.Vi = pr_spm_ce(nscan,cVi); - cVi = sprintf('AR(%0.1f)',cVi(1)); - f2cl = 'V'; - vox_cov_possible = 1; - - case 'none' - % xVi.V is i.i.d - %--------------------------------------------------------------- - SPM.xVi.V = speye(sum(nscan)); - cVi = 'i.i.d'; - f2cl = 'Vi'; - - otherwise - % otherwise assume AR(0.2) in xVi.Vi - %--------------------------------------------------------------- - SPM.xVi.Vi = pr_spm_ce(nscan,0.2); - cVi = 'AR(0.2)'; - f2cl = 'V'; - vox_cov_possible = 1; - - end - - % If we've set V, need to clear Vi, because the - % estimate method takes the presence of Vi to mean that - % V can be cleared, with 'redo_covar' flag - % Conversely V needs to be cleared if Vi was estimated - if isfield(SPM.xVi, f2cl) - SPM.xVi = rmfield(SPM.xVi, f2cl); - if v_f, fprintf('Clearing previous %s matrix\n', f2cl); end - end - - % Also: remove previous W matrices - % Either will need to be recalculated or won't be used - if isfield(SPM.xX, 'W') - SPM.xX = rmfield(SPM.xX, 'W'); - if v_f, fprintf('Clearing previous W matrix\n'); end - end - - % Whether to average covariance estimates over voxels - SPM.xVi.cov_calc = 'summary'; - if vox_cov_possible - if spm_input('Use voxel data for covariance','+1','y/n', [1 0], 1); - SPM.xVi.cov_calc = 'vox'; - end - end - - % fill into design - SPM.xVi.form = cVi; - xsDes = struct('Serial_correlations', SPM.xVi.form); - SPM.xsDes = mars_struct('ffillmerge', SPM.xsDes, xsDes); - - otherwise - error(['Unpredictable: ' actions{a}]); - end -end - -% put stuff into object -D = des_struct(D,SPM); diff --git a/lib/marsbar-0.44/@mardo_5/mardo_5.m b/lib/marsbar-0.44/@mardo_5/mardo_5.m deleted file mode 100644 index 57f3f3c..0000000 --- a/lib/marsbar-0.44/@mardo_5/mardo_5.m +++ /dev/null @@ -1,104 +0,0 @@ -function [o, others] = mardo_5(params, others, varargin) -% class constructor for SPM5 MarsBaR design object -% FORMAT [o, others] = mardo_5(params, others, varargin) -% Inputs -% params - structure,containing fields, or SPM/MarsBaR design -% others - structure, containing other fields to define -% -% Outputs -% o - mardo_5 object (unless disowned) -% others - any unrecognized fields from params, for processing by -% children -% -% This object is called from the mardo object contructor -% with a mardo object as input. mardo_5 checks to see -% if the contained design is an SPM5 design, returns -% the object unchanged if not. If it is an SPM5 -% design, it claims ownership of the passed object. -% -% The constructor can also be called to give class functions, where the -% name of the class function is a character string which is one of: -% 'spm_filter' - applies spm_filter routine to passed args -% -% $Id: mardo_5.m 607 2006-03-30 20:54:55Z matthewbrett $ - -myclass = 'mardo_5'; -cvs_v = marsbar('ver'); % was CVS version; now marsbar version - -% Default object structure -defstruct = []; - -if nargin < 1 - defstruct.cvs_version = cvs_v; - o = class(defstruct, myclass, mardo_2); - others = []; - return -end -if nargin < 2 - others = []; -end - -% parse out string action calls (class functions) -if ischar(params) - switch params - case 'spm_filter' - if nargin < 2 - error('Need filter'); - elseif nargin < 3 - o = pr_spm_filter(others); - else - o = pr_spm_filter(others, varargin{1}); - end - return - otherwise - error(sprintf('Is "%s" a filename? Use ``mardo`` to load from files',... - params)); - end -end - -% Deal with passed objects of this (or child) class -if isa(params, myclass) - o = params; - % Check for simple form of call - if isempty(others), return, end - - % Otherwise, we are being asked to set fields of object - % (Moot at the moment, as there are no fields specific for this object) - [p others] = mars_struct('split', others, defstruct); - return -end - -% normal call is via mardo constructor -if isa(params, 'mardo') - % Check to see if this is a suitable design, return if not - des = des_struct(params); - if ~my_design(des), o = params; return, end - % own, by making mardo_2 object for design - [uo others] = mardo_2(params, others, 1); - params = []; -else - uo = []; -end - -if ~isa(uo, 'mardo') % mardo object not passed - % umbrella object, parse out fields for (this object and children) - % third argument of 0 prevents recursive call back to here - [uo, params] = mardo_2(params, others, 0); -else - % fill params with other parameters - params = mars_struct('ffillmerge', params, others); -end - -% parse parameters into those for this object, children -[params, others] = mars_struct('ffillsplit', defstruct, params); - -% add cvs tag -params.cvs_version = cvs_v; - -% set the mardo object -o = class(params, myclass, uo); - -% convert vols to current format -o = convert_vols(o); - -return diff --git a/lib/marsbar-0.44/@mardo_5/native_vol_ver.m b/lib/marsbar-0.44/@mardo_5/native_vol_ver.m deleted file mode 100644 index 16a5c20..0000000 --- a/lib/marsbar-0.44/@mardo_5/native_vol_ver.m +++ /dev/null @@ -1,6 +0,0 @@ -function res = native_vol_ver(obj) -% return string specifying native vol type -% -% $Id: verbose.m 87 2004-01-06 01:48:35Z matthewbrett $ - -res = '5'; diff --git a/lib/marsbar-0.44/@mardo_5/private/my_design.m b/lib/marsbar-0.44/@mardo_5/private/my_design.m deleted file mode 100644 index eba95c3..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/my_design.m +++ /dev/null @@ -1,12 +0,0 @@ -function tf = my_design(des) -% returns 1 if design looks like it is of SPM5 / 8 type -% -% $Id: my_design.m 328 2004-03-03 01:56:03Z matthewbrett $ - -tf = 0; -if isfield(des, 'SPM'), des = des.SPM; end -if isfield(des, 'SPMid') - tf = ~isempty(strmatch('SPM5', des.SPMid)) | ... - ~isempty(strmatch('SPM8', des.SPMid)) | ... - ~isempty(strmatch('SPM12', des.SPMid)); -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_estimate.m b/lib/marsbar-0.44/@mardo_5/private/pr_estimate.m deleted file mode 100644 index e791a29..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_estimate.m +++ /dev/null @@ -1,399 +0,0 @@ -function SPM = pr_estimate(SPM, marsY) -% Estimation of a General Linear Model -% FORMAT SPM = pr_estimate(SPM, marsY) -% Inputs -% SPM - SPM design structure -% marsY - marsY data object, or 2D data (Y) matrix -% -% Outputs -% SPM - modified estimated design structure, with data contained as -% field marsY -% -% Based on spm_spm from spm2: -% @(#)spm_spm.m 2.66 Andrew Holmes, Jean-Baptiste Poline, Karl Friston 03/03/27 -% -% There are some changes in this version -% 1) The specified Vi field, can contain either -% a cell array, in which case it is standard SPM covariance components, -% or a struct array, in which case it can specify other methods of -% estimating the covariance, in particular, real AR(n) estimation -% -% 2) The design will specify if the covariance should be calculated from -% the summarized time course(s), or from the component voxels, then -% averaged. Voxel time courses are used by default, and if -% SPM.xVi.cov_calc is set to 'vox', but summary time -% courses can be used by setting SPM.xVi.cov_calc to 'summary'. -% -% 3) Normally, if the W matrix is present, the V matrix should also be -% present. Because it is boring to calculate the V matrix and then WVW, -% if we know WVW is I, V can be present, but empty, in which case WVW is -% assumed to be I. It just saves time. -% -% $Id: pr_estimate.m 543 2004-12-14 08:58:05Z matthewbrett $ - -%-Say hello -%----------------------------------------------------------------------- -Finter = spm('FigName','Stats: estimation...'); spm('Pointer','Watch') - -%======================================================================= -% - A N A L Y S I S P R E L I M I N A R I E S -%======================================================================= - -%-Initialise -%======================================================================= -fprintf('%-40s: %30s','Initialising parameters','...computing') %-# -xX = SPM.xX; -[nScan nBeta] = size(xX.X); - -%-Check confounds (xX.K) and non-sphericity (xVi) -%----------------------------------------------------------------------- -if ~isfield(xX,'K') - xX.K = 1; -end -try - %-If covariance components are specified use them - %--------------------------------------------------------------- - xVi = SPM.xVi; -catch - - %-otherwise assume i.i.d. - %--------------------------------------------------------------- - xVi = struct( 'form', 'i.i.d.',... - 'V', speye(nScan,nScan)); - -end - -% Work out what we are going to do -have_W = isfield(xX, 'W'); -have_V = isfield(xVi, 'V'); - -% Work out type of covariance modelling. We get Vi, cov_type (as a string): -% one of 'SPM' or 'fmristat' and cov_vox, which is a flag set to 1 if all -% the voxel time courses should be used to calculate the resdiduals and -% covariance. -if ~have_V - if ~isfield(xVi, 'Vi') - error('No covariance specified, and no priors to calculate it'); - end - Vi = xVi.Vi; - if iscell(Vi) - cov_type = 'SPM'; - elseif ~isstruct(Vi) - error('Vi field should be cell or struct type') - elseif ~isfield(Vi, 'type') - error('Vi should have field specifying type'); - else - cov_type = Vi.type; - end - - % Covariance calculated on summary or voxel time courses - cov_vox = 1; - if isfield(xVi, 'cov_calc') - cov_vox = strcmpi(xVi.cov_calc, 'vox'); - end -else cov_vox = 0; end - -%-Get non-sphericity V -%======================================================================= -if have_V - %-If xVi.V is specified proceed directly to parameter estimation - %--------------------------------------------------------------- - V = xVi.V; - str = 'parameter estimation'; -else - % otherwise invoke ReML selecting voxels under i.i.d assumptions - %--------------------------------------------------------------- - V = speye(nScan,nScan); - str = '[hyper]parameter estimation'; -end - -%-Get whitening/Weighting matrix: If xX.W exists we will save WLS -% estimates. Get WVW also, which can be assumed if W is a whitening -% matrix -%----------------------------------------------------------------------- -if have_W - %-If W is specified, use it - %------------------------------------------------------- - W = xX.W; - if isempty(V) % V is only inv(W*W') - WVW = eye(nScan); - else - WVW = W*V*W'; - end -else - if have_V - % otherwise make W a whitening filter W*W' = inv(V) - %------------------------------------------------------- - [u s] = pr_spm_svd(xVi.V); - s = spdiags(1./sqrt(diag(s)),0,nScan,nScan); - W = u*s*u'; - W = W.*(abs(W) > 1e-6); - xX.W = W; - WVW = eye(nScan); - else - % unless xVi.V has not been estimated - requiring 2 passes - %------------------------------------------------------- - W = eye(nScan); - str = 'hyperparameter estimation (1st pass)'; - end -end - -%-Design space and projector matrix [pseudoinverse] for WLS -%======================================================================= -xX.xKXs = spm_sp('Set',pr_spm_filter(xX.K,W*xX.X)); % KWX -xX.pKX = spm_sp('x-',xX.xKXs); % projector - -%-If xVi.V is not defined compute Hsqr -%----------------------------------------------------------------------- -if ~isfield(xVi,'V') - Fcname = 'effects of interest'; - iX0 = [SPM.xX.iB SPM.xX.iG]; - xCon = spm_FcUtil('Set',Fcname,'F','iX0',iX0,xX.xKXs); - X1o = spm_FcUtil('X1o', xCon(1),xX.xKXs); - Hsqr = spm_FcUtil('Hsqr',xCon(1),xX.xKXs); - trRV = spm_SpUtil('trRV',xX.xKXs); - trMV = spm_SpUtil('trMV',X1o); -end - -fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-# - -%======================================================================= -% - F I T M O D E L & W R I T E P A R A M E T E R I M A G E S -%======================================================================= - -% Select whether to work with all voxel data in ROIs, or summary data -% Using all data only makes sense for intial estimation of whitening -if ~have_W & cov_vox - str = 'voxelwise'; - Y = region_data(marsY); - Y = [Y{:}]; -else - str = 'pooled'; - Y = summary_data(marsY); -end - -% Eliminate columns with zero variance -in_cols = any(diff(Y)); -if ~any(in_cols), error('No variance to estimate model'); end -Y = Y(:, in_cols); - -fprintf('%-40s: %30s\n','Covariance estimate',['...' str]) %-# -fprintf('%-40s: %30s','Model','...start') %-# - -n_roi = n_regions(marsY); - -%-Intialise variables used in the loop -%======================================================================= -[n S] = size(Y); % no of time courses -Cy = 0; % spatially whitened -CY = 0; % for ReML -EY = 0; % for ReML -%-Whiten/Weight data and remove filter confounds -%------------------------------------------------------- -fprintf('%s%30s',repmat(sprintf('\b'),1,30),'filtering') %-# - -KWY = pr_spm_filter(xX.K,W*Y); - -%-General linear model: Weighted least squares estimation -%------------------------------------------------------ -fprintf('%s%30s',repmat(sprintf('\b'),1,30),'estimation') %-# - -beta = xX.pKX*KWY; %-Parameter estimates -res = spm_sp('r',xX.xKXs,KWY); %-Residuals -ResSS = sum(res.^2); %-Residual SSQ -clear KWY %-Clear to save memory - - -%-If ReML hyperparameters are needed for xVi.V -%------------------------------------------------------- -if ~have_V - if n_roi > 1 - wstr = {'Pooling covariance estimate across ROIs',... - 'This is unlikely to be valid; A better approach',... - 'is to run estimation separately for each ROI'}; - fprintf('\n'); - warning(sprintf('%s\n', wstr{:})); - end - % Cy is whitened covariance matrix; only needed for SPM REML method - if strcmp(cov_type, 'SPM') - q = diag(sqrt(trRV./ResSS'),0); % spatial whitening - Y = Y * q; - Cy = Y*Y'; - end -end % have_V - -%-if we are saving the WLS parameters -%------------------------------------------------------- -if have_W - - %-sample covariance and mean of Y (all voxels) - %----------------------------------------------- - CY = Y*Y'; - EY = sum(Y,2); - -end % have_W -clear Y %-Clear to save memory - -fprintf('\n') %-# -spm_progress_bar('Clear') - -%======================================================================= -% - P O S T E S T I M A T I O N C L E A N U P -%======================================================================= -if S == 0, warning('No time courses - empty analysis!'), end - -%-average sample covariance and mean of Y (over voxels) -%----------------------------------------------------------------------- -CY = CY/S; -EY = EY/S; -CY = CY - EY*EY'; - -%-If not defined, compute non-sphericity V using ReML Hyperparameters -%======================================================================= -if ~have_V - - %-Estimate of residual correlations through hyperparameters - %--------------------------------------------------------------- - str = 'Temporal non-sphericity (over voxels)'; - fprintf('%-40s: %30s\n',str,'...estimation') %-# - Cy = Cy/S; - - % Estimate for separable designs and covariance components - %--------------------------------------------------------------- - if isstruct(xX.K) - - switch cov_type - case 'SPM' - % Store hyperparameters - m = length(Vi); - h = zeros(m,1); - case 'fmristat' - % Store AR coefficients - h = zeros(length(xX.K), Vi.order); - otherwise - error(['Did not recognize covariance type: ' cov_type]); - end - - V = sparse(nScan,nScan); - for i = 1:length(xX.K) - - % extract blocks from bases - %----------------------------------------------- - q = xX.K(i).row; - - % design space for estimation (with confounds in filter) - %----------------------------------------------- - Xp = xX.X(q,:); - try - Xp = [Xp xX.K(i).X0]; - end - - switch cov_type - case 'SPM' - % REML: extract blocks from bases - %----------------------------------------------- - p = []; - Qp = {}; - for j = 1:m - if nnz(xVi.Vi{j}(q,q)) - Qp{end + 1} = xVi.Vi{j}(q,q); - p = [p j]; - end - end - - % ReML itself - %----------------------------------------------- - fprintf('%-30s- %i\n',' ReML Block',i); - [Vp,hp] = pr_spm_reml(Cy(q,q),Xp,Qp); - V(q,q) = V(q,q) + Vp; - h(p) = hp; - - case 'fmristat' - % AR estimation - [h(i,:) W(q,q)] = pr_fmristat_ar(res(q,:),Xp,Vi.order); - - end - end - else - [V,h] = pr_spm_reml(Cy,xX.X,xVi.Vi); - end - - switch cov_type - case 'SPM' - % normalize non-sphericity and save hyperparameters - %--------------------------------------------------------------- - V = V*nScan/trace(V); - case 'fmristat' - % Set covariance matrix to empty, we have already calculated W - %--------------------------------------------------------------- - V = []; - SPM.xX.W = W; - end - - xVi.h = h; - xVi.V = V; % Save non-sphericity xVi.V - xVi.Cy = Cy; %-spatially whitened - SPM.xVi = xVi; % non-sphericity structure - - % If xX.W is not specified use W*W' = inv(V) to give ML estimators - %--------------------------------------------------------------- - if ~have_W - % clear everything except SPM, marsY; - vnames = who; - vnames = vnames(~ismember(vnames, {'SPM','marsY'})); - clear(vnames{:}); - SPM = pr_estimate(SPM,marsY); - return - end -end - - -%-Use non-sphericity xVi.V to compute [effective] degrees of freedom -%======================================================================= -xX.V = pr_spm_filter(xX.K,pr_spm_filter(xX.K,WVW)'); % KWVW'K' -[trRV trRVRV] = spm_SpUtil('trRV',xX.xKXs,xX.V); % trRV (for X) -xX.trRV = trRV; % -xX.trRVRV = trRVRV; %-Satterthwaite -xX.erdf = trRV^2/trRVRV; % approximation -xX.Bcov = xX.pKX*xX.V*xX.pKX'; % Cov(beta) - - -%-scale ResSS by 1/trRV -%----------------------------------------------------------------------- -ResMS = ResSS/xX.trRV; - -%-Create 1st contrast for 'effects of interest' (all if not specified) -%======================================================================= -Fcname = 'effects of interest'; -try - iX0 = [xX.iB xX.iG]; -catch - iX0 = []; -end -xCon = spm_FcUtil('Set',Fcname,'F','iX0',iX0,xX.xKXs); - -%-Compute scaled design matrix for display purposes -%----------------------------------------------------------------------- -xX.nKX = spm_DesMtx('sca',xX.xKXs.X,xX.name); - -%-place fields in SPM -%----------------------------------------------------------------------- -SPM.betas = ones(nBeta, n_roi) + NaN; -SPM.betas(:, in_cols) = beta; -SPM.ResidualMS = ones(1, n_roi) + NaN; -SPM.ResidualMS(in_cols) = ResMS; - -SPM.xVi = xVi; % non-sphericity structure -SPM.xVi.CY = CY; %-<(Y - )*(Y - )'> - -SPM.xX = xX; %-design structure - -SPM.xCon = xCon; %-contrast structure - -%======================================================================= -%- E N D: Cleanup GUI -%======================================================================= -fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-# -spm('FigName','Stats: done',Finter); spm('Pointer','Arrow') -fprintf('%-40s: %30s\n','Completed',spm('time')) %-# -fprintf('...use the results section for assessment\n\n') %-# diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_fmri_design.m b/lib/marsbar-0.44/@mardo_5/private/pr_fmri_design.m deleted file mode 100644 index 7c83f75..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_fmri_design.m +++ /dev/null @@ -1,206 +0,0 @@ -function [SPM] = pr_fmri_design(SPM) -% MarsBaR version of spm_fMRI design - asssembles a design for fMRI studies -% FORMAT [SPM] = pr_fmri_design(SPM) -% -% This file is a hardly edited version of: -% @(#)spm_fMRI_design.m 2.34 Karl Friston 03/01/30 -% See that (SPM2) version for comments etc -% -% $Id: pr_fmri_design.m 607 2006-03-30 20:54:55Z matthewbrett $ - -%-GUI setup -%----------------------------------------------------------------------- -SPMid = spm('SFnBanner',mfilename,marsbar('ver')); -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','fMRI stats model setup',0); -spm_help('!ContextHelp',mfilename) - -% construct Design matrix {X} - cycle over sessions -%======================================================================= - -% global parameters -%----------------------------------------------------------------------- -try - fMRI_T = SPM.xBF.T; - fMRI_T0 = SPM.xBF.T0; -catch - global defaults - d_fmri = mars_struct('getifthere', defaults, 'stats', 'fmri'); - if mars_struct('isthere', d_fmri, 't') - fMRI_T = d_fmri.t; - fMRI_T0 = d_fmri.t0; - else, - fMRI_T = 16; - fMRI_T0 = 1; - end; - SPM.xBF.T = fMRI_T; - SPM.xBF.T0 = fMRI_T0; -end - - -% get nscan and RT if not in SPM -%----------------------------------------------------------------------- -try - SPM.xY.RT; -catch - spm_input('Basic parameters...',1,'d',mfilename) - SPM.xY.RT = spm_input('Interscan interval {secs}','+1','r',[],1); -end -try - SPM.nscan; -catch - SPM.nscan = spm_input(['scans per session e.g. 64 64 64'],'+1'); -end - -% time units, dt = time bin {secs} -%----------------------------------------------------------------------- -SPM.xBF.dt = SPM.xY.RT/SPM.xBF.T; -try - SPM.xBF.UNITS; -catch - str = 'specify design in'; - SPM.xBF.UNITS = spm_input(str,'+1','scans|secs'); -end - -% separate specifications for non-relicated sessions -%----------------------------------------------------------------------- -rep = 0; -if length(SPM.nscan) > 1 & ~any(diff(SPM.nscan)) & ~isfield(SPM,'Sess') - str = 'are sessions replications'; - rep = spm_input(str,'+1','yes|no',[1 0]); -end - -% Get basis functions -%----------------------------------------------------------------------- -try - bf = SPM.xBF.bf; -catch - SPM.xBF = pr_spm_get_bf(SPM.xBF); - bf = SPM.xBF.bf; -end - -% 1st or 2nd order Volterra expansion? -%----------------------------------------------------------------------- -try - V = SPM.xBF.Volterra; -catch - str = 'model interactions (Volterra)'; - V = spm_input(str,'+1','y/n',[2 1]); - SPM.xBF.Volterra = V; -end - - -% get session specific design parameters -%======================================================================= -Xx = []; -Xb = []; -Xname = {}; -Bname = {}; -for s = 1:length(SPM.nscan) - - % number of scans for this session - %--------------------------------------------------------------- - k = SPM.nscan(s); - - if (s == 1) | ~rep - - % create convolved stimulus functions or inputs - %======================================================= - - % Get inputs, neuronal causes or stimulus functions U - %------------------------------------------------------- - U = pr_spm_get_ons(SPM,s); - - % Convolve stimulus functions with basis functions - %------------------------------------------------------- - [X,Xn,Fc] = pr_spm_volterra(U,bf,V); - - % Resample regressors at acquisition times (32 bin offset) - %------------------------------------------------------- - try - X = X([0:(k - 1)]*fMRI_T + fMRI_T0 + 32,:); - end - - % and orthonalise (within trial type) - %------------------------------------------------------- - for i = 1:length(Fc) - X(:,Fc(i).i) = pr_spm_orth(X(:,Fc(i).i)); - end - - % get user specified regressors - %======================================================= - try - C = SPM.Sess(s).C.C; - Cname = SPM.Sess(s).C.name; - catch - - % covariates - C - %----------------------------------------------- - str = sprintf('Session %d',s); - spm_input('Other regressors',1,'d',str) - C = []; - c = spm_input('user specified','+1','w1',0); - while size(C,2) < c - str = sprintf('regressor %i',size(C,2) + 1); - C = [C spm_input(str,2,'e',[],[k Inf])]; - end - - % and their names - Cnames - %----------------------------------------------- - Cname = {}; - for i = 1:size(C,2) - str = sprintf('regressor %i',i); - Cname{i} = spm_input('name of','+0','s',str); - end - end - - % append mean-corrected regressors and names - %------------------------------------------------------- - X = [X spm_detrend(C)]; - Xn = {Xn{:} Cname{:}}; - - % Confounds: Session effects - %======================================================= - B = ones(k,1); - Bn{1} = sprintf('constant'); - - end - - % Session structure array - %--------------------------------------------------------------- - SPM.Sess(s).U = U; - SPM.Sess(s).C.C = C; - SPM.Sess(s).C.name = Cname; - SPM.Sess(s).row = size(Xx,1) + [1:k]; - SPM.Sess(s).col = size(Xx,2) + [1:size(X,2)]; - SPM.Sess(s).Fc = Fc; - - % Append names - %--------------------------------------------------------------- - for i = 1:length(Xn) - Xname{end + 1} = [sprintf('Sn(%i) ',s) Xn{i}]; - end - for i = 1:length(Bn) - Bname{end + 1} = [sprintf('Sn(%i) ',s) Bn{i}]; - end - - % append into Xx and Xb - %=============================================================== - Xx = blkdiag(Xx,X); - Xb = blkdiag(Xb,B); - -end %- for s - - -% finished -%----------------------------------------------------------------------- -SPM.xX.X = [Xx Xb]; -SPM.xX.iH = []; -SPM.xX.iC = [1:size(Xx,2)]; -SPM.xX.iB = [1:size(Xb,2)] + size(Xx,2); -SPM.xX.iG = []; -SPM.xX.name = {Xname{:} Bname{:}}; - - -%-End -%----------------------------------------------------------------------- -spm_input('!DeleteInputObj') diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_fmristat_ar.m b/lib/marsbar-0.44/@mardo_5/private/pr_fmristat_ar.m deleted file mode 100644 index 081b0ad..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_fmristat_ar.m +++ /dev/null @@ -1,79 +0,0 @@ -function [rho,Vmhalf,V] = pr_fmristat_ar(res,X,nlags) -% function returns estimated AR coefficients using fmristat algorithm -% FORMAT [rho,Vmhalf,V] = pr_fmristat_ar(res,X,nlags) -% -% See http://www.math.mcgill.ca/keith/fmristat/ and -% fmrilm.m in fmristat package for code, and -% Worsley, K.J., Liao, C., Aston, J., Petre, V., Duncan, G.H., Morales, -% F., Evans, A.C. (2002). A general statistical analysis for fMRI -% data. NeuroImage, 15:1-15 - for description of the algorithm -% -% $Id: pr_fmristat_ar.m 301 2004-02-04 03:53:23Z matthewbrett $ - -% This is the copyright notice from fmrilm: -%############################################################################ -% COPYRIGHT: Copyright 2002 K.J. Worsley -% Department of Mathematics and Statistics, -% McConnell Brain Imaging Center, -% Montreal Neurological Institute, -% McGill University, Montreal, Quebec, Canada. -% worsley@math.mcgill.ca, liao@math.mcgill.ca -% -% Permission to use, copy, modify, and distribute this -% software and its documentation for any purpose and without -% fee is hereby granted, provided that the above copyright -% notice appear in all copies. The author and McGill University -% make no representations about the suitability of this -% software for any purpose. It is provided "as is" without -% express or implied warranty. -%############################################################################ - -if nargin < 2 - error('Need covariance and design'); -end -if nargin < 3 - nlags = 1; -end - -sX = spm_sp('Set', X); -R = spm_sp('r', sX); - -nlp1 = nlags+1; -[n nvox] = size(res); - -% Bias reduction -M=zeros(nlp1); -for i=1:(nlp1) - for j=1:(nlp1) - Di=(diag(ones(1,n-i+1),i-1)+diag(ones(1,n-i+1),-i+1))/(1+(i==1)); - Dj=(diag(ones(1,n-j+1),j-1)+diag(ones(1,n-j+1),-j+1))/(1+(j==1)); - M(i,j)=trace(R*Di*R*Dj)/(1+(i>1)); - end -end -invM = inv(M); - -a = zeros(nlp1,nvox); -for lag = 0:nlags - a(lag+1,:)= sum(res(1:(n-lag),:).*res((lag+1):n,:)); -end - -vhat = invM*a; -rho = vhat(2:end,:) ./ (ones(nlags, 1) * vhat(1,:)); -rho = mean(rho,2)'; - -if nargout > 1 - % Whitening matrix; Appendix A3 Worsley et al (2002) - % Modified according to fmrilm code - [Ainvt posdef] = chol(toeplitz([1 rho])); - nl=size(Ainvt,1); - A=inv(Ainvt'); - Vmhalf = zeros(n,n); - B=ones(n-nl,1)*A(nl,:); - Vmhalf(nl+1:end,:) = spdiags(B,1:nl,n-nl,n); - Vmhalf(1:nl,1:nl) = A; -end - -if nargout > 2 - % Estimated covariance - V = inv(Vmhalf*Vmhalf'); -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_get_filter.m b/lib/marsbar-0.44/@mardo_5/private/pr_get_filter.m deleted file mode 100644 index c0256f9..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_get_filter.m +++ /dev/null @@ -1,51 +0,0 @@ -function [K, str] = pr_get_filter(RT, row) -% gets filter using spm_fmri_spm_ui routines -% FORMAT [K, str]= pr_get_filter(RT, row) -% or -% FORMAT [K, str]= pr_get_filter(RT, Sess) -% -% $Id: pr_get_filter.m 77 2003-12-25 09:00:03Z matthewbrett $ - -if nargin < 2 - error('Need TR, row / Sess matrix'); -end - -% number of sessions -nsess = length(row); - -% rows from Sess -if isfield(row(1), 'row') - Sess = row; - row = {}; - for s = 1:nsess - row{s} = Sess(s).row; - end -else - Sess = []; -end - -switch spm_input('High-pass filter?','+1','b','none|specify'); - - case 'specify' - % default 128 seconds - %------------------------------------------------------- - HParam = 128*ones(1,nsess); - p_str = 'cutoff period (secs)'; - HParam = spm_input(p_str,'+1','e',HParam,[1 nsess]); - str = sprintf('Cutoff: %d {s}', HParam); - - case 'none' - % Inf seconds (i.e. constant term only) - %------------------------------------------------------- - HParam = Inf*ones(1,nsess); - str = 'none'; -end - -% create and set filter struct -%--------------------------------------------------------------- -for i = 1:nsess - K(i) = struct( 'HParam', HParam(i),... - 'row', row{i},... - 'RT', RT); -end -K = pr_spm_filter(K); diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_cat.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_cat.m deleted file mode 100644 index cb20d73..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_cat.m +++ /dev/null @@ -1,96 +0,0 @@ -function [x] = pr_spm_cat(x,d) -% converts a cell array into a matrix -% FORMAT [x] = pr_spm_cat(x,d); -% x - cell array -% d - dimension over which to concatenate [default - both] -%__________________________________________________________________________ -% Empty array elements are replaced by sparse zero partitions -% and single 0 entries are expanded to conform to the non-empty -% non zero elements. -% -% e.g.: -% > x = pr_spm_cat({eye(2) []; 0 [1 1; 1 1]}) -% > full(x) = -% -% 1 0 0 0 -% 0 1 0 0 -% 0 0 1 1 -% 0 0 1 1 -%__________________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_cat.m 258 2005-10-18 18:21:07Z karl $ - -% check x is not already a matrix -%-------------------------------------------------------------------------- -if ~iscell(x), return, end - -% if concatenation over a specific dimension -%-------------------------------------------------------------------------- -[n m] = size(x); -if nargin > 1 - - % concatenate over first dimension - %---------------------------------------------------------------------- - if d == 1 - y = cell(1,m); - for i = 1:m - y{i} = pr_spm_cat(x(:,i)); - end - - % concatenate over second - %---------------------------------------------------------------------- - elseif d == 2 - - y = cell(n,1); - for i = 1:n - y{i} = pr_spm_cat(x(i,:)); - end - - % only viable for 2-D arrays - %---------------------------------------------------------------------- - else - error('uknown option') - end - x = y; - return - -end - -% find dimensions to fill in empty partitions -%-------------------------------------------------------------------------- -for i = 1:n -for j = 1:m - if iscell(x{i,j}) - x{i,j} = pr_spm_cat(x{i,j}); - end - [u v] = size(x{i,j}); - I(i,j) = u; - J(i,j) = v; -end -end -I = max(I,[],2); -J = max(J,[],1); - -% sparse and empty partitions -%-------------------------------------------------------------------------- -[n m] = size(x); -for i = 1:n -for j = 1:m - if isempty(x{i,j}) - x{i,j} = zeros(I(i),J(j)); - elseif ~x{i,j} - x{i,j} = zeros(I(i),J(j)); - else - x{i,j} = full(x{i,j}); - end -end -end - -% concatenate -%-------------------------------------------------------------------------- -for i = 1:n - y{i,1} = cat(2,x{i,:}); -end -x = sparse(cat(1,y{:})); diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_ce.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_ce.m deleted file mode 100644 index 7d7c1ec..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_ce.m +++ /dev/null @@ -1,57 +0,0 @@ -function [C] = pr_spm_ce(v,a) -% return error covariance constraints for serially correlated data -% FORMAT [C] = pr_spm_ce(v,a) -% v - (1 x l) v(i) = number of observations for ith block -% a - AR coefficient expansion point (default a = []) -% -% C{1} = h(1)*AR(a) -% C{2} = h(1)*AR(a) + h(2)*dAR(a)/da(1); -% C{3} = h(1)*AR(a) + h(2)*dAR(a)/da(1) + h(3)*dAR(a)/da(2); -% -% See also: spm_Q.m -%___________________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_Ce.m 190 2005-06-20 07:04:35Z klaas $ - - - -% defaults -%--------------------------------------------------------------------------- -if nargin == 1 - a = []; -end - - -% create blocks -%--------------------------------------------------------------------------- -C = {}; -l = length(v); -n = sum(v); -k = 0; -if l > 1 - for i = 1:l - dCda = pr_spm_ce(v(i),a); - for j = 1:length(dCda) - [x y q] = find(dCda{j}); - x = x + k; - y = y + k; - C{end + 1} = sparse(x,y,q,n,n); - end - k = v(i) + k; - end -else - % dCda - %================================================================== - C{1} = pr_spm_q(a,v); - dCda = pr_spm_diff('pr_spm_q',a,v,1); - for i = 1:length(a) - try - C{i + 1} = dCda{i}; - catch - C{i + 1} = dCda; - end - end - -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_diff.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_diff.m deleted file mode 100644 index 0d26b51..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_diff.m +++ /dev/null @@ -1,115 +0,0 @@ -function [J] = pr_spm_diff(varargin) -% matrix high-order differentials -% FORMAT [dfdx] = pr_spm_diff(f,x,...,n) -% -% f - [inline] function f(x{1},...) -% x - input argument[s] -% n - arguments to differentiate w.r.t. -% -% dfdx - df/dx{i} ; n = i -% dfdx{p}...{q} - df/dx{i}dx{j}(q)...dx{k}(p) ; n = [i j ... k] -% -% - a cunning recursive routine -%__________________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_diff.m 417 2006-02-01 13:50:14Z karl $ - -% create inline object -%-------------------------------------------------------------------------- -f = fcnchk(varargin{1}); -x = varargin(2:(end - 1)); -n = varargin{end}; -m = n(end); -xm = pr_spm_vec(x{m}); -dx = exp(-8); -J = cell(1,length(xm)); - -% proceed to derivatives -%========================================================================== -if length(n) == 1 - - % dfdx - %---------------------------------------------------------------------- - f0 = feval(f,x{:}); - for i = 1:length(J) - xi = x; - xmi = xm; - xmi(i) = xmi(i) + dx; - xi{n} = pr_spm_unvec(xmi,xi{n}); - fi = feval(f,xi{:}); - J{i} = pr_spm_dfdx(fi,f0,dx); - end - -else - - % dfdxdxdx.... - %---------------------------------------------------------------------- - f0 = pr_spm_diff(f,x{:},n(1:end - 1)); - for i = 1:length(J) - xi = x; - xmi = xm; - xmi(i) = xmi(i) + dx; - xi{m} = pr_spm_unvec(xmi,xi{m}); - fi = pr_spm_diff(f,xi{:},n(1:end - 1)); - J{i} = pr_spm_dfdx(fi,f0,dx); - end - return - -end - -% return numeric array for first order derivatives -%========================================================================== - -% vectorise f -%-------------------------------------------------------------------------- -f = pr_spm_vec(f0); - -% if there are no arguments to differentiate w.r.t. ... -%-------------------------------------------------------------------------- -if ~length(xm) - J = sparse(length(f),0); - return -end - -% if there are no arguments to differentiate -%-------------------------------------------------------------------------- -if ~length(f) - J = sparse(0,length(xm)); - return -end - -% if f is a scalar -%-------------------------------------------------------------------------- -if length(f) == 1 - J = pr_spm_cat(J); - return -end - -% if x{n} is a scalar -%-------------------------------------------------------------------------- -if length(xm) == 1 - J = pr_spm_cat(J); - return -end - -% else f and xm are vectors return numeric array -%-------------------------------------------------------------------------- -for i = 1:length(J) - J{i} = pr_spm_vec(J{i}); -end -J = pr_spm_cat(J); -return - -function dfdx = pr_spm_dfdx(f,f0,dx) -% cell subtraction -%-------------------------------------------------------------------------- -if iscell(f) - dfdx = f; - for i = 1:length(f(:)) - dfdx{i} = pr_spm_dfdx(f{i},f0{i},dx); - end -else - dfdx = (f - f0)/dx; -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_en.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_en.m deleted file mode 100644 index 1b91afa..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_en.m +++ /dev/null @@ -1,18 +0,0 @@ -function [X] = pr_spm_en(X) -% Euclidean normalization -% FORMAT [X] = pr_spm_en(X); -% X - matrix -%_______________________________________________________________________ -% -% spm_en performs a Euclidean normalization setting column-wise sum of -% squares to unity -%_______________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_en.m 112 2005-05-04 18:20:52Z john $ - - -for i = 1:size(X,2) - X(:,i) = X(:,i)/sqrt(sum(X(:,i).^2)); -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_fileparts.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_fileparts.m deleted file mode 100644 index cdb45a5..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_fileparts.m +++ /dev/null @@ -1,23 +0,0 @@ -function [pth,nam,ext,num] = spm_fileparts(fname) -% Like fileparts, but separates off a comma separated list at the end -% FORMAT [pth,nam,ext,num] = spm_fileparts(fname) -% fname - original filename -% pth - path -% nam - filename -% ext - extension -% num - comma separated list of values -% -%_______________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% John Ashburner -% $Id: spm_fileparts.m 112 2005-05-04 18:20:52Z john $ - - -num = ''; -[pth,nam,ext] = fileparts(fname); -ind = find(ext==','); -if ~isempty(ind), - num = ext(ind(1):end); - ext = ext(1:(ind(1)-1)); -end; diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_filter.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_filter.m deleted file mode 100644 index a3f756d..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_filter.m +++ /dev/null @@ -1,90 +0,0 @@ -function [argout] = pr_spm_filter(K,Y) -% Removes low frequency confounds X0 -% FORMAT [Y] = pr_spm_filter(K,Y) -% FORMAT [K] = pr_spm_filter(K) -% -% K - filter matrix or: -% K(s) - struct array containing partition-specific specifications -% -% K(s).RT - observation interval in seconds -% K(s).row - row of Y constituting block/partition s -% K(s).HParam - cut-off period in seconds -% -% K(s).X0 - low frequencies to be removed (DCT) -% -% Y - data matrix -% -% K - filter structure -% Y - filtered data -%___________________________________________________________________________ -% -% spm_filter implements high-pass filtering in an efficient way by -% using the residual forming matrix of X0 - low frequency confounds -%.spm_filter also configures the filter structure in accord with the -% specification fields if called with one argument -%___________________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_filter.m 184 2005-05-31 13:23:32Z john $ - - - -% set or apply -%--------------------------------------------------------------------------- -if nargin == 1 && isstruct(K) - - % set K.X0 - %------------------------------------------------------------------- - for s = 1:length(K) - - % make high pass filter - %----------------------------------------------------------- - k = length(K(s).row); - n = fix(2*(k*K(s).RT)/K(s).HParam + 1); - X0 = spm_dctmtx(k,n); - K(s).X0 = X0(:,2:end); - end - - % return structure - %------------------------------------------------------------------- - argout = K; - -else - % apply - %------------------------------------------------------------------- - if isstruct(K) - - % ensure requisite feilds are present - %----------------------------------------------------------- - if ~isfield(K(1),'X0') - K = pr_spm_filter(K); - end - - for s = 1:length(K) - - % select data - %--------------------------------------------------- - y = Y(K(s).row,:); - - % apply high pass filter - %--------------------------------------------------- - y = y - K(s).X0*(K(s).X0'*y); - - % reset filtered data in Y - %--------------------------------------------------- - Y(K(s).row,:) = y; - - end - - % K is simply a filter matrix - %------------------------------------------------------------------- - else - Y = K*Y; - end - - % return filtered data - %------------------------------------------------------------------- - %if any(~isfinite(Y)), warning('Found non-finite values in Y (could be the data).'); end; - argout = Y; -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_get_bf.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_get_bf.m deleted file mode 100644 index 9f2cc0b..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_get_bf.m +++ /dev/null @@ -1,180 +0,0 @@ -function [xBF] = pr_spm_get_bf(xBF) -% fills in basis function structure -% FORMAT [xBF] = spm_get_bf(xBF); -% -% xBF.dt - time bin length {seconds} -% xBF.name - description of basis functions specified -% xBF.length - window length (secs) -% xBF.order - order -% xBF.bf - Matrix of basis functions -% -% xBF.name 'hrf' -% 'hrf (with time derivative)' -% 'hrf (with time and dispersion derivatives)' -% 'Fourier set' -% 'Fourier set (Hanning)' -% 'Gamma functions' -% 'Finite Impulse Response'}; -% -% (any other specifiaction will default to hrf) -%_______________________________________________________________________ -% -% spm_get_bf prompts for basis functions to model event or epoch-related -% responses. The basis functions returned are unitary and orthonormal -% when defined as a function of peri-stimulus time in time-bins. -% It is at this point that the distinction between event and epoch-related -% responses enters. -%_______________________________________________________________________ -% @(#)spm_get_bf.m 2.22 Karl Friston 02/04/19 - -%-GUI setup -%----------------------------------------------------------------------- -spm_help('!ContextHelp',mfilename) - -% length of time bin -%----------------------------------------------------------------------- -if ~nargin - str = 'time bin for basis functions {secs}'; - xBF.dt = spm_input(str,'+1','r',1/16,1); -end -dt = xBF.dt; - - -% assemble basis functions -%======================================================================= - -% model event-related responses -%----------------------------------------------------------------------- -if ~isfield(xBF,'name') - spm_input('Hemodynamic Basis functions...',1,'d') - Ctype = { - 'hrf',... - 'hrf (with time derivative)',... - 'hrf (with time and dispersion derivatives)',... - 'Fourier set',... - 'Fourier set (Hanning)',... - 'Gamma functions',... - 'Finite Impulse Response'}; - str = 'Select basis set'; - Sel = spm_input(str,2,'m',Ctype); - xBF.name = Ctype{Sel}; -end - -% get order and length parameters -%----------------------------------------------------------------------- -switch xBF.name - - case { 'Fourier set','Fourier set (Hanning)',... - 'Gamma functions','Finite Impulse Response'} - %--------------------------------------------------------------- - try, l = xBF.length; - catch, l = spm_input('window length {secs}',3,'e',32); - xBF.length = l; - end - try, h = xBF.order; - catch, h = spm_input('order',4,'e',4); - xBF.order = h; - end -end - - - -% create basis functions -%----------------------------------------------------------------------- -switch xBF.name - - case {'Fourier set','Fourier set (Hanning)'} - %--------------------------------------------------------------- - pst = [0:dt:l]'; - pst = pst/max(pst); - - % hanning window - %--------------------------------------------------------------- - if strcmp(xBF.name,'Fourier set (Hanning)') - g = (1 - cos(2*pi*pst))/2; - else - g = ones(size(pst)); - end - - % zeroth and higher Fourier terms - %--------------------------------------------------------------- - bf = g; - for i = 1:h - bf = [bf g.*sin(i*2*pi*pst)]; - bf = [bf g.*cos(i*2*pi*pst)]; - end - - case {'Gamma functions'} - %--------------------------------------------------------------- - pst = [0:dt:l]'; - bf = spm_gamma_bf(pst,h); - - case {'Finite Impulse Response'} - %--------------------------------------------------------------- - bin = l/h; - bf = kron(eye(h),ones(round(bin/dt),1)); - - case {'NONE'} % innovation from SPM5 - %--------------------------------------------------------------- - bf = 1; - -otherwise - - % canonical hemodynaic response function - %--------------------------------------------------------------- - [bf p] = pr_spm_hrf(dt); - - % add time derivative - %--------------------------------------------------------------- - if findstr(xBF.name,'time') - - dp = 1; - p(6) = p(6) + dp; - D = (bf(:,1) - pr_spm_hrf(dt,p))/dp; - bf = [bf D(:)]; - p(6) = p(6) - dp; - - % add dispersion derivative - %-------------------------------------------------------- - if findstr(xBF.name,'dispersion') - - dp = 0.01; - p(3) = p(3) + dp; - D = (bf(:,1) - pr_spm_hrf(dt,p))/dp; - bf = [bf D(:)]; - end - end - - % length and order - %--------------------------------------------------------------- - xBF.length = size(bf,1)*dt; - xBF.order = size(bf,2); - -end - - -% Orthogonalize and fill in basis function structure -%------------------------------------------------------------------------ -xBF.bf = pr_spm_orth(bf); - - -%======================================================================= -%- S U B - F U N C T I O N S -%======================================================================= - -% compute Gamma functions functions -%----------------------------------------------------------------------- -function bf = spm_gamma_bf(u,h) -% returns basis functions used for Volterra expansion -% FORMAT bf = spm_gamma_bf(u,h); -% u - times {seconds} -% h - order -% bf - basis functions (mixture of Gammas) -%_______________________________________________________________________ -u = u(:); -bf = []; -for i = 2:(1 + h) - m = 2^i; - s = sqrt(m); - bf = [bf pr_spm_gpdf(u,(m/s)^2,m/s^2)]; -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_get_ons.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_get_ons.m deleted file mode 100644 index 1b08001..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_get_ons.m +++ /dev/null @@ -1,263 +0,0 @@ -function [U] = pr_spm_get_ons(SPM,s) -% returns input [designed effects] structures -% FORMAT [U] = spm_get_ons(SPM,s) -% -% s - session number (used by batch system) -% -% U - (1 x n) struct array of (n) trial-specific structures -% -% U(i).name - cell of names for each input or cause -% U(i).u - inputs or stimulus function matrix -% U(i).dt - time bin (seconds) -% U(i).ons - onsets (in SPM.xBF.UNITS) -% U(i).dur - durations (in SPM.xBF.UNITS) -% U(i).P - parameter struct. -% -% U(i).P(p).name - parameter name -% U(i).P(p).P - parameter vector -% U(i).P(p).h - order of polynomial expansion -% U(i).P(p).i - sub-indices of u pertaining to P -%_______________________________________________________________________ -% -% -% SLICE TIMIING -% -% With longs TRs you may want to shift the regressors so that they are -% aligned to a particular slice. This is effected by resetting the -% values of defaults.stats.fmri.t and defaults.stats.fmri.t0 in -% spm_defaults. defaults.stats.fmri.t is the number of time-bins per -% scan used when building regressors. Onsets are defined -% in temporal units of scans starting at 0. defaults.stats.fmri.t0 is -% the first time-bin at which the regressors are resampled to coincide -% with data acquisition. If defaults.stats.fmri.t0 = 1 then the -% regressors will be appropriate for the first slice. If you want to -% temporally realign the regressors so that they match responses in the -% middle slice then make defaults.stats.fmri.t0 = -% defaults.stats.fmri.t/2 (assuming there is a negligible gap between -% volume acquisitions. Default values are defaults.stats.fmri.t = 16 -% and defaults.stats.fmri.t0 = 1. -% -% -%_______________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_get_ons.m 444 2006-02-17 19:43:17Z klaas $ - - -%-GUI setup -%----------------------------------------------------------------------- -spm_help('!ContextHelp',mfilename) - -% time units -%----------------------------------------------------------------------- -k = SPM.nscan(s); -T = SPM.xBF.T; -dt = SPM.xBF.dt; -try - UNITS = SPM.xBF.UNITS; -catch - UNITS = 'scans'; -end -switch UNITS - - case 'scans' - %---------------------------------------------------------------- - TR = T*dt; - - case 'secs' - %---------------------------------------------------------------- - TR = 1; -end - -% get inputs and names (try SPM.Sess(s).U first) -%======================================================================= -try - U = SPM.Sess(s).U; - v = length(U); -catch - - %-prompt string - %--------------------------------------------------------------- - str = sprintf('Session %d: trial specification in %s',s,UNITS); - spm_input(str,1,'d') - - U = {}; - v = spm_input('number of conditions/trials',2,'w1'); -end - -% get trials -%----------------------------------------------------------------------- -for i = 1:v - - % get names - %--------------------------------------------------------------- - try - Uname = U(i).name(1); - catch - str = sprintf('name for condition/trial %d ?',i); - Uname = {spm_input(str,3,'s',sprintf('trial %d',i))}; - U(i).name = Uname; - end - - % get main [trial] effects - %================================================================ - - % onsets - %--------------------------------------------------------------- - try - ons = U(i).ons; - ons = ons(:); - catch - ons = []; - end - if ~length(ons) - str = ['vector of onsets - ' Uname{1}]; - ons = spm_input(str,4,'r',' ',[Inf 1]); - U(i).ons = ons(:); - - end - - % durations - %--------------------------------------------------------------- - try - dur = U(i).dur; - dur = dur(:); - catch - dur = []; - end - if ~length(dur) - str = 'duration[s] (events = 0)'; - while 1 - dur = spm_input(str,5,'r',' ',[Inf 1]); - if length(dur) == 1 - dur = dur*ones(size(ons)); - end - if length(dur) == length(ons), break, end - str = sprintf('enter a scalar or [%d] vector',... - length(ons)); - end - U(i).dur = dur; - end - - % peri-stimulus times {seconds} - %--------------------------------------------------------------- - pst = [1:k]*T*dt - ons(1)*TR; - for j = 1:length(ons) - w = [1:k]*T*dt - ons(j)*TR; - v = find(w >= -1); - pst(v) = w(v); - end - - - % add parameters x trial interactions - %================================================================ - - % get parameter stucture xP - %---------------------------------------------------------------- - try - xP = U(i).P; - Pname = xP(1).name; - - switch Pname - - case 'none' - %------------------------------------------------ - xP.name = 'none'; - xP.h = 0; - - end - - catch - - Pname = {'none','time','other'}; - Pname = spm_input('parametric modulation',6,'b',Pname); - - switch Pname - - case 'none' - %-------------------------------------------------------- - xP(1).name = 'none'; - xP(1).h = 0; - - case 'time' - %-------------------------------------------------------- - xP(1).name = 'time'; - xP(1).P = ons*TR; - xP(1).h = spm_input('polynomial order',8,'n1',1); - - case 'other' - %-------------------------------------------------------- - str = ['# parameters (' Uname{1} ')']; - for q = 1:spm_input(str,7,'n1',1); - - % get names and parametric variates - %------------------------------------------------ - str = sprintf('parameter %d name',q); - Pname = spm_input(str,7,'s'); - P = spm_input(Pname,7,'r',[],[length(ons),1]); - - % order of polynomial expansion h - %------------------------------------------------ - h = spm_input('polynomial order',8,'n1',1); - - % sub-indices and inputs - %------------------------------------------------ - xP(q).name = Pname; - xP(q).P = P(:); - xP(q).h = h; - - end - end % switch - - end % try - - % interaction with causes (u) - 1st = main effects - %---------------------------------------------------------------- - u = ons.^0; - for q = 1:length(xP) - xP(q).i = [1, ([1:xP(q).h] + size(u,2))]; - for j = 1:xP(q).h - u = [u xP(q).P.^j]; - str = sprintf('%sx%s^%d',Uname{1},xP(q).name,j); - Uname{end + 1} = str; - end - end - - % orthogonalize inputs - %--------------------------------------------------------------- - u = pr_spm_orth(u); - - % and scale so sum(u*dt) = number of events, if event-related - %--------------------------------------------------------------- - if ~any(dur) - u = u/dt; - end - - % create stimulus functions (32 bin offset) - %=============================================================== - ton = round(ons*TR/dt) + 32; % onsets - tof = round(dur*TR/dt) + ton + 1; % offset - sf = sparse((k*T + 128),size(u,2)); - ton = max(ton,1); - tof = max(tof,1); - for j = 1:length(ton) - if numel(sf)>ton(j), - sf(ton(j),:) = sf(ton(j),:) + u(j,:); - end; - if numel(sf)>tof(j), - sf(tof(j),:) = sf(tof(j),:) - u(j,:); - end; - end - sf = cumsum(sf); % integrate - sf = sf(1:(k*T + 32),:); % stimulus - - % place in ouputs structure - %--------------------------------------------------------------- - U(i).name = Uname; % - input names - U(i).dt = dt; % - time bin {seconds} - U(i).u = sf; % - stimulus function matrix - U(i).pst = pst; % - pst (seconds) - U(i).P = xP; % - parameter struct - -end % (v) diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_gpdf.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_gpdf.m deleted file mode 100644 index 9732df3..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_gpdf.m +++ /dev/null @@ -1,98 +0,0 @@ -function f = pr_spm_gpdf(x,h,l) -% Probability Density Function (PDF) of Gamma distribution -% FORMAT f = pr_spm_Gpdf(g,h,l) -% -% x - Gamma-variate (Gamma has range [0,Inf) ) -% h - Shape parameter (h>0) -% l - Scale parameter (l>0) -% f - PDF of Gamma-distribution with shape & scale parameters h & l -%_______________________________________________________________________ -% -% spm_Gpdf implements the Probability Density Function of the Gamma -% distribution. -% -% Definition: -%----------------------------------------------------------------------- -% The PDF of the Gamma distribution with shape parameter h and scale l -% is defined for h>0 & l>0 and for x in [0,Inf) by: (See Evans et al., -% Ch18, but note that this reference uses the alternative -% parameterisation of the Gamma with scale parameter c=1/l) -% -% l^h * x^(h-1) exp(-lx) -% f(x) = --------------------- -% gamma(h) -% -% Variate relationships: (Evans et al., Ch18 & Ch8) -%----------------------------------------------------------------------- -% For natural (strictly +ve integer) shape h this is an Erlang distribution. -% -% The Standard Gamma distribution has a single parameter, the shape h. -% The scale taken as l=1. -% -% The Chi-squared distribution with v degrees of freedom is equivalent -% to the Gamma distribution with scale parameter 1/2 and shape parameter v/2. -% -% Algorithm: -%----------------------------------------------------------------------- -% Direct computation using logs to avoid roundoff errors. -% -% References: -%----------------------------------------------------------------------- -% Evans M, Hastings N, Peacock B (1993) -% "Statistical Distributions" -% 2nd Ed. Wiley, New York -% -% Abramowitz M, Stegun IA, (1964) -% "Handbook of Mathematical Functions" -% US Government Printing Office -% -% Press WH, Teukolsky SA, Vetterling AT, Flannery BP (1992) -% "Numerical Recipes in C" -% Cambridge -%_______________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Andrew Holmes -% $Id: spm_Gpdf.m 112 2005-05-04 18:20:52Z john $ - - -%-Format arguments, note & check sizes -%----------------------------------------------------------------------- -if nargin<3, error('Insufficient arguments'), end - -ad = [ndims(x);ndims(h);ndims(l)]; -rd = max(ad); -as = [ [size(x),ones(1,rd-ad(1))];... - [size(h),ones(1,rd-ad(2))];... - [size(l),ones(1,rd-ad(3))] ]; -rs = max(as); -xa = prod(as,2)>1; -if sum(xa)>1 & any(any(diff(as(xa,:)),1)) - error('non-scalar args must match in size'), end - -%-Computation -%----------------------------------------------------------------------- -%-Initialise result to zeros -f = zeros(rs); - -%-Only defined for strictly positive h & l. Return NaN if undefined. -md = ( ones(size(x)) & h>0 & l>0 ); -if any(~md(:)), f(~md) = NaN; - warning('Returning NaN for out of range arguments'), end - -%-Degenerate cases at x==0: h<1 => f=Inf; h==1 => f=l; h>1 => f=0 -ml = ( md & x==0 & h<1 ); -f(ml) = Inf; -ml = ( md & x==0 & h==1 ); if xa(3), mll=ml; else mll=1; end -f(ml) = l(mll); - -%-Compute where defined and x>0 -Q = find( md & x>0 ); -if isempty(Q), return, end -if xa(1), Qx=Q; else Qx=1; end -if xa(2), Qh=Q; else Qh=1; end -if xa(3), Ql=Q; else Ql=1; end - -%-Compute -f(Q) = exp( (h(Qh)-1).*log(x(Qx)) +h(Qh).*log(l(Ql)) - l(Ql).*x(Qx)... - -gammaln(h(Qh)) ); diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_hrf.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_hrf.m deleted file mode 100644 index 7054602..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_hrf.m +++ /dev/null @@ -1,48 +0,0 @@ -function [hrf,p] = pr_spm_hrf(RT,P); -% returns a hemodynamic response function -% FORMAT [hrf,p] = pr_spm_hrf(RT,[p]); -% RT - scan repeat time -% p - parameters of the response function (two gamma functions) -% -% defaults -% (seconds) -% p(1) - delay of response (relative to onset) 6 -% p(2) - delay of undershoot (relative to onset) 16 -% p(3) - dispersion of response 1 -% p(4) - dispersion of undershoot 1 -% p(5) - ratio of response to undershoot 6 -% p(6) - onset (seconds) 0 -% p(7) - length of kernel (seconds) 32 -% -% hrf - hemodynamic response function -% p - parameters of the response function -%_______________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_hrf.m 387 2005-12-17 18:31:23Z klaas $ - - -% global parameter -%----------------------------------------------------------------------- -global defaults -try - fMRI_T = defaults.stats.fmri.t; -catch - fMRI_T = 16; -end; - -% default parameters -%----------------------------------------------------------------------- -p = [6 16 1 1 6 0 32]; -if nargin > 1 - p(1:length(P)) = P; -end - -% modelled hemodynamic response function - {mixture of Gammas} -%----------------------------------------------------------------------- -dt = RT/fMRI_T; -u = [0:(p(7)/dt)] - p(6)/dt; -hrf = pr_spm_gpdf(u,p(1)/p(3),dt/p(3)) - pr_spm_gpdf(u,p(2)/p(4),dt/p(4))/p(5); -hrf = hrf([0:(p(7)/RT)]*fMRI_T + 1); -hrf = hrf'/sum(hrf); diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_justify.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_justify.m deleted file mode 100644 index 47e5299..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_justify.m +++ /dev/null @@ -1,161 +0,0 @@ -function out = pr_spm_justify(n,varargin) -% Justify text -% FORMAT out = justify(n,txt) -% out - a cell array of lines of text -% n - line length -% txt - a text string or a cell array of text strings -% -% If txt is a cell array, then each element is treated -% as a paragraph and justified, otherwise the string is -% treated as a paragraph and is justified. -% Non a-z or A-Z characters at the start of a paragraph -% are used to define any indentation required (such as -% for enumeration, bullets etc. If less than one line -% of text is returned, then no formatting is done. -% -% Example usage: -% -% out = pr_spm_justify(40,{['Statistical Parametric ',... -% 'Mapping refers to the construction and ',... -% 'assessment of spatially extended ',... -% 'statistical process used to test hypotheses ',... -% 'about [neuro]imaging data from SPECT/PET & ',... -% 'fMRI. These ideas have been instantiated ',... -% 'in software that is called SPM']}); -% strvcat(out{:}) -% -%------------------------------------------------------------------------ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% John Ashburner -% $Id: spm_justify.m 232 2005-09-15 19:02:59Z john $ - -out = {}; -for i=1:nargin-1, - if iscell(varargin{i}), - for j=1:numel(varargin{i}), - para = justify_paragraph(n,varargin{i}{j}); - out = {out{:},para{:}}; - end; - else - para = justify_paragraph(n,varargin{i}); - out = {out{:},para{:}}; - end; -end; - -function out = justify_paragraph(n,txt) -if numel(txt)>1 && txt(1)=='%', - txt = txt(2:end); -end; -%txt = regexprep(txt,'/\*([^(/\*)]*)\*/',''); -st1 = findstr(txt,'/*'); -en1 = findstr(txt,'*/'); -st = []; -en = []; -for i=1:numel(st1), - en1 = en1(en1>st1(i)); - if ~isempty(en1), - st = [st st1(i)]; - en = [en en1(1)]; - en1 = en1(2:end); - end; -end; - -str = []; -pen = 1; -for i=1:numel(st), - str = [str txt(pen:st(i)-1)]; - pen = en(i)+2; -end; -str = [str txt(pen:numel(txt))]; -txt = str; - -off = find((txt'>='a' & txt'<='z') | (txt'>='A' & txt'<='Z')); -off = off(off1, - out{1} = [txt(1:(off-1)) para{1}]; - for j=2:numel(para), - out{j} = [repmat(' ',1,off-1) para{j}]; - end; - else - out{1} = txt; - end; -end; -return; - -function out = justify_para(n,varargin) -% Collect varargs into a single string -str = varargin{1}; -for i=2:length(varargin), - str = [str ' ' varargin{i}]; -end; - -if isempty(str), out = {''}; return; end; - -% Remove repeats -sp = find(str==' '); -rep = sp(diff(sp)==1); -str(rep) = []; -if str(1) ==' ', str(1) = ''; end; -if str(end)==' ', str(end) = ''; end; - -out = {}; -while length(str)>n, - - % Break the string into lines - sp = find(str==' '); - brk = sp(sp<=n); - if isempty(brk), - if isempty(sp), - brk = length(str)+1; - else - brk = sp(1); - end; - else - brk = brk(end); - end; - - % Pad the line to n characters wide - current = str(1:(brk-1)); - % l = length(current); - % l = n-l; - sp = find(current==' '); - if ~isempty(sp), - - % Break into words - sp = [sp length(current)+1]; - words = {current(1:(sp(1)-1))}; - for i=1:(length(sp)-1), - words = {words{:}, current((sp(i)+1):(sp(i+1)-1))}; - end; - - % Figure out how much padding on average - nsp = length(sp)-1; - pad = (n-(length(current)-nsp))/nsp; - - % Pad all spaces by the same integer amount - sp = repmat(floor(pad),1,nsp); - - % Pad a random selection of spaces by one - pad = round((pad-floor(pad))*nsp); - [unused,ind] = sort(rand(pad,1)); - ind = ind(1:pad); - sp(ind) = sp(ind)+1; - - % Re-construct line from individual words - current = words{1}; - for i=2:length(words), - current = [current repmat(' ',1,sp(i-1)) words{i}]; - end; - end; - - out = {out{:},current}; - str = str((brk+1):end); -end; - -out = {out{:},str}; diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_logdet.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_logdet.m deleted file mode 100644 index 52a0ea5..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_logdet.m +++ /dev/null @@ -1,40 +0,0 @@ -function [H] = pr_spm_logdet(C) -% returns the log of the determinant of positive semi-definite matrix C -% FORMAT [H] = pr_spm_logdet(C) -% H = log(det(C)) -% -% spm_logdet is a computationally efficient operator that can deal with -% sparse matrices -%_______________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_logdet.m 309 2005-11-24 16:24:04Z karl $ - -% assume diagonal form -%----------------------------------------------------------------------- -TOL = 1e-8; % c.f. n*max(s)*eps -n = length(C); -s = diag(C); -i = find(s > TOL & s < 1/TOL); -C = C(i,i); -H = sum(log(diag(C))); - -% invoke det if non-diagonal -%----------------------------------------------------------------------- -w = warning; -warning off -[i j] = find(C); -if any(i ~= j) - n = length(C); - a = exp(H/n); - H = H + log(det(C/a)); -end -warning(w) - -% invoke svd is rank deficient -%----------------------------------------------------------------------- -if imag(H) | isinf(H) - s = svd(full(C)); - H = sum(log(s(s > TOL & s < 1/TOL))); -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_non_sphericity.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_non_sphericity.m deleted file mode 100644 index aef5930..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_non_sphericity.m +++ /dev/null @@ -1,112 +0,0 @@ -function [xVi] = pr_spm_non_sphericity(xVi) -% return error covariance constraints for basic ANOVA designs -% FORMAT [xVi] = pr_spm_non_sphericity(xVi) -% -% required fields: -% xVi.I - n x 4 matrix of factor level indicators -% I(n,i) is the level of factor i for observation n -% xVi.var - 1 x 4 vector of flags -% var(i) = 1; different variance among levels of factor i -% xVi.dep - 1 x 4 vector of flags -% dep(i) = 1; dependencies within levels of factor i -% -% Output: -% xVi.Vi - cell of covariance components -% or -% xVi.V - speye(n,n) -% -% See also; pr_spm_Ce.m & pr_spm_ui.m -%___________________________________________________________________________ -% Non-sphericity specification -% ========================= -% -% In some instances the i.i.d. assumptions about the errors do not hold: -% -% Identity assumption: -% The identity assumption, of equal error variance (homoscedasticity), can -% be violated if the levels of a factor do not have the same error variance. -% For example, in a 2nd-level analysis of variance, one contrast may be scaled -% differently from another. Another example would be the comparison of -% qualitatively different dependant variables (e.g. normals vs. patients). If -% You say no to identity assumptions, you will be asked whether the error -% variance is the same over levels of each factor. Different variances -% (heteroscedasticy) induce different error covariance components that -% are estimated using restricted maximum likelihood (see below). -% -% Independence assumption. -% In some situations, certain factors may contain random effects. These induce -% dependencies or covariance components in the error terms. If you say no -% to independence assumptions, you will be asked whether random effects -% should be modelled for each factor. A simple example of this would be -% modelling the random effects of subject. These cause correlations among the -% error terms of observation from the same subject. For simplicity, it is -% assumed that the random effects of each factor are i.i.d. -% -% ReML -% The ensuing covariance components will be estimated using ReML in spm_spm -% (assuming the same for all responsive voxels) and used to adjust the -% statistics and degrees of freedom during inference. By default spm_spm -% will use weighted least squares to produce Gauss-Markov or Maximum -% likelihood estimators using the non-sphericity structure specified at this -% stage. The components will be found in xX.xVi and enter the estimation -% procedure exactly as the serial correlations in fMRI models. -% -%___________________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_non_sphericity.m 112 2005-05-04 18:20:52Z john $ - - -% create covariance components Q{:} -%=========================================================================== -[n f] = size(xVi.I); % # observations, % # Factors -l = max(xVi.I); % levels - -% if var(i): add variance component for each level of factor i, -%--------------------------------------------------------------------------- -Q = {}; -for i = find(xVi.var) - for j = 1:l(i) - u = xVi.I(:,i) == j; - q = spdiags(u,0,n,n); - Q{end + 1} = q; - end -end - -% effects (discounting factors with dependencies) as defined by interactions -%--------------------------------------------------------------------------- -X = ones(n,1); -for i = find(~xVi.dep & (l > 1)) - Xi = sparse(1:n,xVi.I(:,i),1,n,l(i)); - Xj = X; - X = sparse(n,0); - for j = 1:size(Xi,2) - for k = 1:size(Xj,2) - X(:,end + 1) = Xi(:,j) & Xj(:,k); - end - end -end - -% dependencies among repeated measures created by the hadamrad product %--------------------------------------------------------------------------- -for i = find(xVi.dep) - q = sparse(1:n,xVi.I(:,i),1,n,l(i)); - P = q*q'; - for j = 1:size(X,2) - for k = (j + 1):size(X,2) - Q{end + 1} = (X(:,j)*X(:,k)' + X(:,k)*X(:,j)').*P; - end - end -end - -% set Q in non-sphericity structure -%--------------------------------------------------------------------------- - - -% if i.i.d nonsphericity (V) is known otherwise there are components {Vi} -%--------------------------------------------------------------------------- -if length(Q) > 1 - xVi.Vi = Q; -else - xVi.V = speye(n,n); -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_orth.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_orth.m deleted file mode 100644 index 9bd86a9..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_orth.m +++ /dev/null @@ -1,20 +0,0 @@ -function x = pr_spm_orth(X) -% recursive orthogonalization of basis functions -% FORMAT x = pr_spm_orth(X) -% -% serial orthogionalization starting with the first column -%_______________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_orth.m 112 2005-05-04 18:20:52Z john $ - - -x = X(:,1); -for i = 2:size(X,2) - D = X(:,i); - D = D - x*(pinv(x)*D); - if any(D) - x = [x D]; - end -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_q.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_q.m deleted file mode 100644 index 267c4cf..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_q.m +++ /dev/null @@ -1,41 +0,0 @@ -function [Q] = pr_spm_q(A,n) -% returns an (n x n) autocorrelation matrix for an AR(p) process -% FORMAT [Q] = pr_spm_q(A,n) -% -% A - vector pf p AR coeficients -% n - size of Q -%__________________________________________________________________________ -% spm_Q uses a Yule-Walker device to compute K where: -% -% y = K*z -% -% such that y is an AR(n) process generated from an i.i.d innovation -% z. This means -% -% cov(y) = = K*K' -% -% Critically, this is not the correlation because if cov(z) = eye(n) -% then trace(cov(y)) ~= n. This is why the normalization is required -% -% corr(y) = D*K*K'*D'; -% -% The reason the diagonals of corr(y) are not constant is that we -% are modeling finite length AR sequences, which incur boundary effects -% at the beginning and end of the sequence. -%__________________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_Q.m 372 2005-12-08 17:12:13Z karl $ - - -% compute Q -%-------------------------------------------------------------------------- -p = length(A); -A = [1 -A(:)']; -K = inv(spdiags(ones(n,1)*A,-[0:p],n,n)); -K = K.*(abs(K) > 1e-4); -Q = K*K'; -D = spdiags(sqrt(1./diag(Q)),0,n,n); -Q = D*Q*D; -Q = Q.*(abs(Q) > 1e-4); diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_reml.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_reml.m deleted file mode 100644 index bf75d59..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_reml.m +++ /dev/null @@ -1,172 +0,0 @@ -function [C,h,Ph,F] = pr_spm_reml(YY,X,Q,N,OPT); -% ReML estimation of covariance components from y*y' -% FORMAT [C,h,Ph,F] = pr_spm_reml(YY,X,Q,N,[OPT]); -% -% YY - (m x m) sample covariance matrix Y*Y' {Y = (m x N) data matrix} -% X - (m x p) design matrix -% Q - {1 x q} covariance components -% N - number of samples -% -% OPT = 1 : log-normal hyper-parameterisation (with hyperpriors) -% -% C - (m x m) estimated errors = h(1)*Q{1} + h(2)*Q{2} + ... -% h - (q x 1) ReML hyperparameters h -% Ph - (q x q) conditional precision of h [or log(h), if OPT(1)] -% -% F - [-ve] free energy F = log evidence = p(Y|X,Q) = ReML objective -% -% Performs a Fisher-Scoring ascent on F to find ReML variance parameter -% estimates. -%__________________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% John Ashburner & Karl Friston -% $Id: spm_reml.m 456 2006-02-22 18:46:29Z karl $ - -% assume a single sample if not specified -%-------------------------------------------------------------------------- -try - N; -catch - N = 1; -end - -% assume OPT = [0 0] -%-------------------------------------------------------------------------- -try - OPT; -catch - OPT = 0; -end - -% ortho-normalise X -%-------------------------------------------------------------------------- -if isempty(X) - X = sparse(length(Q{1}),1); -end -X = orth(full(X)); -[n p] = size(X); - -% initialise h -%-------------------------------------------------------------------------- -m = length(Q); -h = zeros(m,1); -dh = zeros(m,1); -dFdh = zeros(m,1); -dFdhh = zeros(m,m); - - -% initialise and specify hyperpriors -%-------------------------------------------------------------------------- -if OPT - hP = eye(m,m)/32; - hE = h - 32; - for i = 1:m - h(i) = -log(normest(Q{i})); - end -else - hE = zeros(m,1); - hP = zeros(m,m); - for i = 1:m - h(i) = any(diag(Q{i})); - end -end - - -% ReML (EM/VB) -%-------------------------------------------------------------------------- -for k = 1:64 - - % compute current estimate of covariance - %---------------------------------------------------------------------- - C = sparse(n,n); - for i = 1:m - if OPT - C = C + Q{i}*exp(h(i)); - else - C = C + Q{i}*h(i); - end - end - iC = inv(C); - - % E-step: conditional covariance cov(B|y) {Cq} - %====================================================================== - iCX = iC*X; - Cq = pinv(X'*iCX); - XCXiC = X*Cq*iCX'; - - % M-step: ReML estimate of hyperparameters - %====================================================================== - - % Gradient dF/dh (first derivatives) - %---------------------------------------------------------------------- - P = iC - iC*XCXiC; - U = speye(n) - P*YY/N; - for i = 1:m - - % dF/dh = -trace(dF/diC*iC*Q{i}*iC) - %------------------------------------------------------------------ - PQ{i} = P*Q{i}; - if OPT - PQ{i} = PQ{i}*exp(h(i)); - end - dFdh(i) = -trace(PQ{i}*U)*N/2; - - end - - % Expected curvature E{dF/dhh} (second derivatives) - %---------------------------------------------------------------------- - for i = 1:m - for j = i:m - - % dF/dhh = -trace{P*Q{i}*P*Q{j}} - %-------------------------------------------------------------- - dFdhh(i,j) = -trace(PQ{i}*PQ{j})*N/2; - dFdhh(j,i) = dFdhh(i,j); - - end - end - - % add hyperpriors - %---------------------------------------------------------------------- - dFdh = dFdh - hP*(h - hE); - dFdhh = dFdhh - hP; - - % Fisher scoring: update dh = -inv(ddF/dhh)*dF/dh - %---------------------------------------------------------------------- - Ph = -dFdhh; - dh = -pinv(dFdhh)*dFdh; - - % preclude numerical overflow - %---------------------------------------------------------------------- - if OPT - dh = min(dh, 8); - dh = max(dh,-8); - end - h = h + dh; - - % Convergence (1% change in log-evidence) - %====================================================================== - w = dFdh'*dh; - fprintf('%-30s: %i %30s%e\n',' ReML Iteration',k,'...',full(w)); - if w < 1e-2, break, end - -end - -% log evidence = ln p(y|X,Q) = ReML objective = F = trace(R'*iC*R*YY)/2 ... -%-------------------------------------------------------------------------- -if nargout > 3 - - F = - trace(C*P*YY*P)/2 ... - - N*n*log(2*pi)/2 ... - - N*pr_spm_logdet(C)/2 ... - + N*pr_spm_logdet(Cq)/2 ... - - pr_spm_logdet(Ph)/2 ... - + pr_spm_logdet(hP)/2; -end - -% return exp(h) if log-normal hyperpriors -%-------------------------------------------------------------------------- -if OPT - h = exp(h); -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_select.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_select.m deleted file mode 100644 index f448346..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_select.m +++ /dev/null @@ -1,1151 +0,0 @@ -function [t,sts] = pr_spm_select(varargin) -% File selector -% FORMAT [t,sts] = pr_spm_select(n,typ,mesg,sel,wd,filt,frames) -% n - Number of files -% A single value or a range. e.g. -% 1 - Select one file -% Inf - Select any number of files -% [1 Inf] - Select 1 to Inf files -% [0 1] - select 0 or 1 files -% [10 12] - select from 10 to 12 files -% typ - file type -% 'any' - all files -% 'image' - Image files (".img" and ".nii") -% Note that it gives the option to select -% individual volumes of the images. -% 'xml' - XML files -% 'mat' - Matlab .mat files -% 'batch' - SPM batch files (.mat and XML) -% 'dir' - select a directory -% Other strings act as a filter to regexp. This means -% that e.g. DCM*.mat files should have a typ of '^DCM.*\.mat$' -% mesg - a prompt (default 'Select files...') -% sel - list of already selected files -% wd - Directory to start off in -% filt - value for user-editable filter (default '.*') -% frames - Image frame numbers to include (default '1') -% -% t - selected files -% sts - status (1 means OK, 0 means window quit) -% -% Files can be selected from disk, but "virtual" files can also be selected. -% Virtual filenames are passed by -% pr_spm_select('addvfiles',list) -% where list is a cell array of filenames -% The list can be cleared by -% pr_spm_select('clearvfiles') -% -% FORMAT cpath = pr_spm_select('CPath',path,cwd) -% function to canonicalise paths: Prepends cwd to relative paths, processes -% '..' & '.' directories embedded in path. -% path - string matrix containing path name -% cwd - current working directory [defaut '.'] -% cpath - conditioned paths, in same format as input path argument -% -% FORMAT [files,dirs]=pr_spm_select('List',direc,filt) -% Returns files matching the filter (filt) and directories within dire -% direc - directory to search -% filt - filter to select files with (see regexp) e.g. '^w.*\.img$' -% files - files matching 'filt' in directory 'direc' -% dirs - subdirectories of 'direc' -%____________________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% John Ashburner -% $Id: spm_select.m 400 2006-01-11 18:41:15Z john $ - -if nargin > 0 && ischar(varargin{1}) - switch lower(varargin{1}) - case 'addvfiles' - error(nargchk(2,Inf,nargin)); - vfiles('add',varargin{2:end}); - case 'clearvfiles' - error(nargchk(1,1,nargin)); - vfiles('clear'); - case 'vfiles' - error(nargchk(1,1,nargin)); - t = vfiles('all'); - case 'cpath' - error(nargchk(2,Inf,nargin)); - t = cpath(varargin{2:end}); - case 'list' - filt = struct('code',0,'frames',[],'ext',{{'.*'}},... - 'filt',{{varargin{3}}}); - [t,sts] = listfiles(varargin{2},filt); - otherwise - error('Inappropriate usage.'); - end -else - [t,sts] = selector(varargin{:}); -end -%======================================================================= - -%======================================================================= -function [t,ok] = selector(n,typ,mesg,already,wd,filt,frames,varargin) -if nargin<7, frames = '1'; end; -if nargin<6, filt = '.*'; end; -if nargin<5, wd = pwd; end; -if nargin<4, already = {''}; end; -if nargin<3, mesg = 'Select files...'; end; -if nargin<2, typ = 'any'; end; -if nargin<1, n = [0 Inf]; end; -ok = 0; -if numel(n)==1, n = [n n]; end; -if n(1)>n(2), n = n([2 1]); end; -if ~isfinite(n(1)), n(1) = 0; end; -if numel(already)>n(2), already = already(1:n(2)); end -already = strvcat(already); - -t = ''; -switch lower(typ), -case {'any','*'}, code = 0; ext = {'.*'}; -case {'image'}, code = 1; ext = {'.*\.nii$','.*\.img$','.*\.NII$','.*\.IMG$'}; -case {'xml'}, code = 0; ext = {'.*\.xml$','.*\.XML$'}; -case {'mat'}, code = 0; ext = {'.*\.mat$','.*\.MAT$'}; -case {'batch'}, code = 0; ext = {'.*\.mat$','.*\.MAT$','.*\.xml$','.*\.XML$'}; -case {'dir'}, code =-1; ext = {'.*'}; -otherwise, code = 0; ext = {typ}; -end; - -[col1,col2,col3,fs] = colours; - -fg = figure('IntegerHandle','off',... - 'Tag','Select',... - 'Name',strvcat(mesg),... - 'NumberTitle','off',... - 'Units','Pixels',... - 'MenuBar','none',... - 'DefaultTextInterpreter','none',... - 'DefaultUicontrolInterruptible','on',... - 'ResizeFcn',@resize_fun,... - 'KeyPressFcn',@hitkey); - -% Code from Brian Lenoski for dealing with multiple monitors -if str2double(version('-release'))>=14, - S = get(0, 'MonitorPosition'); - Rect = get(fg,'Position'); - pointer_loc = get(0,'PointerLocation'); - - for i = 1:size(S,1), % Loop over monitors - h_min = S(i,1); - h_width = S(i,3); - h_max = h_width + h_min - 1; - v_min = S(i,2); - v_len = S(i,4); - v_max = v_min + v_len; - - % Use the monitor containing the pointer - if pointer_loc(1) >= h_min && pointer_loc(1) < h_max && ... - pointer_loc(2) >= v_min && pointer_loc(2) < v_max, - hor_min = h_min; - hor_width = h_width; - hor_max = h_max; - ver_min = v_min; - ver_len = v_len; - ver_max = v_max; - end - end - Rect(1) = (hor_max - 0.5*hor_width) - 0.5*Rect(3); % Horizontal - Rect(2) = (ver_max - 0.5*ver_len) - 0.5*Rect(4); % Vertical - set(fg,'Position',Rect); -end - - -fh = 0.05; -%fs = 10; - -sbh = 0.03; % Scroll-bar height. This should be worked out properly -h1 = (0.96-4*fh-5*0.01)/2; -if n(2)*fh+sbh=n(1) && size(already,1)<=n(2), - set(dne,'Enable','on'); -end; - -% Filter Button -uicontrol(fg,... - 'Style','pushbutton',... - 'units','normalized',... - 'Position',[0.51 hp 0.1 fh],... - 'FontSize',fs,... - 'ForegroundColor',col3,... - 'BackgroundColor',col1,... - 'Callback',@clearfilt,... - 'String','Filt',... - 'FontSize',fs); - -% Filter -ud = struct('ext',{ext},'code',code); -uicontrol(fg,... - 'style','edit',... - 'units','normalized',... - 'Position',[0.61 hp 0.37 fh],... - 'ForegroundColor',col3,... - 'BackgroundColor',col1,... - 'FontSize',fs,... - 'Callback',@update,... - 'tag','regexp',... - 'String',filt,... - 'UserData',ud); - -% Directories -hp = hp + fh+0.01; -db = uicontrol(fg,... - 'style','listbox',... - 'units','normalized',... - 'Position',[0.02 hp 0.47 h2],... - 'FontSize',fs,... - 'Callback',@click_dir_box,... - 'tag','dirs',... - 'BackgroundColor',col1,... - 'ForegroundColor',col3,... - 'Max',1,... - 'Min',0,... - 'String','',... - 'UserData',wd,... - 'Value',1); - -% Files -tmp = uicontrol(fg,... - 'style','listbox',... - 'units','normalized',... - 'Position',[0.51 hp 0.47 h2],... - 'FontSize',fs,... - 'Callback',@click_file_box,... - 'tag','files',... - 'BackgroundColor',col1,... - 'ForegroundColor',col3,... - 'UserData',n,... - 'Max',10240,... - 'Min',0,... - 'String','',... - 'Value',1); -c0 = uicontextmenu('Parent',fg); -set(tmp,'uicontextmenu',c0); -uimenu('Label','Select All', 'Parent',c0,'Callback',@select_all); - -% Drives -if strcmpi(computer,'PCWIN'), - dr = spm_platform('drives'); - drivestr = cell(1,numel(dr)); - for i=1:numel(dr), - drivestr{i} = [dr(i) ':']; - end; - %drivestr = {'A:','B:','C:','D:'}; - sz = get(db,'Position'); - sz(4) = sz(4)-fh-2*0.01; - set(db,'Position',sz); - uicontrol(fg,... - 'style','text',... - 'units','normalized',... - 'Position',[0.02 hp+h2-fh-0.01 0.10 fh],... - 'FontSize',fs,... - 'BackgroundColor',get(fg,'Color'),... - 'ForegroundColor',col3,... - 'String','Drive'); - uicontrol(fg,... - 'style','popupmenu',... - 'units','normalized',... - 'Position',[0.12 hp+h2-fh-0.01 0.37 fh],... - 'FontSize',fs,... - 'Callback',@setdrive,... - 'tag','drive',... - 'BackgroundColor',col1,... - 'ForegroundColor',col3,... - 'String',drivestr,... - 'Value',1); -end; - -% Previous dirs -hp = hp+h2+0.01; -uicontrol(fg,... - 'style','popupmenu',... - 'units','normalized',... - 'Position',[0.12 hp 0.86 fh],... - 'FontSize',fs,... - 'Callback',@click_dir_list,... - 'tag','previous',... - 'BackgroundColor',col1,... - 'ForegroundColor',col3,... - 'String',pd,... - 'Value',vl); -uicontrol(fg,... - 'style','text',... - 'units','normalized',... - 'Position',[0.02 hp 0.10 fh],... - 'FontSize',fs,... - 'BackgroundColor',get(fg,'Color'),... - 'ForegroundColor',col3,... - 'String','Prev'); - -% Directory -hp = hp + fh+0.01; -uicontrol(fg,... - 'style','edit',... - 'units','normalized',... - 'Position',[0.12 hp 0.86 fh],... - 'FontSize',fs,... - 'Callback',@edit_dir,... - 'tag','edit',... - 'BackgroundColor',col1,... - 'ForegroundColor',col3,... - 'String',''); -uicontrol(fg,... - 'style','text',... - 'units','normalized',... - 'Position',[0.02 hp 0.10 fh],... - 'FontSize',fs,... - 'BackgroundColor',get(fg,'Color'),... - 'ForegroundColor',col3,... - 'String','Dir'); - -resize_fun(fg); -update(sel,wd) - -waitfor(dne); -if ishandle(sel), - t = get(sel,'String'); - ok = 1; -end; -if ishandle(fg), delete(fg); end; -return; -%======================================================================= - -%======================================================================= -function null(varargin) -%======================================================================= - -%======================================================================= -function msg(ob,str) -ob = sib(ob,'msg'); -set(ob,'String',str); -if nargin>=3, - set(ob,'ForegroundColor',[1 0 0],'FontWeight','bold'); -else - set(ob,'ForegroundColor',[0 0 0],'FontWeight','normal'); -end; -drawnow; -return; -%======================================================================= - -%======================================================================= -function setdrive(ob,varargin) -st = get(ob,'String'); -vl = get(ob,'Value'); -update(ob,st{vl}); -return; -%======================================================================= - -%======================================================================= -function resize_fun(fg,varargin) -ob = findobj(fg,'String','Filt','Style','pushbutton'); -if ~isempty(ob), - ofs = get(ob,'FontSize'); - ex = get(ob,'Extent'); - ps = get(ob,'Position'); - fs = floor(ofs*min(ps(4)./ex(4))+1); - fs = max(min(fs,30),4); - ob = findobj(fg,'Fontsize',ofs); - set(ob,'FontSize',fs); -end; -return; -%======================================================================= - -%======================================================================= -function [d,mch] = prevdirs(d) -persistent pd -if ~iscell(pd), pd = {}; end; -d = deblank(d); -mch = find(strcmp(d,pd)); -if isempty(mch), - pd = {pd{:},d}; - mch = length(pd); -end; -d = pd; -return; -%======================================================================= - -%======================================================================= -function clearfilt(ob,varargin) -set(sib(ob,'regexp'),'String','.*'); -update(ob); -return; -%======================================================================= - -%======================================================================= -function click_dir_list(ob,varargin) -vl = get(ob,'Value'); -ls = get(ob,'String'); -update(ob,deblank(ls{vl})); -return; -%======================================================================= - -%======================================================================= -function edit_dir(ob,varargin) -update(ob,get(ob,'String')); -return; -%======================================================================= - -%======================================================================= -function click_dir_box(lb,varargin) -update(lb,current_dir(lb)); -return; -%======================================================================= - -%======================================================================= -function dr = current_dir(lb,varargin) -vl = get(lb,'Value'); -str = get(lb,'String'); -pd = get(sib(lb,'edit'),'String'); -while ~isempty(pd) & strcmp(pd(end),filesep) - pd=pd(1:end-1); % Remove any trailing fileseps -end -sel = deblank(str(vl,:)); -if strcmp(sel,'..'), % Parent directory - dr = fileparts(pd); -elseif strcmp(sel,'.'), % Current directory - dr = pd; -else - dr = fullfile(pd,sel); -end; -return; -%======================================================================= - -%======================================================================= -function re = getfilt(ob) -ob = sib(ob,'regexp'); -ud = get(ob,'UserData'); -re = struct('code',ud.code,... - 'frames',get(sib(ob,'frame'),'UserData'),... - 'ext',{ud.ext},... - 'filt',get(sib(ob,'regexp'),'String')); -return; -%======================================================================= - -%======================================================================= -function update(lb,dr) -lb = sib(lb,'dirs'); -if nargin<2 || isempty(dr), - dr = get(lb,'UserData'); -end; -if ~strcmpi(computer,'PCWIN') - dr = [filesep dr filesep]; -else - dr = [dr filesep]; -end; -dr(findstr([filesep filesep],dr)) = []; -[f,d] = listfiles(dr,getfilt(lb)); -if isempty(d), - dr = get(lb,'UserData'); - [f,d] = listfiles(dr,getfilt(lb)); -else - set(lb,'UserData',dr); -end; -set(lb,'Value',1,'String',d); -set(sib(lb,'files'),'Value',1,'String',f); -[ls,mch] = prevdirs(dr); -set(sib(lb,'previous'),'String',ls,'Value',mch); -set(sib(lb,'edit'),'String',dr); - -if numel(dr)>1 && dr(2)==':', - str = get(sib(lb,'drive'),'String'); - str = cat(1,char(str)); - mch = find(lower(str(:,1))==lower(dr(1))); - if ~isempty(mch), - set(sib(lb,'drive'),'Value',mch); - end; -end; -return; -%======================================================================= - -%======================================================================= -function update_frames(lb,varargin) -str = get(lb,'String'); -%r = get(lb,'UserData'); -try - r = eval(['[',str,']']); -catch - msg(lb,['Failed to evaluate "' str '".'],'r'); - beep; - return; -end; -if ~isnumeric(r), - msg(lb,['Expression non-numeric "' str '".'],'r'); - beep; -else - set(lb,'UserData',r); - msg(lb,''); - update(lb); -end; -%======================================================================= - -%======================================================================= -function select_all(ob,varargin) -lb = findobj(get(get(ob,'Parent'),'Parent'),'Tag','files'); -str = get(lb,'String'); -set(lb,'Value',1:size(str,1)); -drawnow; -click_file_box(lb); -return; -%======================================================================= - -%======================================================================= -function click_file_box(lb,varargin) -lim = get(lb,'UserData'); -ob = sib(lb,'selected'); -str3 = get(ob,'String'); - -str = get(lb,'String'); -vlo = get(lb,'Value'); -lim1 = min(max(lim(2)-size(str3,1),0),length(vlo)); -if isempty(vlo), - msg(lb,'Nothing selected'); - return; -end; -if lim1==0, - msg(lb,['Selected ' num2str(size(str3,1)) '/' num2str(lim(2)) ' already.']); - beep; - set(sib(lb,'D'),'Enable','on'); - return; -end; - -vl = vlo(1:lim1); -msk = false(size(str,1),1); -if vl>0, msk(vl) = true; else msk = []; end; -str1 = str( msk,:); -str2 = str(~msk,:); -dr = [current_dir(sib(lb,'dirs')) filesep]; -str1 = [repmat(dr,size(str1,1),1) str1]; - -set(lb,'Value',min(vl(1),size(str2,1)),'String',str2); -r = (1:size(str1,1))+size(str3,1); -str3 = deblank(strvcat(str3,str1)); -set(ob,'String',str3,'Value',r); -if length(vlo)>lim1, - msg(lb,['Retained ' num2str(lim1) '/' num2str(length(vlo))... - ' of selection.']); - beep; -elseif isfinite(lim(2)) - if lim(1)==lim(2), - msg(lb,['Selected ' num2str(size(str3,1)) '/' num2str(lim(2)) ' files.']); - else - msg(lb,['Selected ' num2str(size(str3,1)) '/' num2str(lim(1)) '-' num2str(lim(2)) ' files.']); - end; -else - if size(str3,1) == 1, ss = ''; else ss = 's'; end; - msg(lb,['Selected ' num2str(size(str3,1)) ' file' ss '.']); -end; -if ~isfinite(lim(1)) || size(str3,1)>=lim(1), - set(sib(lb,'D'),'Enable','on'); -end; - -return; -%======================================================================= - -%======================================================================= -function obj = sib(ob,tag) -obj = findobj(get(ob,'Parent'),'Tag',tag); -return; -%if isempty(obj), -% error(['Can''t find object with tag "' tag '".']); -%elseif length(obj)>1, -% error(['Found ' num2str(length(obj)) ' objects with tag "' tag '".']); -%end; -%return; -%======================================================================= - -%======================================================================= -function unselect(lb,varargin) -vl = get(lb,'Value'); -if isempty(vl), return; end; -str = get(lb,'String'); -msk = ones(size(str,1),1); -if vl~=0, msk(vl) = 0; end; -str2 = str(logical(msk),:); -set(lb,'Value',min(vl(1),size(str2,1)),'String',str2); -lim = get(sib(lb,'files'),'UserData'); -if size(str2,1)>= lim(1) && size(str2,1)<= lim(2), - set(sib(lb,'D'),'Enable','on'); -else - set(sib(lb,'D'),'Enable','off'); -end; - -%if size(str2,1) == 1, ss = ''; else ss = 's'; end; -%msg(lb,[num2str(size(str2,1)) ' file' ss ' remaining.']); -if numel(vl) == 1, ss = ''; else ss = 's'; end; -msg(lb,['Unselected ' num2str(numel(vl)) ' file' ss '.']); -return; -%======================================================================= - -%======================================================================= -function unselect_all(ob,varargin) -lb = findobj(get(get(ob,'Parent'),'Parent'),'Tag','selected'); -set(lb,'Value',[],'String','','ListBoxTop',1); -msg(lb,'Unselected all files.'); -lim = get(sib(lb,'files'),'UserData'); -if lim(1)>0, set(sib(lb,'D'),'Enable','off'); end; -return; -%======================================================================= - -%======================================================================= -function varargout = vfiles(option,varargin) -persistent vfs -if isempty(vfs), - vfs = newvfs; -end; - -switch option, -case {'clear'} - vfs = newvfs; -case {'add'} - for j=1:numel(varargin), - if ischar(varargin{j}), - for i=1:size(varargin{j},1), - fle = deblank(varargin{j}(i,:)); - vfs = addvfile(vfs,fle); - end; - elseif iscell(varargin{j}), - for i=1:numel(varargin{j}), - fle = deblank(varargin{j}{i}); - vfs = addvfile(vfs,fle); - end; - end; - end; -case {'list'} - [varargout{1:3}] = listvfiles(vfs,varargin{:}); -case {'all'} - varargout{1} = vfs; -otherwise - error('Unknown option.'); -end; -return; -%======================================================================= - -%======================================================================= -function vfs = newvfs(nam) -if nargin==0, nam = ''; end; -vfs = struct('name',nam,'dirs',struct('name',{},'dirs',{},'files',{}),'files',struct('name',{},'ind',{})); -return; -%======================================================================= - -%======================================================================= -function vfs = addvfile(vfs,fle) -ind = find(fle==filesep); -if any(ind==1), - ind = ind(2:end)-1; - fle = fle(2:end); -end; -if isempty(ind), - [unused,nam,ext,num] = pr_spm_fileparts(fle); - if ~isempty(num), - ind = [str2num(num) 1 1]; - ind = ind(1); - else - ind = []; - end; - fname = [nam ext]; - mch = strcmp(fname,{vfs.files.name}); - if any(mch), - mch = find(mch); - vfs.files(mch).ind = [vfs.files(mch).ind ind]; - else - vfs.files(end+1).name = fname; - vfs.files(end).ind = ind; - end; -else - dr = fle(1:(ind(1)-1)); - fle = fle((ind(1)+1):end); - mch = strcmp(dr,{vfs.dirs.name}); - if any(mch), - mch = find(mch); - else - mch = numel(vfs.dirs)+1; - vfs.dirs(mch) = newvfs(dr); - end; - vfs.dirs(mch) = addvfile(vfs.dirs(mch),fle); -end; -return; -%======================================================================= - -%======================================================================= -function [f,d] = listfiles(dr,filt) -ob = gco; -msg(ob,'Listing directory...'); -if nargin<2, filt = ''; end; -if nargin<1, dr = '.'; end; -de = dir(dr); -if ~isempty(de), - d = {de([de.isdir]).name}; - if filt.code~=-1, - f = {de(~[de.isdir]).name}; - else - % f = d(3:end); - f = d; - end; -else - d = {'.','..'}; - f = {}; -end; - -msg(ob,['Filtering ' num2str(numel(f)) ' files...']); -f = do_filter(f,filt.ext); -f = do_filter(f,{filt.filt}); -ii = cell(1,numel(f)); -if filt.code==1 && (numel(filt.frames)~=1 || filt.frames(1)~=1), - msg(ob,['Reading headers of ' num2str(numel(f)) ' images...']); - for i=1:numel(f), - try - ni = nifti(fullfile(dr,f{i})); - dm = [ni.dat.dim 1 1 1 1 1]; - d4 = (1:dm(4))'; - catch - d4 = 1; - end; - msk = false(size(filt.frames)); - for j=1:numel(msk), msk(j) = any(d4==filt.frames(j)); end; - ii{i} = filt.frames(msk); - end; -elseif filt.code==1 && (numel(filt.frames)==1 && filt.frames(1)==1), - for i=1:numel(f), - ii{i} = 1; - end; -end; - -msg(ob,'Listing virtual files...'); -[fv,dv,iv] = vfiles('list',dr); -if filt.code==-1, - fv = dv; - iv = cell(size(fv)); -end; -msg(ob,['Filtering ' num2str(numel(fv)) ' virtual files...']); -[fv,ind] = do_filter(fv,filt.ext); -iv = iv(ind); -[fv,ind] = do_filter(fv,{filt.filt}); -iv = iv(ind); -if filt.code==1, - for i=1:numel(iv), - msk = false(size(filt.frames)); - for j=1:numel(msk), msk(j) = any(iv{i}==filt.frames(j)); end; - iv{i} = filt.frames(msk); - end; -end; - -d = { d{:},dv{:}}; -f = { f{:},fv{:}}; -ii = {ii{:},iv{:}}; - -msg(ob,['Listing ' num2str(numel(f)) ' files...']); - -[f,ind] = sortrows(f(:)); -ii = ii(ind); -msk = true(1,numel(f)); -if ~isempty(f), f{1} = deblank(f{1}); end; -for i=2:numel(f), - f{i} = deblank(f{i}); - if strcmp(f{i-1},f{i}), - if filt.code==1, - tmp = sort([ii{i}(:) ; ii{i-1}(:)]); - tmp(~diff(tmp,1)) = []; - ii{i} = tmp; - end; - msk(i-1) = false; - end; -end; -f = f(msk); -if filt.code==1, - ii = ii(msk); - c = cell(size(f)); - for i=1:numel(f), - c{i} = [repmat([f{i} ','],numel(ii{i}),1) num2str(ii{i}(:)) ]; - end; - f = strvcat(c{:}); -elseif filt.code==-1, - fs = filesep; - for i=1:numel(f), - f{i} = [f{i} fs]; - end; - f = strvcat(f{:}); -else - f = strvcat(f{:}); -end; - -d = sortrows(d(:)); -d = strvcat(d); -sam = find(~any(diff(d+0,1),2)); -d(sam,:) = []; -msg(ob,''); -return; -%======================================================================= - -%======================================================================= -function [f,ind] = do_filter(f,filt) -t2 = false(numel(f),1); -for j=1:numel(filt), - t1 = regexp(f,filt{j}); - if numel(f)==1, t1 = {t1}; end; - for i=1:numel(t1), - t2(i) = t2(i) || ~isempty(t1{i}); - end; -end; -ind = find(t2); -f = f(ind); -return; -%======================================================================= - -%======================================================================= -function [f,d,ii] = listvfiles(vfs,dr) -f = {}; -d = {}; -ii = {}; -if isempty(dr), - f = {vfs.files.name}; - ii = {vfs.files.ind}; - d = {vfs.dirs.name}; -else - if dr(1)==filesep, dr = dr(2:end); end; - ind = find(dr==filesep); - if isempty(ind), - d1 = dr; - d2 = ''; - else - d1 = dr(1:(ind(1)-1)); - d2 = dr((ind(1)+1):end); - end; - for i=1:length(vfs.dirs), - if strcmp(d1,vfs.dirs(i).name), - [f,d,ii] = listvfiles(vfs.dirs(i),d2); - break; - end; - end; -end; -return; -%======================================================================= - -%======================================================================= -function heelp(ob,varargin) -[col1,col2,col3,fs] = colours; -fg = get(ob,'Parent'); -t = uicontrol(fg,... - 'style','listbox',... - 'units','normalized',... - 'Position',[0.01 0.01 0.98 0.98],... - 'FontSize',fs,... - 'FontName','FixedWidthFont',... - 'BackgroundColor',col2,... - 'ForegroundColor',col3,... - 'Max',0,... - 'Min',0,... - 'tag','HelpWin',... - 'String',' '); -c0 = uicontextmenu('Parent',fg); -set(t,'uicontextmenu',c0); -uimenu('Label','Done', 'Parent',c0,'Callback',@helpclear); - -ext = get(t,'Extent'); -pw = floor(0.98/ext(3)*20-4); -str = pr_spm_justify(pw,{[... -'File Selection help. You can return to selecting files via the right mouse button (the "Done" option). ',... -'Because of a bug in Matlab (on some machines), don''t resize this window when viewing the help.'],... -'',[... -'The panel at the bottom shows files that are already selected. ',... -'Clicking a selected file will un-select it. To un-select several, you can ',... -'drag the cursor over the files, and they will be gone on release. ',... -'You can use the right mouse button to un-select everything.'],... -'',[... -'Directories are navigated by editing the name of the current directory (where it says "Dir"), ',... -'by going to one of the previously entered directories ("Prev"), or by navigating around ',... -'the parent or subdirectories listed in the left side panel.'],... -'',[... -'Files matching the filter ("Filt") are shown in the panel on the right. ',... -'These can be selected by clicking or dragging. Use the right mouse button if ',... -'you would like to select all files. Note that when selected, the files disappear ',... -'from this panel. They can be made to reappear by re-specifying the directory ',... -'or the filter. ',... -'Note that the syntax of the filter differs from that used by previous versions of ',... -'SPM. The following is a list of symbols with special meaning for filtering the filenames:'],... -' ^ start of string',... -' $ end of string',... -' . any character',... -' \ quote next character',... -' * match zero or more',... -' + match one or more',... -' ? match zero or one, or match minimally',... -' {} match a range of occurrances',... -' [] set of characters',... -' [^] exclude a set of characters',... -' () group subexpression',... -' \w match word [a-z_A-Z0-9]',... -' \W not a word [^a-z_A-Z0-9]',... -' \d match digit [0-9]',... -' \D not a digit [^0-9]',... -' \s match white space [ \t\r\n\f]',... -' \S not a white space [^ \t\r\n\f]',... -' \ exact word match',... -'',[... -'Individual time frames of image files can also be selected. The frame filter ',... -'allows specified frames to be shown, which is useful for image files that ',... -'contain multiple time points. If your images are only single time point, then ',... -'reading all the image headers can be avoided by specifying a frame filter of "1". ',... -'The filter should contain a list of integers indicating the frames to be used. ',... -'This can be generated by e.g. "1:100", or "1:2:100".'],... -'',[... -'There is also an edit button (Ed), which allows you to edit your selection of files. ',... -'When you are done, then use the menu-button of your mouse to either cancel or accept your changes'],''}); -pad = cellstr(char(zeros(max(0,floor(1.2/ext(4) - numel(str))),1))); -str = {str{:}, pad{:}}; -set(t,'String',str); -return; -%======================================================================= - -%======================================================================= -function helpclear(ob,varargin) -ob = get(ob,'Parent'); -ob = get(ob,'Parent'); -ob = findobj(ob,'Tag','HelpWin'); -delete(ob); -%======================================================================= - -%======================================================================= -function hitkey(fg,varargin) -ch = get(fg,'CurrentCharacter'); -if isempty(ch), return; end; - -ob = findobj(fg,'Tag','files'); -if ~isempty(ob), - f = get(ob,'String'); - f = f(:,1); - fset = find(f>=ch); - if ~isempty(fset), - fset = fset(1); - %cb = get(ob,'Callback'); - %set(ob,'Callback',[]); - set(ob,'ListboxTop',fset); - %set(ob,'Callback',cb); - else - set(ob,'ListboxTop',length(f)); - end; -end; -return; -%======================================================================= - -%======================================================================= -function t = cpath(t,d) - -switch spm_platform('filesys'), -case 'unx', - mch = '^/'; - fs = '/'; - fs1 = '/'; -case 'win', - mch = '^.:\\'; - fs = '\'; - fs1 = '\\'; -otherwise; - error('What is this filesystem?'); -end - -if isempty(regexp(t,mch,'once')), - if nargin<2, d = pwd; end; - t = [d fs t]; -end; - -% Replace occurences of '/./' by '/' (problems with e.g. /././././././') -re = [fs1 '\.' fs1]; -while ~isempty(regexp(t,re)), - t = regexprep(t,re,fs); -end; -t = regexprep(t,[fs1 '\.' '$'], fs); - -% Replace occurences of '/abc/../' by '/' -re = [fs1 '[^' fs1 ']+' fs1 '\.\.' fs1]; -while ~isempty(regexp(t,re)), - t = regexprep(t,re,fs,'once'); -end; -t = regexprep(t,[fs1 '[^' fs1 ']+' fs1 '\.\.' '$'],fs,'once'); - -% Replace '//' -t = regexprep(t,[fs1 '+'], fs); -%======================================================================= - -%======================================================================= -function editwin(ob,varargin) -[col1,col2,col3,fs] = colours; -fg = get(ob,'Parent'); -lb = findobj(fg,'Tag','selected'); -str = get(lb,'String'); -str = cellstr(str); -h = uicontrol(fg,'Style','Edit',... - 'units','normalized',... - 'String',str,... - 'FontSize',16,... - 'Max',2,... - 'Tag','EditWindow',... - 'HorizontalAlignment','Left',... - 'ForegroundColor',col3,... - 'BackgroundColor',col1,... - 'Position',[0.01 0.01 0.98 0.98]); -c0 = uicontextmenu('Parent',fg); -set(h,'uicontextmenu',c0); -uimenu('Label','Cancel', 'Parent',c0,'Callback',@editclear); -uimenu('Label','Accept', 'Parent',c0,'Callback',@editdone); -%======================================================================= - -%======================================================================= -function editdone(ob,varargin) -ob = get(ob,'Parent'); -ob = sib(ob,'EditWindow'); -str = get(ob,'String'); -str = deblank(cellstr(strvcat(str))); -if isempty(str{1}), str = {}; end; - -lim = get(sib(ob,'files'),'UserData'); -if numel(str)>lim(2), - msg(ob,['Retained ' num2str(lim(2)) ' of the ' num2str(numel(str)) ' files.']); - beep; - str = str(1:lim(2)); -elseif isfinite(lim(2)), - if lim(1)==lim(2), - msg(ob,['Specified ' num2str(numel(str)) '/' num2str(lim(2)) ' files.']); - else - msg(ob,['Selected ' num2str(numel(str)) '/' num2str(lim(1)) '-' num2str(lim(2)) ' files.']); - end; -else - if numel(str) == 1, ss = ''; else ss = 's'; end; - msg(ob,['Specified ' num2str(numel(str)) ' file' ss '.']); -end; -if ~isfinite(lim(1)) || numel(str)>=lim(1), - set(sib(ob,'D'),'Enable','on'); -else - set(sib(ob,'D'),'Enable','off'); -end; -set(sib(ob,'selected'),'String',strvcat(str),'Value',[]); -delete(ob); -%======================================================================= - -%======================================================================= -function editclear(ob,varargin) -ob = get(ob,'Parent'); -ob = get(ob,'Parent'); -ob = findobj(ob,'Tag','EditWindow'); -delete(ob); -%======================================================================= - -%======================================================================= -function [c1,c2,c3,fs] = colours -global defaults -c1 = [1 1 1]; -c2 = [1 1 1]; -c3 = [0 0 0]; -fs = 14; -if isfield(defaults,'ui'), - ui = defaults.ui; - if isfield(ui,'colour1'), c1 = ui.colour1; end; - if isfield(ui,'colour2'), c2 = ui.colour2; end; - if isfield(ui,'colour3'), c3 = ui.colour3; end; - if isfield(ui,'fs'), fs = ui.fs; end; -end; -%======================================================================= - -%======================================================================= diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_svd.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_svd.m deleted file mode 100644 index 3ad7961..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_svd.m +++ /dev/null @@ -1,100 +0,0 @@ -function [U,S,V] = pr_spm_svd(X,U,T) -% computationally efficient SVD (that can handle sparse arguments) -% FORMAT [U,S,V] = pr_spm_svd(X,u,t); -% X - {m x n} matrix -% u - threshold for normalized eigenvalues (default = 1e-6) -% t - threshold for raw eigenvalues (default = 0) -% -% U - {m x p} singular vectors -% V - {m x p} singular variates -% S - {p x p} singular values -%___________________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_svd.m 112 2005-05-04 18:20:52Z john $ - - - -% default thresholds -%--------------------------------------------------------------------------- -if nargin < 2 - U = 1e-6; -end - -if nargin < 3 - T = 0; -end - -% deal with sparse matrices -%--------------------------------------------------------------------------- -[M N] = size(X); -p = find(any(X,2)); -q = find(any(X,1)); -X = X(p,q); - -% SVD -%--------------------------------------------------------------------------- -[i j s] = find(X); -[m n] = size(X); -if any(i - j) - - % off-leading diagonal elements - full SVD - %------------------------------------------------------------------- - X = full(X); - if m > n - - [v S v] = svd(spm_atranspa(X),0); - S = sparse(S); - s = diag(S); - j = find(s*length(s)/sum(s) >= U & s >= T); - v = v(:,j); - u = pr_spm_en(X*v); - S = sqrt(S(j,j)); - - elseif m < n - - [u S u] = svd(spm_atranspa(X'),0); - S = sparse(S); - s = diag(S); - j = find(s*length(s)/sum(s) >= U & s >= T); - u = u(:,j); - v = pr_spm_en(X'*u); - S = sqrt(S(j,j)); - - else - - [u S v] = svd(X,0); - S = sparse(S); - s = diag(S).^2; - j = find(s*length(s)/sum(s) >= U & s >= T); - v = v(:,j); - u = u(:,j); - S = S(j,j); - end - -else - S = sparse(1:n,1:n,s,m,n); - u = speye(m,n); - v = speye(m,n); - [i j] = sort(-s); - S = S(j,j); - v = v(:,j); - u = u(:,j); - s = diag(S).^2; - j = find(s*length(s)/sum(s) >= U & s >= T); - v = v(:,j); - u = u(:,j); - S = S(j,j); - -end - -% replace in full matrices -%--------------------------------------------------------------------------- -j = length(j); -U = sparse(M,j); -V = sparse(N,j); -if j - U(p,:) = u; - V(q,:) = v; -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_ui.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_ui.m deleted file mode 100644 index fecb66b..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_ui.m +++ /dev/null @@ -1,1412 +0,0 @@ -function varargout = pr_spm_ui(varargin) -% MarsBaR: Setting up the general linear model for independent data -% -% MarsBaR version copied with minor edits from: -% $Id: spm_spm_ui.m 372 2005-12-08 17:12:13Z karl $ -% See that (SPM5) file for comments and help - -%-Condition arguments -%----------------------------------------------------------------------- -if (nargin==0), Action = 'CFG'; else, Action = varargin{1}; end - - -switch lower(Action) -case 'cfg' - %=================================================================== - % - C O N F I G U R E D E S I G N - %=================================================================== - % pr_spm_ui('CFG',D) - if nargin<2, D = []; else, D = varargin{2}; end - - %-GUI setup - %------------------------------------------------------------------- - SPMid = spm('FnBanner',mfilename, marsbar('ver')); - [Finter,Fgraph,CmdLine] = spm('FnUIsetup','Stats: Setup analysis',0); - spm_help('!ContextHelp',mfilename) - - - %-Ask about overwriting files from previous analyses... - %------------------------------------------------------------------- - if exist(fullfile('.','SPM.mat')) - str = { 'Current directory contains existing SPM file:',... - 'Continuing will overwrite existing file!'}; - if spm_input(str,1,'bd','stop|continue',[1,0],1,mfilename); - fprintf('%-40s: %30s\n\n',... - 'Abort... (existing SPM file)',spm('time')) - spm_clf(Finter) - return - end - end - - - - %-Option definitions - %------------------------------------------------------------------- - %-Generic factor names - sF = {'sF1','sF2','sF3','sF4'}; - - %-Covariate by factor interaction options - sCFI = {'';... %-1 - 'with sF1';'with sF2';'with sF3';'with sF4';... %-2:5 - 'with sF2 (within sF4)';'with sF3 (within sF4)'}; %-6,7 - - %-DesMtx argument components for covariate by factor interaction options - % (Used for CFI's Covariate Centering (CC), GMscale & Global normalisation) - CFIforms = { '[]', 'C', '{}';... %-1 - 'I(:,1)', 'FxC', '{D.sF{1}}';... %-2 - 'I(:,2)', 'FxC', '{D.sF{2}}';... %-3 - 'I(:,3)', 'FxC', '{D.sF{3}}';... %-4 - 'I(:,4)', 'FxC', '{D.sF{4}}';... %-5 - 'I(:,[4,2])', 'FxC', '{D.sF{4},D.sF{2}}';... %-6 - 'I(:,[4,3])', 'FxC', '{D.sF{4},D.sF{3}}' }; %-7 - - %-Centre (mean correction) options for covariates & globals (CC) - % (options 9-12 are for centering of global when using AnCova GloNorm) (GC) - sCC = { 'around overall mean';... %-1 - 'around sF1 means';... %-2 - 'around sF2 means';... %-3 - 'around sF3 means';... %-4 - 'around sF4 means';... %-5 - 'around sF2 (within sF4) means';... %-6 - 'around sF3 (within sF4) means';... %-7 - '';... %-8 - 'around user specified value';... %-9 - '(as implied by AnCova)';... %-10 - 'GM';... %-11 - '(redundant: not doing AnCova)'}'; %-12 - %-DesMtx I forms for covariate centering options - CCforms = {'ones(nScan,1)',CFIforms{2:end,1},''}'; - - - %-Global normalization options (options 1-7 match CFIforms) (GloNorm) - sGloNorm = { 'AnCova';... %-1 - 'AnCova by sF1';... %-2 - 'AnCova by sF2';... %-3 - 'AnCova by sF3';... %-4 - 'AnCova by sF4';... %-5 - 'AnCova by sF2 (within sF4)';... %-6 - 'AnCova by sF3 (within sF4)';... %-7 - 'proportional scaling';... %-8 - ''}; %-9 - - %-Grand mean scaling options (GMsca) - sGMsca = { 'scaling of overall grand mean';... %-1 - 'scaling of sF1 grand means';... %-2 - 'scaling of sF2 grand means';... %-3 - 'scaling of sF3 grand means';... %-4 - 'scaling of sF4 grand means';... %-5 - 'scaling of sF2 (within sF4) grand means';... %-6 - 'scaling of sF3 (within sF4) grand means';... %-7 - '(implicit in PropSca global normalisation)';... %-8 - '' }; %-9 - %-NB: Grand mean scaling by subject is redundent for proportional scaling - - - %-Global calculation options (GXcalc) - sGXcalc = { 'omit';... %-1 - 'user specified';... %-2 - 'mean voxel value (within per image fullmean/8 mask)'}; %-3 - - - - %=================================================================== - %-D E S I G N P A R A M E T E R S - %=================================================================== - %-Get design type - %------------------------------------------------------------------- - if isempty(D) - - D = pr_spm_ui( ... - char(spm_input('Select design class...','+1','m',... - {'Basic stats','Standard PET designs','SPM96 PET designs'},... - {'DesDefs_Stats','DesDefs_PET','DesDefs_PET96'},2))); - end - - D = D(spm_input('Select design type...','+1','m',{D.DesName}')); - - - %-Set factor names for this design - %------------------------------------------------------------------- - sCC = sf_estrrep(sCC,[sF',D.sF']); - sCFI = sf_estrrep(sCFI,[sF',D.sF']); - sGloNorm = sf_estrrep(sGloNorm,[sF',D.sF']); - sGMsca = sf_estrrep(sGMsca,[sF',D.sF']); - - %-Get filenames & factor indicies - %------------------------------------------------------------------- - [P,I] = pr_spm_ui('Files&Indices',D.sF,D.n,D.b.aTime); - nScan = size(I,1); %-#obs - - %-Additional design parameters - %------------------------------------------------------------------- - bL = any(diff(I,1),1); %-Multiple factor levels? - % NB: bL(2) might be thrown by user specified f1 levels - % (D.b.aTime & D.n(2)>1) - assumme user is consistent? - bFI = [bL(1),bL(2:3)&~bL(4),bL(4),bL([2,3])&bL(4)]; - %-Allowable interactions for covariates - %-Only offer interactions with multi-level factors, and - % don't offer by F2|F3 if bL(4)! - - %-Build Condition (H) and Block (B) partitions - %=================================================================== - H=[];Hnames=[]; - B=[];Bnames=[]; - eval(['[H,Hnames] = spm_DesMtx(',D.Hform,');']) - if rank(H)==nScan, error('unestimable condition effects'), end - eval(['[B,Bnames] = spm_DesMtx(',D.Bform,');']) - if rank(B)==nScan, error('unestimable block effects'), end - - %-Drop a constant H partition if B partition can model constant - if size(H,2)>0 & all(H(:)==1) & (rank([H B])==rank(B)) - H = []; Hnames = {}; - warning('Dropping redundant constant H partition') - end - - - %-Covariate partition(s): interest (C) & nuisance (G) excluding global - %=================================================================== - nC = D.nC; %-Default #covariates - C = {[],[]}; Cnames = {{},{}}; %-Covariate DesMtx partitions & names - xC = []; %-Struct array to hold raw covariates - - - dcname = {'CovInt','NusCov'}; %-Default root names for covariates - dstr = {'covariate','nuisance variable'}; - - GUIpos = spm_input('!NextPos'); - nc = [0,0]; - for i = 1:2 % 1:covariates of interest, 2:nuisance variables - - if isinf(nC(i)), nC(i)=spm_input(['# ',dstr{i},'s'],GUIpos,'w1'); end - - while nc(i) < nC(i) - - %-Create prompt, get covariate, get covariate name - %----------------------------------------------------------- - if nC(i)==1 - str=dstr{i}; - else - str=sprintf('%s %d',dstr{i},nc(i)+1); - end - c = spm_input(str,GUIpos,'r',[],[nScan,Inf]); - if any(isnan(c(:))), break, end %-NaN is dummy value to exit - nc(i) = nc(i)+1; %-#Covariates (so far) - if nC(i)>1, tstr = sprintf('%s^{%d}',dcname{i},nc(i)); - else, tstr = dcname{i}; end - cname = spm_input([str,' name?'],'+1','s',tstr); - rc = c; %-Save covariate value - rcname = cname; %-Save covariate name - - %-Interaction option? (if single covariate vector entered)? - %----------------------------------------------------------- - if size(c,2) == 1 - %-User choice of interaction options, default is negative - %-Only offer interactions for appropriate factor combinations - if length(D.iCFI{i})>1 - iCFI = intersect(abs(D.iCFI{i}),find([1,bFI])); - dCFI = max([1,intersect(iCFI,-D.iCFI{i}(D.iCFI{i}<0))]); - iCFI = spm_input([str,': interaction?'],'+1','m',... - sCFI(iCFI),iCFI,find(iCFI==dCFI)); - else - iCFI = abs(D.iCFI{i}); %-AutoSelect default option - end - else - iCFI = 1; - end - - %-Centre covariate(s)? (Default centring to correspond to CFI) - % Always offer "no centering" as default for design matrix blocks - %----------------------------------------------------------- - DiCC = D.iCC{i}; - if size(c,2)>1, DiCC = union(DiCC,-8); end - if length(DiCC)>1 - %-User has a choice of centering options - %-Only offer factor specific for appropriate factor combinations - iCC = intersect(abs(DiCC),find([1,bFI,1]) ); - %-Default is max -ve option in D, overridden by iCFI if CFI - if iCFI == 1, dCC = -DiCC(DiCC<0); else, dCC = iCFI; end - dCC = max([1,intersect(iCC,dCC)]); - iCC = spm_input([str,': centre?'],'+1','m',... - sCC(iCC),iCC,find(iCC==dCC)); - else - iCC = abs(DiCC); %-AutoSelect default option - end - %-Centre within factor levels as appropriate - if any(iCC == [1:7]), c = c - spm_meanby(c,eval(CCforms{iCC})); end - - %-Do any interaction (only for single covariate vectors) - %----------------------------------------------------------- - if iCFI > 1 %-(NB:iCFI=1 if size(c,2)>1) - tI = [eval(CFIforms{iCFI,1}),c]; - tConst = CFIforms{iCFI,2}; - tFnames = [eval(CFIforms{iCFI,3}),{cname}]; - [c,cname] = spm_DesMtx(tI,tConst,tFnames); - elseif size(c,2)>1 %-Design matrix block - [null,cname] = spm_DesMtx(c,'X',cname); - else - cname = {cname}; - end - - %-Store raw covariate details in xC struct for reference - %-Pack c into appropriate DesMtx partition - %----------------------------------------------------------- - %-Construct description string for covariate - str = {sprintf('%s: %s',str,rcname)}; - if size(rc,2)>1, str = {sprintf('%s (block of %d covariates)',... - str{:},size(rc,2))}; end - if iCC < 8, str=[str;{['used centered ',sCC{iCC}]}]; end - if iCFI> 1, str=[str;{['fitted as interaction ',sCFI{iCFI}]}]; end - - tmp = struct( 'rc',rc, 'rcname',rcname,... - 'c',c, 'cname',{cname},... - 'iCC',iCC, 'iCFI',iCFI,... - 'type',i,... - 'cols',[1:size(c,2)] + ... - size([H,C{1}],2) + ... - size([B,C{2}],2)*(i-1),... - 'descrip',{str} ); - if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end - C{i} = [C{i},c]; - Cnames{i} = [Cnames{i}; cname]; - - end % (while) - - end % (for) - clear c tI tConst tFnames - spm_input('!SetNextPos',GUIpos); - - %-Unpack into C & G design matrix sub-partitions - G = C{2}; Gnames = Cnames{2}; - C = C{1}; Cnames = Cnames{1}; - - - %-Options... - %=================================================================== - %-Global normalization options (GloNorm) - %------------------------------------------------------------------- - if length(D.iGloNorm)>1 - %-User choice of global normalisation options, default is negative - %-Only offer factor specific for appropriate factor combinations - iGloNorm = intersect(abs(D.iGloNorm),find([1,bFI,1,1])); - dGloNorm = max([0,intersect(iGloNorm,-D.iGloNorm(D.iGloNorm<0))]); - iGloNorm = spm_input('GloNorm: Select global normalisation','+1','m',... - sGloNorm(iGloNorm),iGloNorm,find(iGloNorm==dGloNorm)); - else - iGloNorm = abs(D.iGloNorm); - end - - - %-Grand mean scaling options (GMsca) - %------------------------------------------------------------------- - if iGloNorm==8 - iGMsca=8; %-grand mean scaling implicit in PropSca GloNorm - elseif length(D.iGMsca)==1 - iGMsca = abs(D.iGMsca); - else - %-User choice of grand mean scaling options - %-Only offer factor specific for appropriate factor combinations - iGMsca = intersect(abs(D.iGMsca),find([1,bFI,0,1])); - %-Default is max -ve option in D, overridden by iGloNorm if AnCova - if iGloNorm==9, dGMsca=-D.iGMsca(D.iGMsca<0); else, dGMsca=iGloNorm; end - dGMsca = max([0,intersect(iGMsca,dGMsca)]); - iGMsca = spm_input('GMsca: grand mean scaling','+1','m',... - sGMsca(iGMsca),iGMsca,find(iGMsca==dGMsca)); - end - - - %-Value for PropSca / GMsca (GM) - %------------------------------------------------------------------- - if iGMsca == 9 %-Not scaling (GMsca or PropSca) - GM = 0; %-Set GM to zero when not scaling - else %-Ask user value of GM - if iGloNorm==8 - str = 'PropSca global mean to'; - else - str = [strrep(sGMsca{iGMsca},'scaling of','scale'),' to']; - end - GM = spm_input(str,'+1','r',D.GM,1); - %-If GM is zero then don't GMsca! or PropSca GloNorm - if GM==0, iGMsca=9; if iGloNorm==8, iGloNorm=9; end, end - end - - %-Sort out description strings for GloNorm and GMsca - %------------------------------------------------------------------- - sGloNorm = sGloNorm{iGloNorm}; - sGMsca = sGMsca{iGMsca}; - if iGloNorm==8 - sGloNorm = sprintf('%s to %-4g',sGloNorm,GM); - elseif iGMsca<8 - sGMsca = sprintf('%s to %-4g',sGMsca,GM); - end - - - %-Global centering (for AnCova GloNorm) (GC) - %------------------------------------------------------------------- - %-Specify the centering option for the global covariate for AnCova - %-Basically, if 'GMsca'ling then should centre to GM (iGC=11). Otherwise, - % should centre in similar fashion to AnCova (i.e. by the same factor(s)), - % such that models are seperable (iGC=10). This is particularly important - % for subject specific condition effects if then passed on to a second-level - % model. (See also spm_adjmean_ui.m) SPM96 (& earlier) used to just centre - % GX around its (overall) mean (iGC=1). - - %-This code allows more general options to be specified (but is complex) - %-Setting D.iGC=[-10,-11] gives the standard choices above - - %-If not doing AnCova then GC is irrelevant - if ~any(iGloNorm == [1:7]) - iGC = 12; - gc = []; - else - %-Annotate options 10 & 11 with specific details - %--------------------------------------------------------------- - %-Tag '(as implied by AnCova)' with actual AnCova situation - sCC{10} = [sCC{iGloNorm},' (<= ',sGloNorm,')']; - %-Tag 'GM' case with actual GM & GMsca case - sCC{11} = sprintf('around GM=%g (i.e. %s after grand mean scaling)',... - GM,strrep(sCC{iGMsca},'around ','')); - - %-Constuct vector of allowable iGC - %--------------------------------------------------------------- - %-Weed out redundent factor combinations from pre-set allowable options - iGC = intersect(abs(D.iGC),find([1,bFI,1,1,1,1])); - %-Omit 'GM' option if didn't GMsca (iGMsca~=8 'cos doing AnCova) - if any(iGMsca==[8,9]), iGC = setdiff(iGC,11); end - %-Omit 'GM' option if same as '(as implied by AnCova)' - if iGloNorm==iGMsca, iGC = setdiff(iGC,11); end - - %-If there's a choice, set defaults (if any), & get answer - %--------------------------------------------------------------- - if length(iGC)>1 - dGC = max([0,intersect(iGC,-D.iGC(D.iGC<0))]); - str = 'Centre global covariate'; - if iGMsca<8, str = [str,' (after grand mean scaling)']; end - iGC = spm_input(str,'+1','m',sCC(iGC),iGC,find(iGC==dGC)); - elseif isempty(iGC) - error('Configuration error: empty iGC') - end - - %-If 'user specified' then get value - %--------------------------------------------------------------- - if iGC==9 - gc = spm_input('Centre globals around','+0','r',D.GM,1); - sCC{9} = sprintf('%s of %g',sCC{iGC},gc); - else - gc = 0; - end - end - - - %-Thresholds & masks defining voxels to analyse (MASK) - %=================================================================== - GUIpos = spm_input('!NextPos'); - - %-Analysis threshold mask - %------------------------------------------------------------------- - %-Work out available options: - % -Inf=>None, real=>absolute, complex=>proportional, (i.e. times global) - M_T = D.M_.T; if isempty(M_T), M_T = [-Inf, 100, 0.8*sqrt(-1)]; end - M_T = { 'none', M_T(min(find(isinf(M_T))));... - 'absolute', M_T(min(find(isfinite(M_T)&(M_T==real(M_T)))));... - 'relative', M_T(min(find(isfinite(M_T)&(M_T~=real(M_T))))) }; - - %-Work out available options - %-If there's a choice between proportional and absolute then ask - %------------------------------------------------------------------- - q = ~[isempty(M_T{1,2}), isempty(M_T{2,2}), isempty(M_T{3,2})]; - - if all(q(2:3)) - tmp = spm_input('Threshold masking',GUIpos,'b',M_T(q,1),find(q)); - q(setdiff([1:3],tmp))=0; - end - - %-Get mask value - note that at most one of q(2:3) is true - %------------------------------------------------------------------- - if ~any(q) %-Oops - nothing specified! - M_T = -Inf; - elseif all(q==[1,0,0]) %-no threshold masking - M_T = -Inf; - else %-get mask value - if q(1), args = {'br1','None',-Inf,abs(M_T{1+find(q(2:3)),2})}; - else, args = {'r',abs(M_T{1+find(q(2:3)),2})}; end - if q(2) - M_T = spm_input('threshold',GUIpos,args{:}); - elseif q(3) - M_T = spm_input('threshold (relative to global)',GUIpos,... - args{:}); - if isfinite(M_T) & isreal(M_T), M_T=M_T*sqrt(-1); end - else - error('Shouldn''t get here!') - end - end - - %-Make a description string - %------------------------------------------------------------------- - if isinf(M_T) - xsM.Analysis_threshold = 'None (-Inf)'; - elseif isreal(M_T) - xsM.Analysis_threshold = sprintf('images thresholded at %6g',M_T); - else - xsM.Analysis_threshold = sprintf(['images thresholded at %6g ',... - 'times global'],imag(M_T)); - end - - - %-Implicit masking: Ignore zero voxels in low data-types? - %------------------------------------------------------------------- - % (Implicit mask is NaN in higher data-types.) - type = mars_vol_utils('type', spm_vol(P{1,1})); - if ~spm_type(type,'nanrep') - switch D.M_.I - case Inf, M_I = spm_input('Implicit mask (ignore zero''s)?',... - '+1','y/n',[1,0],1); %-Ask - case {0,1}, M_I = D.M_.I; %-Pre-specified - otherwise, error('unrecognised D.M_.I type') - end - - if M_I, xsM.Implicit_masking = 'Yes: zero''s treated as missing'; - else, xsm.Implicit_masking = 'No'; end - else - M_I = 1; - xsM.Implicit_masking = 'Yes: NaN''s treated as missing'; - end - - - %-Explicit mask images (map them later...) - %------------------------------------------------------------------- - switch(D.M_.X) - case Inf, M_X = spm_input('explicitly mask images?','+1','y/n',[1,0],2); - case {0,1}, M_X = D.M_.X; - otherwise, error('unrecognised D.M_.X type') - end - if M_X, M_P = pr_spm_select(Inf,'image','select mask images'); else, M_P = {}; end - - - %-Global calculation (GXcalc) - %=================================================================== - iGXcalc = abs(D.iGXcalc); - %-Only offer "omit" option if not doing any GloNorm, GMsca or PropTHRESH - if ~(iGloNorm==9 & iGMsca==9 & (isinf(M_T)|isreal(M_T))) - iGXcalc = intersect(iGXcalc,[2:size(sGXcalc,1)]); - end - if isempty(iGXcalc) - error('no GXcalc options') - elseif length(iGXcalc)>1 - %-User choice of global calculation options, default is negative - dGXcalc = max([1,intersect(iGXcalc,-D.iGXcalc(D.iGXcalc<0))]); - iGXcalc = spm_input('Global calculation','+1','m',... - sGXcalc(iGXcalc),iGXcalc,find(iGXcalc==dGXcalc)); - else - iGXcalc = abs(D.iGXcalc); - end - - if iGXcalc==2 %-Get user specified globals - g = spm_input('globals','+0','r',[],[nScan,1]); - end - sGXcalc = sGXcalc{iGXcalc}; - - - % Non-sphericity correction (set xVi.var and .dep) - %=================================================================== - xVi.I = I; - nL = max(I); % number of levels - mL = find(nL > 1); % multilevel factors - xVi.var = sparse(1,4); % unequal variances - xVi.dep = sparse(1,4); % dependencies - - if length(mL) > 1 - - % repeated measures design - %--------------------------------------------------------------- - if spm_input('non-sphericity correction?','+1','y/n',[1,0],0) - - % make menu strings - %----------------------------------------------------------- - for i = 1:4 - mstr{i} = sprintf('%s (%i levels)',D.sF{i},nL(i)); - end - mstr = mstr(mL); - - % are errors identical - %----------------------------------------------------------- - if spm_input('are errors identical','+1','y/n',[0,1],0) - str = 'unequal variances are between'; - [i j] = min(nL(mL)); - i = spm_input(str,'+0','m',mstr,[],j); - - % set in xVi and eliminate from dependency option - %------------------------------------------------------- - xVi.var(mL(i)) = 1; - mL(i) = []; - mstr(i) = []; - end - - % are errors independent - %----------------------------------------------------------- - if spm_input('are errors independent','+1','y/n',[0,1],0) - str = ' dependencies are within'; - [i j] = max(nL(mL)); - i = spm_input(str,'+0','m',mstr,[],j); - - % set in xVi - %------------------------------------------------------- - xVi.dep(mL(i)) = 1; - end - - end - end - - %-Place covariance components Q{:} in xVi.Vi - %------------------------------------------------------------------- - xVi = pr_spm_non_sphericity(xVi); - - %=================================================================== - % - C O N F I G U R E D E S I G N - %=================================================================== - spm('FigName','Stats: configuring',Finter,CmdLine); - spm('Pointer','Watch'); - - - %-Images & image info: Map Y image files and check consistency of - % dimensions and orientation / voxel size - %=================================================================== - fprintf('%-40s: ','Mapping files') %-# - VY = spm_vol(char(P)); - - - %-Check compatability of images (Bombs for single image) - %------------------------------------------------------------------- - [samef msg] = mars_vol_check(VY); - if ~samef, disp(char(msg)),error('Cannot use images'),end; - - fprintf('%30s\n','...done') %-# - - - %-Global values, scaling and global normalisation - %=================================================================== - %-Compute global values - %------------------------------------------------------------------- - switch iGXcalc, case 1 - %-Don't compute => no GMsca (iGMsca==9) or GloNorm (iGloNorm==9) - g = []; - case 2 - %-User specified globals - case 3 - %-Compute as mean voxel value (within per image fullmean/8 mask) - g = zeros(nScan,1 ); - fprintf('%-40s: %30s','Calculating globals',' ') %-# - for i = 1:nScan - str = sprintf('%3d/%-3d',i,nScan); - fprintf('%s%30s',repmat(sprintf('\b'),1,30),str)%-# - g(i) = spm_global(VY(i)); - end - fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-# - otherwise - error('illegal iGXcalc') - end - rg = g; - - - fprintf('%-40s: ','Design configuration') %-# - - - %-Scaling: compute global scaling factors gSF required to implement - % proportional scaling global normalisation (PropSca) or grand mean - % scaling (GMsca), as specified by iGMsca (& iGloNorm) - %------------------------------------------------------------------- - switch iGMsca, case 8 - %-Proportional scaling global normalisation - if iGloNorm~=8, error('iGloNorm-iGMsca(8) mismatch for PropSca'), end - gSF = GM./g; - g = GM*ones(nScan,1); - case {1,2,3,4,5,6,7} - %-Grand mean scaling according to iGMsca - gSF = GM./spm_meanby(g,eval(CCforms{iGMsca})); - g = g.*gSF; - case 9 - %-No grand mean scaling - gSF = ones(nScan,1); - otherwise - error('illegal iGMsca') - end - - - %-Apply gSF to memory-mapped scalefactors to implement scaling - %------------------------------------------------------------------- - for i = 1:nScan - VY(i).pinfo(1:2,:) = VY(i).pinfo(1:2,:)*gSF(i); - end - - - %-AnCova: Construct global nuisance covariates partition (if AnCova) - %------------------------------------------------------------------- - if any(iGloNorm == [1:7]) - - %-Centre global covariate as requested - %--------------------------------------------------------------- - switch iGC, case {1,2,3,4,5,6,7} %-Standard sCC options - gc = spm_meanby(g,eval(CCforms{iGC})); - case 8 %-No centering - gc = 0; - case 9 %-User specified centre - %-gc set above - case 10 %-As implied by AnCova option - gc = spm_meanby(g,eval(CCforms{iGloNorm})); - case 11 %-Around GM - gc = GM; - otherwise %-unknown iGC - error('unexpected iGC value') - end - - - %-AnCova - add scaled centred global to DesMtx `G' partition - %--------------------------------------------------------------- - rcname = 'global'; - tI = [eval(CFIforms{iGloNorm,1}),g - gc]; - tConst = CFIforms{iGloNorm,2}; - tFnames = [eval(CFIforms{iGloNorm,3}),{rcname}]; - [f,gnames] = spm_DesMtx(tI,tConst,tFnames); - clear tI tConst tFnames - - %-Save GX info in xC struct for reference - %--------------------------------------------------------------- - str = {sprintf('%s: %s',dstr{2},rcname)}; - if any(iGMsca==[1:7]), str=[str;{['(after ',sGMsca,')']}]; end - if iGC ~= 8, str=[str;{['used centered ',sCC{iGC}]}]; end - if iGloNorm > 1 - str=[str;{['fitted as interaction ',sCFI{iGloNorm}]}]; - end - tmp = struct( 'rc',rg.*gSF, 'rcname',rcname,... - 'c',f, 'cname' ,{gnames},... - 'iCC',iGC, 'iCFI' ,iGloNorm,... - 'type', 3,... - 'cols',[1:size(f,2)] + size([H C B G],2),... - 'descrip', {str} ); - - G = [G,f]; Gnames = [Gnames; gnames]; - if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end - - - elseif iGloNorm==8 | iGXcalc>1 - - %-Globals calculated, but not AnCova: Make a note of globals - %--------------------------------------------------------------- - if iGloNorm==8 - str = { 'global values: (used for proportional scaling)';... - '("raw" unscaled globals shown)'}; - elseif isfinite(M_T) & ~isreal(M_T) - str = { 'global values: (used to compute analysis threshold)'}; - else - str = { 'global values: (computed but not used)'}; - end - - rcname ='global'; - tmp = struct( 'rc',rg, 'rcname',rcname,... - 'c',{[]}, 'cname' ,{{}},... - 'iCC',0, 'iCFI' ,0,... - 'type', 3,... - 'cols', {[]},... - 'descrip', {str} ); - - if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end - end - - - %-Save info on global calculation in xGX structure - %------------------------------------------------------------------- - xGX = struct(... - 'iGXcalc',iGXcalc, 'sGXcalc',sGXcalc, 'rg',rg,... - 'iGMsca',iGMsca, 'sGMsca',sGMsca, 'GM',GM,'gSF',gSF,... - 'iGC', iGC, 'sGC', sCC{iGC}, 'gc', gc,... - 'iGloNorm',iGloNorm, 'sGloNorm',sGloNorm); - - - - %-Construct masking information structure and compute actual analysis - % threshold using scaled globals (rg.*gSF) - %------------------------------------------------------------------- - if isreal(M_T), M_TH = M_T * ones(nScan,1); %-NB: -Inf is real - else, M_TH = imag(M_T) * (rg.*gSF); end - - if ~isempty(M_P) - VM = spm_vol(char(M_P)); - xsM.Explicit_masking = [{'Yes: mask images :'};{VM.fname}']; - else - VM = []; - xsM.Explicit_masking = 'No'; - end - xM = struct('T',M_T, 'TH',M_TH, 'I',M_I, 'VM',{VM}, 'xs',xsM); - - - %-Construct full design matrix (X), parameter names and structure (xX) - %=================================================================== - X = [H C B G]; - tmp = cumsum([size(H,2), size(C,2), size(B,2), size(G,2)]); - xX = struct( 'X', X,... - 'iH', [1:size(H,2)],... - 'iC', [1:size(C,2)] + tmp(1),... - 'iB', [1:size(B,2)] + tmp(2),... - 'iG', [1:size(G,2)] + tmp(3),... - 'name', {[Hnames; Cnames; Bnames; Gnames]},... - 'I', I,... - 'sF', {D.sF}); - - - %-Design description (an nx2 cellstr) - for saving and display - %=================================================================== - tmp = { sprintf('%d condition, +%d covariate, +%d block, +%d nuisance',... - size(H,2),size(C,2),size(B,2),size(G,2));... - sprintf('%d total, having %d degrees of freedom',... - size(X,2),rank(X));... - sprintf('leaving %d degrees of freedom from %d images',... - size(X,1)-rank(X),size(X,1)) }; - xsDes = struct( 'Design', {D.DesName},... - 'Global_calculation', {sGXcalc},... - 'Grand_mean_scaling', {sGMsca},... - 'Global_normalisation', {sGloNorm},... - 'Parameters', {tmp} ); - - - fprintf('%30s\n','...done') %-# - - - - %-Assemble SPM structure - %=================================================================== - SPM.xY.P = P; % filenames - SPM.xY.VY = VY; % mapped data - SPM.nscan = size(xX.X,1); % scan number - SPM.xX = xX; % design structure - SPM.xC = xC; % covariate structure - SPM.xGX = xGX; % global structure - SPM.xVi = xVi; % non-sphericity structure - SPM.xM = xM; % mask structure - SPM.xsDes = xsDes; % description - SPM.SPMid = SPMid; % version - - % set output argument - %------------------------------------------------------------------- - varargout = {SPM}; - - %-End: Cleanup GUI - %=================================================================== - spm_clf(Finter) - spm('Pointer','Arrow') - fprintf('%-40s: %30s\n','Completed',spm('time')) %-# - spm('FigName','Stats: configured',Finter,CmdLine); - spm('Pointer','Arrow') - fprintf('\n\n') - - - -case 'files&indices' - %=================================================================== - % - Get files and factor indices - %=================================================================== - % [P,I] = pr_spm_ui('Files&Indices',DsF,Dn,DbaTime,nV) - % DbaTime=D.b.aTime; Dn=D.n; DsF=D.sF; - if nargin<5, nV = 1; else, nV = varargin{5}; end - if nargin<4, DbaTime = 1; else, DbaTime = varargin{4}; end - if nargin<3, Dn = [Inf,Inf,Inf,Inf]; else, Dn=varargin{3}; end - if nargin<2, DsF = {'Fac1','Fac2','Fac3','Fac4'}; else, DsF=varargin{2}; end - - %-Initialise variables - %------------------------------------------------------------------- - i4 = []; % factor 4 index (usually group) - i3 = []; % factor 3 index (usually subject), per f4 - i2 = []; % factor 2 index (usually condition), per f3/f4 - i1 = []; % factor 1 index (usually replication), per f2/f3/f4 - P = {}; % cell array of string filenames - - %-Accrue filenames and factor level indicator vectors - %------------------------------------------------------------------- - bMV = nV>1; - if isinf(Dn(4)), n4 = spm_input(['#',DsF{4},'''s'],'+1','n1'); - else, n4 = Dn(4); end - bL4 = n4>1; - - ti2 = ''; - GUIpos = spm_input('!NextPos'); - for j4 = 1:n4 - spm_input('!SetNextPos',GUIpos); - sF4P=''; if bL4, sF4P=[DsF{4},' ',int2str(j4),': ']; end - if isinf(Dn(3)), n3=spm_input([sF4P,'#',DsF{3},'''s'],'+1','n1'); - else, n3 = Dn(3); end - bL3 = n3>1; - - if DbaTime & Dn(2)>1 - %disp('NB:selecting in time order - manually specify conditions') - %-NB: This means f2 levels might not be 1:n2 - GUIpos2 = spm_input('!NextPos'); - for j3 = 1:n3 - sF3P=''; if bL3, sF3P=[DsF{3},' ',int2str(j3),': ']; end - str = [sF4P,sF3P]; - tP = {}; - n21 = Dn(2)*Dn(1); - for v=1:nV - vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end - ttP = cellstr(pr_spm_select(n21,'image',[str,'select images',vstr])); - n21 = length(ttP); - tP = [tP,ttP]; - end - ti2 = spm_input([str,' ',DsF{2},'?'],GUIpos2,'c',ti2',n21,Dn(2)); - %-Work out i1 & check - [tl2,null,j] = unique(ti2); - tn1 = zeros(size(tl2)); ti1 = zeros(size(ti2)); - for i=1:length(tl2) - tn1(i)=sum(j==i); ti1(ti2==tl2(i))=1:tn1(i); end - if isfinite(Dn(1)) & any(tn1~=Dn(1)) - %-#i1 levels mismatches specification in Dn(1) - error(sprintf('#%s not %d as pre-specified',DsF{1},Dn(1))) - end - P = [P;tP]; - i4 = [i4; j4*ones(n21,1)]; - i3 = [i3; j3*ones(n21,1)]; - i2 = [i2; ti2]; - i1 = [i1; ti1]; - end - - else - - if isinf(Dn(2)) - n2 = spm_input([sF4P,'#',DsF{2},'''s'],'+1','n1'); - else - n2 = Dn(2); - end - bL2 = n2>1; - - if n2==1 & Dn(1)==1 %-single scan per f3 (subj) - %disp('NB:single scan per f3') - str = [sF4P,'select images, ',DsF{3},' 1-',int2str(n3)]; - tP = {}; - for v=1:nV - vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end - ttP = cellstr(pr_spm_select(n3,'image',[str,vstr])); - tP = [tP,ttP]; - end - P = [P;tP]; - i4 = [i4; j4*ones(n3,1)]; - i3 = [i3; [1:n3]']; - i2 = [i2; ones(n3,1)]; - i1 = [i1; ones(n3,1)]; - else - %-multi scan per f3 (subj) case - %disp('NB:multi scan per f3') - for j3 = 1:n3 - sF3P=''; if bL3, sF3P=[DsF{3},' ',int2str(j3),': ']; end - if Dn(1)==1 - %-No f1 (repl) within f2 (cond) - %disp('NB:no f1 within f2') - str = [sF4P,sF3P,'select images: ',DsF{2},... - ' 1-',int2str(n2)]; - tP = {}; - for v=1:nV - vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end - ttP = cellstr(pr_spm_select(n2,'image',[str,vstr])); - tP = [tP,ttP]; - end - P = [P;tP]; - i4 = [i4; j4*ones(n2,1)]; - i3 = [i3; j3*ones(n2,1)]; - i2 = [i2; [1:n2]']; - i1 = [i1; ones(n2,1)]; - else - %-multi f1 (repl) within f2 (cond) - %disp('NB:f1 within f2') - for j2 = 1:n2 - sF2P=''; - if bL2, sF2P=[DsF{2},' ',int2str(j2),': ']; end - str = [sF4P,sF3P,sF2P,' select images...']; - tP = {}; - n1 = Dn(1); - for v=1:nV - vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end - ttP = cellstr(pr_spm_select(n1,'image',[str,vstr])); - n1 = length(ttP); - tP = [tP,ttP]; - end - P = [P;tP]; - i4 = [i4; j4*ones(n1,1)]; - i3 = [i3; j3*ones(n1,1)]; - i2 = [i2; j2*ones(n1,1)]; - i1 = [i1; [1:n1]']; - end % (for j2) - end % (if Dn(1)==1) - end % (for j3) - end % (if n2==1 &...) - end % (if DbaTime & Dn(2)>1) - end % (for j4) - varargout = {P,[i1,i2,i3,i4]}; - - -case 'desdefs_stats' - - %=================================================================== - % - Basic Stats Design definitions... - %=================================================================== - % D = pr_spm_ui('DesDefs_Stats'); - % These are the basic Stats design definitions... - - %-Note: struct expands cell array values to give multiple records: - % => must embed cell arrays within another cell array! - %-Negative indices indicate defaults (first used) - - D = struct(... - 'DesName','One sample t-test',... - 'n', [Inf 1 1 1], 'sF',{{'obs','','',''}},... - 'Hform', 'I(:,2),''-'',''mean''',... - 'Bform', '[]',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',-Inf,'I',Inf,'X',Inf),... - 'b',struct('aTime',0)); - - D = [D, struct(... - 'DesName','Two sample t-test',... - 'n', [Inf 2 1 1], 'sF',{{'obs','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',1))]; - - D = [D, struct(... - 'DesName','Paired t-test',... - 'n', [1 2 Inf 1], 'sF',{{'','cond','pair',''}},... - 'Hform', 'I(:,2),''-'',''condition''',... - 'Bform', 'I(:,3),''-'',''\gamma''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','One way Anova',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', '[]',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','One way Anova (with constant)',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','One way Anova (Within-subjects)',... - 'n', [1 Inf Inf 1],'sF',{{'repl','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','Simple regression (correlation)',... - 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,2),''-'',''\mu''',... - 'nC',[1,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - - - D = [D, struct(... - 'DesName','Multiple regression',... - 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},... - 'Hform', '[]',... - 'Bform', '[]',... - 'nC',[Inf,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','Multiple regression (with constant)',... - 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,2),''-'',''\mu''',... - 'nC',[Inf,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','AnCova',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,1],'iCC',{{8,1}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - - varargout = {D}; - - -case 'desdefs_pet' - %=================================================================== - % - Standard (SPM99) PET/SPECT Design definitions... - %=================================================================== - % D = pr_spm_ui('DesDefs_PET'); - % These are the standard PET design definitions... - - %-Single subject - %------------------------------------------------------------------- - D = struct(... - 'DesName','Single-subject: conditions & covariates',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[Inf,Inf],'iCC',{{[-1,3,8],[-1,8]}},'iCFI',{{[1,3],1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1)); - - D = [D, struct(... - 'DesName','Single-subject: covariates only',... - 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[Inf,Inf],'iCC',{{[-1,8],[-1,8]}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1))]; - - %-Multi-subject - %------------------------------------------------------------------- - D = [D, struct(... - 'DesName','Multi-subj: conditions & covariates',... - 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{[1,3,4,8],[1,4,8]}},'iCFI',{{[1,3,-4],[1,-4]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,... - 'iGloNorm',[4,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1))]; - - D = [D, struct(... - 'DesName','Multi-subj: cond x subj interaction & covariates',... - 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},... - 'Hform', 'I(:,[3,2]),''-'',{''subj'',''cond''}',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{[1,3,4,8],[1,4,8]}},'iCFI',{{[1,3,-4],[1,-4]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,... - 'iGloNorm',[4,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1))]; - - D = [D, struct(... - 'DesName','Multi-subj: covariates only',... - 'n',[Inf 1 Inf 1], 'sF',{{'repl','','subject',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{[1,4,8],[1,4,8]}},'iCFI',{{[1,-4],[1,-4]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,... - 'iGloNorm',[4,8:9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - %-Multi-group - %------------------------------------------------------------------- - D = [D, struct(... - 'DesName','Multi-group: conditions & covariates',... - 'n',[Inf Inf Inf Inf], 'sF',{{'repl','condition','subject','group'}},... - 'Hform', 'I(:,[4,2]),''-'',{''stud'',''cond''}',... - 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{[5:8],[5,7,8]}},'iCFI',{{[1,5,6,-7],[1,5,-7]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-7,9],'GM',50,... - 'iGloNorm',[7,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1))]; - - D = [D, struct(... - 'DesName','Multi-group: covariates only',... - 'n',[Inf 1 Inf Inf], 'sF',{{'repl','','subject','group'}},... - 'Hform', '[]',... - 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{[5,7,8],[5,7,8]}},'iCFI',{{[1,5,-7],[1,5,-7]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-7,9],'GM',50,... - 'iGloNorm',[7,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - %-Population comparisons - %------------------------------------------------------------------- - D = [D, struct(... - 'DesName',... - 'Population main effect: 2 cond''s, 1 scan/cond (paired t-test)',... - 'n',[1 2 Inf 1], 'sF',{{'','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName',... - 'Dodgy population main effect: >2 cond''s, 1 scan/cond',... - 'n',[1 Inf Inf 1], 'sF',{{'','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','Compare-populations: 1 scan/subject (two sample t-test)',... - 'n',[Inf 2 1 1], 'sF',{{'subject','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','Compare-populations: 1 scan/subject (AnCova)',... - 'n',[Inf 2 1 1], 'sF',{{'subject','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,Inf],'iCC',{{8,1}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - %-The Full Monty! - %------------------------------------------------------------------- - D = [D, struct(... - 'DesName','The Full Monty...',... - 'n',[Inf Inf Inf Inf], 'sF',{{'repl','cond','subj','group'}},... - 'Hform', 'I(:,[4,2]),''-'',{''stud'',''cond''}',... - 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{[1:8],[1:8]}},'iCFI',{{[1:7],[1:7]}},... - 'iGXcalc',[1,2,3],'iGMsca',[1:7],'GM',50,... - 'iGloNorm',[1:9],'iGC',[1:11],... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',1))]; - - - varargout = {D}; - -case 'desdefs_pet96' - %=================================================================== - % - SPM96 PET/SPECT Design definitions... - %=================================================================== - % D = pr_spm_ui('DesDefs_PET96'); - - %-Single subject - %------------------------------------------------------------------- - D = struct(... - 'DesName','SPM96:Single-subject: replicated conditions',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0)); - - D = [D, struct(... - 'DesName','SPM96:Single-subject: replicated conditions & covariates',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','SPM96:Single-subject: covariates only',... - 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - %-Multi-subject - %------------------------------------------------------------------- - D = [D, struct(... - 'DesName','SPM96:Multi-subject: different conditions',... - 'n', [1 Inf Inf 1], 'sF',{{'','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''scancond''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','SPM96:Multi-subject: replicated conditions',... - 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','SPM96:Multi-subject: different conditions & covariates',... - 'n', [1 Inf Inf 1], 'sF',{{'','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,4],[1,4]}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','SPM96:Multi-subject: replicated conditions & covariates',... - 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''condition''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,3,4],[1,4]}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','SPM96:Multi-subject: covariates only',... - 'n',[Inf 1 Inf 1], 'sF',{{'repl','','subject',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{[1,4,8],[1,4,8]}},'iCFI',{{[1,4],[1,4]}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - %-Multi-study - %------------------------------------------------------------------- - D = [D, struct(... - 'DesName','SPM96:Multi-study: different conditions',... - 'n',[1 Inf Inf Inf], 'sF',{{'','cond','subj','study'}},... - 'Hform', 'I(:,[4,2]),''-'',{''study'',''cond''}',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','SPM96:Multi-study: replicated conditions',... - 'n',[Inf Inf Inf Inf], 'sF',{{'repl','cond','subj','study'}},... - 'Hform', 'I(:,[4,2]),''-'',{''study'',''condition''}',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','SPM96:Multi-study: different conditions & covariates',... - 'n',[1 Inf Inf Inf], 'sF',{{'','cond','subj','study'}},... - 'Hform', 'I(:,[4,2]),''-'',{''study'',''cond''}',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,6,7],[1,5,7]}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','SPM96:Multi-study: replicated conditions & covariates',... - 'n',[Inf Inf Inf Inf], 'sF',{{'','cond','subj','study'}},... - 'Hform', 'I(:,[4,2]),''-'',{''study'',''condition''}',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,6,7],[1,5,7]}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - D = [D, struct(... - 'DesName','SPM96:Multi-study: covariates only',... - 'n',[Inf 1 Inf Inf], 'sF',{{'repl','','subj','study'}},... - 'Hform', '[]',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,7],[1,5,7]}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - %-Group comparisons - %------------------------------------------------------------------- - D = [D, struct(... - 'DesName','SPM96:Compare-groups: 1 scan per subject',... - 'n',[Inf Inf 1 1], 'sF',{{'subject','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', '[]',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - - varargout = {D}; - - -otherwise - %=================================================================== - % - U N K N O W N A C T I O N - %=================================================================== - warning(['Illegal Action string: ',Action]) - - %=================================================================== - % - E N D - %=================================================================== -end - -%======================================================================= -%- S U B - F U N C T I O N S -%======================================================================= - -function str = sf_estrrep(str,srstr) -%======================================================================= -for i = 1:size(srstr,1) - str = strrep(str,srstr{i,1},srstr{i,2}); -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_unvec.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_unvec.m deleted file mode 100644 index 3c01ac9..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_unvec.m +++ /dev/null @@ -1,64 +0,0 @@ -function [varargout] = pr_spm_unvec(vX,varargin) -% unvectorises a vectorised array -% FORMAT [X] = pr_spm_unvec(vX,X); -% X - numeric, cell or stucture array -% vX - pr_spm_vec(X) -% -% i.e. X = pr_spm_unvec(pr_spm_vec(X),X) -% [X{:}] = pr_spm_unvec(pr_spm_vec(X{:}),X{:}) -% - (i.e. can also deal) -% -% see pr_spm_vec -%__________________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_vec.m 184 2005-05-31 13:23:32Z karl $ - -% deal to multiple outputs if necessary -%-------------------------------------------------------------------------- -if nargout > 1 - varargout = pr_spm_unvec(vX,varargin); - return -end -if length(varargin) == 1 - X = varargin{1}; -else - X = varargin; -end - -% fill in structure arrays -%-------------------------------------------------------------------------- -if isstruct(X) - f = fieldnames(X); - for i = 1:length(f) - c = {X.(f{i})}; - n = length(pr_spm_vec(c)); - c = pr_spm_unvec(vX(1:n),c); - [X.(f{i})] = deal(c{:}); - vX = vX(n + 1:end); - end - varargout = {X}; - return -end - -% fill in cells arrays -%-------------------------------------------------------------------------- -if iscell(X) - for i = 1:length(X(:)) - n = length(pr_spm_vec(X{i})); - X{i} = pr_spm_unvec(vX(1:n),X{i}); - vX = vX(n + 1:end); - end - varargout = {X}; - return -end - -% reshape numerical arrays -%-------------------------------------------------------------------------- -if isnumeric(X) - X(:) = vX; -else - X = []; -end -varargout = {X}; diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_vec.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_vec.m deleted file mode 100644 index d7d53a8..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_vec.m +++ /dev/null @@ -1,49 +0,0 @@ -function [vX] = pr_spm_vec(varargin) -% vectorises a numeric, cell or structure array -% FORMAT [vX] = pr_spm_vec(X); -% X - numeric, cell or stucture array[s] -% vX - vec(X) -%__________________________________________________________________________ -% -% e.g.: -% spm_vec({eye(2) 3}) = [1 0 0 1 3]' -%__________________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_vec.m 279 2005-11-08 19:11:28Z karl $ - -% initialise X and vX -%-------------------------------------------------------------------------- -X = varargin; -if length(X) == 1 - X = X{1}; -end -vX = []; - -% vectorise structure into cell arrays -%-------------------------------------------------------------------------- -if isstruct(X) - f = fieldnames(X); - X = X(:); - for i = 1:length(f) - vX = cat(1,vX,pr_spm_vec({X.(f{i})})); - end - return -end - -% vectorise cells into numerical arrays -%-------------------------------------------------------------------------- -if iscell(X) - X = X(:); - for i = 1:length(X) - vX = cat(1,vX,pr_spm_vec(X{i})); - end - return -end - -% vectorise numerical arrays -%-------------------------------------------------------------------------- -if isnumeric(X) - vX = X(:); -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_volterra.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_volterra.m deleted file mode 100644 index 3f1437c..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_volterra.m +++ /dev/null @@ -1,95 +0,0 @@ -function [X,Xname,Fc] = pr_spm_volterra(U,bf,V) -% generalized convolution of inputs (U) with basis set (bf) -% FORMAT [X,Xname,Fc] = pr_spm_volterra(U,bf,V); -% U - input structure array -% bf - Basis functions -% V - [1 or 2] order of Volterra expansion [default = 1] -% -% X - Design Matrix -% Xname - names of regressors [columns] in X -% Fc(j).i - indices pertaining to input i (and interactions) -% Fc(j).name - names pertaining to input i (and interactions) -%___________________________________________________________________________ -% -% For first order expansions spm_Volterra simply convolves the causes -% (e.g. stick functions) in U.u by the basis functions in bf to create -% a design matrix X. For second order expansions new entries appear -% in ind, bf and name that correspond to the interaction among the -% orginal causes. The basis functions for these efects are two dimensional -% and are used to assemble the second order kernel in spm_graph.m. -% Second order effects are computed for only the first column of U.u. -%___________________________________________________________________________ -% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience - -% Karl Friston -% $Id: spm_Volterra.m 112 2005-05-04 18:20:52Z john $ - - - -% 1st order terms -%--------------------------------------------------------------------------- -if nargin == 2, V = 1; end - -% Construct X -%=========================================================================== - -% 1st order terms -%--------------------------------------------------------------------------- -X = []; -Xname = {}; -ind = {}; -Uname = {}; -Fc = {}; -for i = 1:length(U) - ind = []; - for k = 1:size(U(i).u,2) - for p = 1:size(bf,2) - x = U(i).u(:,k); - d = 1:length(x); - x = conv(full(x),bf(:,p)); - x = x(d); - X = [X x]; - - % indices and regressor names - %----------------------------------------------------------- - str = sprintf('%s*bf(%i)',U(i).name{k},p); - Xname{end + 1} = str; - ind(end + 1) = size(X,2); - end - end - Fc(end + 1).i = ind; - Fc(end).name = U(i).name{1}; -end - -% return if first order -%--------------------------------------------------------------------------- -if V == 1, return, end - -% 2nd order terms -%--------------------------------------------------------------------------- -for i = 1:length(U) -for j = i:length(U) - ind = []; - for p = 1:size(bf,2) - for q = 1:size(bf,2) - x = U(i).u(:,1); - y = U(j).u(:,1); - x = conv(full(x),bf(:,p)); - y = conv(full(y),bf(:,q)); - x = x(d); - y = y(d); - X = [X x.*y]; - - % indices and regressor names - %----------------------------------------------------------- - str = sprintf('%s*bf(%i)x%s*bf(%i)',... - U(i).name{1},p,... - U(j).name{1},q); - Xname{end + 1} = str; - ind(end + 1) = size(X,2); - end - end - Fc(end + 1).i = ind; - Fc(end).name = [U(i).name{1} 'x' U(j).name{1}]; -end -end diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_stat_compute.m b/lib/marsbar-0.44/@mardo_5/private/pr_stat_compute.m deleted file mode 100644 index 211fd68..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_stat_compute.m +++ /dev/null @@ -1,81 +0,0 @@ -function [con,stat,Ps,Pc] = pr_stat_compute(SPM,Ic) -% private function to compute statistics for SPM2 design -% FORMAT [con stat Ps Pc] = pr_stat_compute(SPM,Ic) -% -% Input -% SPM - SPM design structure -% Ic - indices into contrast structure (xCon in SPM) -% -% Output -% con - contrast value (ess for F test) -% stat - statistic value -% Ps - uncorrected p value -% Pc - P value Bonferroni corrected for number of columns analyzed -% -% Based on: -% @(#)spm_contrasts.m 2.3 Andrew Holmes, Karl Friston & Jean-Baptiste Poline 02/12/30 -% -% $Id: pr_stat_compute.m 214 2004-01-22 20:23:58Z matthewbrett $ - -%-Get contrast definitions (if available) -%----------------------------------------------------------------------- -try - xCon = SPM.xCon; -catch - xCon = []; -end - -%-set all contrasts by default -%----------------------------------------------------------------------- -if nargin < 2 - Ic = 1:length(xCon); -end -if any(Ic > length(xCon)) - error('Indices too large for contrast structure'); -end - -% OLS estimators and error variance estimate -%---------------------------------------------------------------- -betas = SPM.betas; -Hp = SPM.ResidualMS; - -%-Compute contrast and statistic parameters -%======================================================================= -df = [NaN SPM.xX.erdf]; -for i = 1:length(Ic) - - %-Canonicalise contrast structure with required fields - %------------------------------------------------------------------- - ic = Ic(i); - X1o = spm_FcUtil('X1o',xCon(ic),SPM.xX.xKXs); - [trMV,trMVMV] = spm_SpUtil('trMV',X1o,SPM.xX.V); - df(1) = trMV^2/trMVMV; % eidf - - switch(xCon(ic).STAT) - - case {'T'} %-Implement contrast as sum of betas - - con(i,:) = xCon(ic).c'*betas; - VcB = xCon(ic).c'*SPM.xX.Bcov*xCon(ic).c; - stat(i,:) = con(i,:)./sqrt(Hp*VcB); - Ps(i,:) = 1 - spm_Tcdf(stat(i,:),df(2)); - - case 'F' %-Implement ESS - - %-Residual (in parameter space) forming mtx - %----------------------------------------------------------- - h = spm_FcUtil('Hsqr',xCon(ic),SPM.xX.xKXs); - con(i,:) = sum((h * betas).^2, 1); - stat(i,:) = con(i,:) ./ Hp / trMV; - Ps(i,:) = (1 - spm_Fcdf(stat(i,:),df)); - - otherwise - %--------------------------------------------------------------- - error(['unknown STAT "',xCon(ic).STAT,'"']) - - end % (switch(xCon...) -end - -% Compute corrected Bonferroni (corrected for number of regions) -n = size(betas, 2); -Pc = 1-(1-Ps).^n; diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_stat_compute_mv.m b/lib/marsbar-0.44/@mardo_5/private/pr_stat_compute_mv.m deleted file mode 100644 index c94b6da..0000000 --- a/lib/marsbar-0.44/@mardo_5/private/pr_stat_compute_mv.m +++ /dev/null @@ -1,153 +0,0 @@ -function [MVres] = pr_stat_compute_mv(SPM,Ic) -% private function to compute mutlivariate statistics across ROIs -% FORMAT [MVres] = pr_stat_compute_mv(SPM,Ic) -% -% Input -% SPM - SPM design structure -% Ic - indices into contrast structure (xCon in SPM) -% -% Output -% MVres - mulitvariate result structure -% -% $Id: pr_stat_compute_mv.m 92 2004-01-07 08:37:16Z matthewbrett $ - -%-Get contrast definitions (if available) -%----------------------------------------------------------------------- -try - xCon = SPM.xCon; -catch - xCon = []; -end - -%-set all contrasts by default -%----------------------------------------------------------------------- -if nargin < 2 - Ic = 1:length(xCon); -end -if any(Ic > length(xCon)) - error('Indices too large for contrast structure'); -end - - -% Get relevant fields from design -xCon = xCon(Ic); -Xs = SPM.xX.xKXs; -V = SPM.xX.V; -betas = SPM.betas; -ResidualMS = SPM.ResidualMS; -Y = summary_data(SPM.marsY); - -% setup calculation -[nBetas nROI] = size(betas); -nCon = length(xCon); -[trRV trRVRV] = spm_SpUtil('trRV',Xs,V); -erdf = trRV^2/trRVRV; -RMS = sqrt(ResidualMS); - -%-------------------------------------------------------------------- -%- Multivariate analysis -%-------------------------------------------------------------------- - -MVres = struct('y_pre',[], 'y_obs', [], 'Pf', [], 'u', [], 'ds', [] ); - -if nCon == 1, return, end - -YpY = Y'*Y; - -for ii = 1:nCon - - xC = xCon(ii); - - %-------------------------------------------------------------------- - [NF, nu, h, d, M12, XG, sXG] = sf_model_mlm(Xs, V, nROI, xC, erdf); - - %-------------------------------------------------------------------- - %- Compute svd - %-------------------------------------------------------------------- - %- fprintf('%-40s\n','Computing Principal Components') - - Z = ((NF*betas)./(ones(size(NF,1),1)*RMS)); - S = Z*Z'; - S = S/sum(nROI); - [u s u] = svd(S,0); - ds = diag(s); - clear s; - - - %-------------------------------------------------------------------- - %- STATISTICS if any ... - %-------------------------------------------------------------------- - %- Fq : F values for the last q eigein values. - %- P : P values.for the last q eigein values. - - Fq = zeros(1,h); - for q = 0:h-1; - nu1 = d*(h-q); - nu2 = d*nu - (d-1)*(4*(h-q)+2*nu)/(h-q+2); - Fq(q+1) = ((nu-2)/nu) * nu2/(nu2-2)*sum(ds(q+1:h))/(h-q); - end - Pf = 1 - spm_Fcdf(Fq,nu1,nu2); - - - %- fprintf('%-40s\n','Computing predicted and observed temporal reponse') -%keyboard - - y_pre = (pinv(XG)'* M12 * u)*diag(sqrt(ds)); % predicted temporal reponse - - gV = (diag(1./sqrt(ds))*Z)'*u; - y_obs = (Y./(ones(size(Y,1),1)*RMS)/nROI)*gV; - - %- save results for this constrast - MVres(ii).y_pre = y_pre; - MVres(ii).y_obs = y_obs; - MVres(ii).Pf = Pf; - MVres(ii).u = u; - MVres(ii).ds = ds; - MVres(ii).df = [nu1 nu2]; - -end - - - - - - -%=================================================================== -function [NF,nu,h,d,M12,XG,sXG] = sf_model_mlm(Xs, V, nROI, xC, erdf); -% Set sub-space of interest and the related matrix of normalisation. -% FORMAT [NF,nu,h,d,M12,XG] = mm_model(); -%- nu, h, d : degrees of freedom -%- NF : matrix of normalisation -%=================================================================== - - -%-------------------------------------------------------------------- -%- SET, COMPUTE,NORMALIZE SPACES OF INTEREST -%-------------------------------------------------------------------- -%- set X10 and XG -%- XG= X -PG(X), PG projection operator on XG (cf. eq 1, 2) -%-------------------------------------------------------------------- -sX1o = spm_sp('set',spm_FcUtil('X1o',xC,Xs)); -sXG = spm_sp('set',spm_FcUtil('X0',xC,Xs)); -X1o = spm_sp('oP',sX1o,Xs.X); -XG = spm_sp('r',sXG,Xs.X); - -%- Compute Normalized effexts : M1/2=X'G*V*XG (cf eq 3) -%-------------------------------------------------------------------- -% warning off; -up = spm_sp('ox',sX1o); ; %- PG=up*up' -qi = up'*Xs.X; -sigma = up'*V*up; -M12 = (chol(sigma)*qi)'; -M_12 = pinv(M12); - -%- Compute NF : normalise factor (cf eq 4) -%-------------------------------------------------------------------- -NF = M_12*spm_sp('X',Xs)'*spm_sp('r',sXG,spm_sp('X',Xs)); - -%- degrees of freedom -%- nROI : number of ROI (corresponds to the number of Resels) -%-------------------------------------------------------------------- -d = nROI*(4*log(2)/pi)^(3/2); -h = sX1o.rk; %-rank of the sub-space of interest. -nu = erdf; diff --git a/lib/marsbar-0.44/@mardo_5/type.m b/lib/marsbar-0.44/@mardo_5/type.m deleted file mode 100644 index 9528374..0000000 --- a/lib/marsbar-0.44/@mardo_5/type.m +++ /dev/null @@ -1,6 +0,0 @@ -function str = type(o) -% returns SPM version string corresponding to design type -% -% $Id: type.m 76 2003-12-25 08:19:13Z matthewbrett $ - -str = 'SPM5'; diff --git a/lib/marsbar-0.44/@mardo_5/ui_build.m b/lib/marsbar-0.44/@mardo_5/ui_build.m deleted file mode 100644 index cfff637..0000000 --- a/lib/marsbar-0.44/@mardo_5/ui_build.m +++ /dev/null @@ -1,27 +0,0 @@ -function D = ui_build(D, dtype) -% method to create / fill design via GUI -% FORMAT D = ui_build(D, dtype) -% -% D - design object -% dtype - one of 'PET', 'FMRI', 'Basic') -% -% Returns -% D - design object with new design -% -% $Id: ui_build.m 263 2004-01-31 07:19:35Z matthewbrett $ - -if nargin < 2 - error('Need design type'); -end - -switch lower(dtype) - case 'pet' - SPM = pr_spm_ui('cfg',spm_spm_ui('DesDefs_PET')); - case 'basic' - SPM = pr_spm_ui('cfg',spm_spm_ui('DesDefs_Stats')); - case 'fmri' - SPM = pr_fmri_design; - otherwise - error(['Did not recognize design type: ' dtype]); -end -D = des_struct(D, SPM); diff --git a/lib/marsbar-0.44/@mardo_99/add_trial_f.m b/lib/marsbar-0.44/@mardo_99/add_trial_f.m deleted file mode 100644 index 0f856e6..0000000 --- a/lib/marsbar-0.44/@mardo_99/add_trial_f.m +++ /dev/null @@ -1,54 +0,0 @@ -function [D, changef] = add_trial_f(D) -% method to add trial-specific F contrasts -% -% D - design to put contrasts into -% -% Returns -% D - design with any added contrasts -% changef - set to 1 if any contrasts have been added -% -% The routine only adds contrasts that are not already present -% -% $Id$ - -if ~strcmp(modality(D), 'fmri') - error('Can only set trial-specific F contrasts for FMRI designs'); -end -SPM = des_struct(D); -xX = SPM.xX; - -%-Append contrasts for fMRI - specified by SPM.Sess(s).Fc(i) -%----------------------------------------------------------------------- -if ~isfield(SPM,'Sess') - changef = 0; - return; -end - -Sess = SPM.Sess; -xCon = []; -if (Sess{1}.rep) - for t = 1:length(Sess{1}.name) - u = []; - for s = 1:length(Sess) - u = [u Sess{s}.col(Sess{s}.ind{t})]; - end - q = 1:size(xX.X,2); - q(u) = []; - Fcname = Sess{s}.name{t}; - xcon = spm_FcUtil('Set',Fcname,'F','iX0',q,xX.xKXs); - xCon = [xCon xcon]; - end -else % Sessions are not repeated - for s = 1:length(Sess) - str = sprintf('Session %d: ',s); - for t = 1:length(Sess{s}.name) - q = 1:size(xX.X,2); - q(Sess{s}.col(Sess{s}.ind{t})) = []; - Fcname = [str Sess{s}.name{t}]; - xcon = spm_FcUtil('Set',Fcname,'F','iX0',q,xX.xKXs); - xCon = [xCon xcon]; - end - end -end - -[D Ic changef] = add_contrasts(D, xCon); diff --git a/lib/marsbar-0.44/@mardo_99/apply_filter.m b/lib/marsbar-0.44/@mardo_99/apply_filter.m deleted file mode 100644 index 8bdd815..0000000 --- a/lib/marsbar-0.44/@mardo_99/apply_filter.m +++ /dev/null @@ -1,63 +0,0 @@ -function Y = apply_filter(D, Y, flags) -% applies filter in design to data -% FORMAT Y = apply_filter(D, Y, flags) -% -% D - design, which includes a filter -% Y - data to filter (2D matrix or marsy data object) -% flags - string specifying one option, or cell array specifying more -% than one option, or struct with fields specifying options. -% Values for strings, cell contents or field names are -% 'sessions' - when used as struct field, value for field -% specifies sessions to apply filter for. The -% data size must match the length of the -% included sessions. -% -% Returns -% Y - filtered data -% -% $Id$ - -if nargin < 2 - error('Need data to filter'); -end -if nargin < 3 - flags = []; -end -if ~isempty(flags) - if ischar(flags), flags = {flags}; end - if iscell(flags) - flags = cell2struct(repmat({''}, size(flags)), flags, 1); - end -end -if ~is_fmri(D) - return -end -if ~has_filter(D) - error('This FMRI design does not contain a filter'); -end - -SPM = des_struct(D); -K = SPM.xX.K; - -% Filtering from subset of sessions -if isfield(flags, 'sessions') - ss = flags.sessions; - if ~isempty(ss) - blk_rows = block_rows(D); - if any(ss < 1 | ss > length(blk_rows)) - error('Sessions appear to be out of range'); - end - K = K(ss); - K{1}.row = blk_rows{ss} - blk_rows{ss}(1) + 1; - end -end - -if isa(Y, 'marsy') % marsy object - rd = region_data(Y); - for r = 1:length(rd) - rd{r} = pr_spm_filter('apply', K, rd{r}); - end - Y = region_data(Y, [], rd); -else % 2D matrix - Y = pr_spm_filter('apply', K, Y); -end diff --git a/lib/marsbar-0.44/@mardo_99/autocorr.m b/lib/marsbar-0.44/@mardo_99/autocorr.m deleted file mode 100644 index 4a9f6b9..0000000 --- a/lib/marsbar-0.44/@mardo_99/autocorr.m +++ /dev/null @@ -1,11 +0,0 @@ -function D = autocorr(D, varargin) -% method to report lack of autocorrelation options for SPM99 -% FORMAT D = autocorr(D, varargin) -% -% D - design object -% varargin - any other parameters that may have been passed -% -% $Id$ - -warning('There are no SPM99 autocorrelation options'); -return diff --git a/lib/marsbar-0.44/@mardo_99/bf_dt.m b/lib/marsbar-0.44/@mardo_99/bf_dt.m deleted file mode 100644 index 45e8791..0000000 --- a/lib/marsbar-0.44/@mardo_99/bf_dt.m +++ /dev/null @@ -1,7 +0,0 @@ -function d = bf_dt(D) -% method returns length of time bin for basis functions -% -% $Id$ - -SPM = des_struct(D); -d = mars_struct('getifthere', SPM, 'xX', 'dt'); diff --git a/lib/marsbar-0.44/@mardo_99/block_cols.m b/lib/marsbar-0.44/@mardo_99/block_cols.m deleted file mode 100644 index 66f34d8..0000000 --- a/lib/marsbar-0.44/@mardo_99/block_cols.m +++ /dev/null @@ -1,17 +0,0 @@ -function cols = block_cols(D) -% method gets design columns for block (session / subject) -% FORMAT cols = block_cols(D) -% -% Returns cell array of column indices (one per session) -% -% $Id$ - -if ~is_fmri(D) - error('Needs FMRI design'); -end - -SPM = des_struct(D); -Sess = SPM.Sess; -for i = 1:length(Sess) - cols{i} = Sess{i}.col; -end diff --git a/lib/marsbar-0.44/@mardo_99/block_rows.m b/lib/marsbar-0.44/@mardo_99/block_rows.m deleted file mode 100644 index 53a9b71..0000000 --- a/lib/marsbar-0.44/@mardo_99/block_rows.m +++ /dev/null @@ -1,22 +0,0 @@ -function rows = block_rows(D) -% returns cell array of rows for each (subject/session) block -% -% $Id$ - -SPM = des_struct(D); -if strcmp(modality(D), 'fmri') - Sess = SPM.Sess; - for i = 1:length(Sess) - rows{i} = Sess{i}.row; - end -else % PET I guess - xX = SPM.xX; - if ~isfield(xX, 'I') - error('Expecting I field in SPM design'); - end - scol = xX.I(:, 3); % the subject column - subjnos = unique(scol); - for s = 1:length(subjnos); - rows{s} = find(scol == subjnos(s)); - end -end diff --git a/lib/marsbar-0.44/@mardo_99/can_mars_estimate.m b/lib/marsbar-0.44/@mardo_99/can_mars_estimate.m deleted file mode 100644 index 4ae446e..0000000 --- a/lib/marsbar-0.44/@mardo_99/can_mars_estimate.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = can_mars_estimate(D) -% method returns 1 if design can be estimated in MarsBaR -% -% $Id$ - -tf = ~is_fmri(D) | has_filter(D); diff --git a/lib/marsbar-0.44/@mardo_99/compute_contrasts.m b/lib/marsbar-0.44/@mardo_99/compute_contrasts.m deleted file mode 100644 index aa2131a..0000000 --- a/lib/marsbar-0.44/@mardo_99/compute_contrasts.m +++ /dev/null @@ -1,55 +0,0 @@ -function [marsS] = compute_contrasts(marsDe, Ic) -% compute and return stats -% FORMAT marsS = compute_contrasts(marsDe, Ic) -% -% marsDe - design object -% Ic - indices into contrast structure -% -% Output -% marsS - statistic result structure -% -% For the 'con', 'stat' 'P' 'Pc' fields below, the results are matrices -% with one row per contrast, one column per ROI estimated -% -% The statistics results structure has fields -% 'con' - contrast value (numerator of t statistic, or ESS for F) -% 'stat' - t or F statistic value -% 'P' - uncorrected P value -% 'Pc' - P values corrected for number of ROIs -% 'MVres' - multivariate results structure with fields -% 'y_pre' - predicted temporal response -% 'y_obs' - observerd temporal response -% 'Pf' - probabability for last (rank of subspace) -% eigenvalues -% 'u' - principle components -% 'ds' - component weights (diag(S)) -% 'df' - degrees of freedom for Pf -% 'columns' - names of regions -% 'rows' - cell array of structs, one per contrast calculated, -% with fields: -% 'name' - contrast name -% 'stat' - statistic type (T|F) -% -% $Id$ - -SPM = des_struct(marsDe); -xCon = SPM.xCon; - -if nargin < 2 - Ic = 1:length(xCon); -end - -%- results - -[marsS.con marsS.stat, marsS.P, marsS.Pc] = ... - pr_stat_compute(xCon(Ic), SPM.xX.xKXs, SPM.xX.V, ... - SPM.betas, SPM.ResidualMS); -marsS.MVres = pr_stat_compute_mv(xCon(Ic), SPM.xX.xKXs, SPM.xX.V, ... - SPM.betas, SPM.ResidualMS, ... - summary_data(SPM.marsY)); - -marsS.columns = region_name(SPM.marsY); -for i = 1:length(Ic) - marsS.rows{i}.name = xCon(Ic(i)).name; - marsS.rows{i}.stat = xCon(Ic(i)).STAT; -end diff --git a/lib/marsbar-0.44/@mardo_99/convert_vols.m b/lib/marsbar-0.44/@mardo_99/convert_vols.m deleted file mode 100644 index fd9c896..0000000 --- a/lib/marsbar-0.44/@mardo_99/convert_vols.m +++ /dev/null @@ -1,39 +0,0 @@ -function o = convert_vols(o, ver) -% method that converts vol structs in design and converts to format 'ver' -% FORMAT o = convert_fo(o, ver) -% -% Input -% o - design object -% ver - optional version for vols from '99' or '5' -% Defaults to version for current SPM version -% -% Output -% o - object with converted vols -% -% Example -% % Convert vols to current format -% o = convert_vols(o); -% -% % Convert to native format for SPM99 designs -% o = convert_vols(o, native_vol_ver(o)); -% -% $Id$ - -if nargin < 2 - ver = mars_vol_utils('current_ver'); -end - -SPM = des_struct(o); -SPM = sf_conv(SPM, ver, 'VY'); -SPM = sf_conv(SPM, ver, 'xM', 'VM'); -o = des_struct(o, SPM); - -return - -function S = sf_conv(S, ver, varargin) -V = mars_struct('getifthere', S, varargin{:}); -if ~isempty(V) - V = mars_vol_utils('convert', V, ver); - S = setfield(S, varargin{:}, V); -end -return diff --git a/lib/marsbar-0.44/@mardo_99/design_vol.m b/lib/marsbar-0.44/@mardo_99/design_vol.m deleted file mode 100644 index fd3e39d..0000000 --- a/lib/marsbar-0.44/@mardo_99/design_vol.m +++ /dev/null @@ -1,28 +0,0 @@ -function V = design_vol(D, imgs) -% returns vols in appropriate format for saving in design -% FORMAT V = design_vol(D, imgs) -% -% Input -% D - mardo design object -% imgs - image names or vol structs -% -% Output -% V - paths relative to swd -% -% $Id$ - -if nargin < 2 - error('Need image information'); -end - -if isstruct(imgs) % vol struct, check for absolute path name - imgs = strvcat(imgs(:).fname); -end -if iscell(imgs) - imgs = char(imgs); -end -if ischar(imgs) - V = spm_str_manip(imgs, 't'); -else - error('Odd input format for images'); -end diff --git a/lib/marsbar-0.44/@mardo_99/estimate.m b/lib/marsbar-0.44/@mardo_99/estimate.m deleted file mode 100644 index a00b906..0000000 --- a/lib/marsbar-0.44/@mardo_99/estimate.m +++ /dev/null @@ -1,48 +0,0 @@ -function [marsD] = estimate(marsD, marsY, params) -% estimate method - estimates GLM for SPM99 model -% -% marsD - SPM design object -% marsY - MarsBaR data object, or 2D matrix -% param - struct containing options -% (not currently used) -% -% e.g. -% % Estimate model on design D and data Y -% E = estimate(D, Y); -% -% $Id$ - -if nargin < 2 - error('Need data to estimate'); -end -if nargin < 3 - params = []; -end - -% ensure we have a data object -marsY = marsy(marsY); - -% check design is complete -if ~can_mars_estimate(marsD) - error('This design needs more information before it can be estimated'); -end - -% Check data and design dimensions -if n_time_points(marsY) ~= n_time_points(marsD) - error('The data and design must have the same number of rows'); -end - -% get SPM design structure -SPM = des_struct(marsD); - -% do estimation -SPM = pr_estimate(SPM, marsY); -SPM.marsY = marsY; - -% We must set SPMid to contain SPM99 string in order for the mardo_99 to -% recognize this as an SPM99 design -SPM.SPMid = sprintf('SPM99: MarsBaR estimation. mardo_99 version %s', ... - marsD.cvs_version); - -% return modified structure -marsD = des_struct(marsD, SPM); diff --git a/lib/marsbar-0.44/@mardo_99/event_cols.m b/lib/marsbar-0.44/@mardo_99/event_cols.m deleted file mode 100644 index 7d68245..0000000 --- a/lib/marsbar-0.44/@mardo_99/event_cols.m +++ /dev/null @@ -1,19 +0,0 @@ -function I = event_cols(D, e_spec) -% method gets design columns for single event -% -% $Id$ - -if nargin < 2 - error('Need design and event spec'); -end -if ~is_fmri(D) - error('Needs FMRI design'); -end - -SPM = des_struct(D); -Sess = SPM.Sess; -ss = e_spec(1); -en = e_spec(2); - -j = 1:size(Sess{ss}.sf{en},2):length(Sess{ss}.ind{en}); -I = Sess{ss}.col(Sess{ss}.ind{en}(j)); diff --git a/lib/marsbar-0.44/@mardo_99/event_onsets.m b/lib/marsbar-0.44/@mardo_99/event_onsets.m deleted file mode 100644 index b11212a..0000000 --- a/lib/marsbar-0.44/@mardo_99/event_onsets.m +++ /dev/null @@ -1,60 +0,0 @@ -function [onsets, durations] = event_onsets(D, e_spec) -% method gets (estimated) onsets and durations for event/session -% FORMAT [onsets durations] = event_onsets(D, e_spec) -% -% D - design object -% e_spec - event specification (see event_fitted for details) -% -% Returns -% onsets - onset times in TRs -% durations - duration of events in TRs -% -% $Id$ - -if nargin < 2 - error('Need design and event spec'); -end -if ~is_fmri(D) - error('Needs FMRI design'); -end -if prod(size(e_spec)) > 2 - error('Can only deal with one event at a time'); -end -dt = bf_dt(D); -TR = tr(D); - -s={'SPM99 design: attempting dodgy reconstruction of onsets/durations', ... - 'Reconstruction assumes that:',... - 'Events of this trial type never overlap in time (before convolution)', ... - '(if they do, your SPM99 model will be badly messed up in any case)',... - 'and:', ... - 'The gap between the end of one event and beginning of the next ', ... - sprintf('is always more than %3.2f seconds', dt)}; -if verbose(D), warning(sprintf('%s\n', s{:})); end - -s = e_spec(1); -e = e_spec(2); -SPM = des_struct(D); -sf = SPM.Sess{s}.sf{e}(:,1); - -sfi = find(sf); -dsfi = [1; diff(sfi) > 1]; -onsets = sfi(logical(dsfi)); -durations = zeros(size(onsets)); - -for oi = 1:length(onsets) - pos = onsets(oi); - durations(oi) = 0; - while(sf(pos)) - durations(oi) = durations(oi) + 1; - pos = pos + 1; - if pos > length(sf), break, end - end -end - -sc = dt / TR; -onsets = (onsets - 1) * sc; -durations = (durations - 1) * sc; - -% In fact, the above is durations, as entered by the users. The durations -% as expressed in the design matrix are given by (durations) * sc diff --git a/lib/marsbar-0.44/@mardo_99/event_regressor.m b/lib/marsbar-0.44/@mardo_99/event_regressor.m deleted file mode 100644 index 769e9ce..0000000 --- a/lib/marsbar-0.44/@mardo_99/event_regressor.m +++ /dev/null @@ -1,57 +0,0 @@ -function [X, dt] = event_regressor(D, e_spec, dur) -% method gets estimated regressor for single event -% FORMAT [X dt] = event_regressor(D, e_spec, dur) -% -% D - design object -% e_spec - event specification (see event_fitted for details) -% dur - event duration in seconds (default = 0) -% -% Returns -% X - event regressor for single event -% (one column per basis function used to model event) -% dt - time units (seconds per row in X) -% -% $Id$ - -if nargin < 2 - error('Need design and event spec'); -end -if nargin < 3 - dur = 0; -end -if ~is_fmri(D) - error('Needs FMRI design'); -end - -if size(e_spec, 1) == 1, e_spec = e_spec'; end - -SPM = des_struct(D); -Sess = SPM.Sess; -xX = SPM.xX; -dt = xX.dt; -ss = e_spec(1); -en = e_spec(2); -bf = full(Sess{ss}.bf{en}); - -if ~dur - % SPM99 uses one time bin for events with no duration - sf = 1; -else - sf = ones(round(dur/dt), 1); -end -X = []; - -for b = 1:size(bf,2) - X = [X conv(sf, bf(:,b))]; -end - -return - -% In SPM99 spm_graph, we also apply the filter -K{1} = struct('HChoice', 'none',... - 'HParam', [],... - 'LChoice', xX.K{ss}.LChoice,... - 'LParam', xX.K{ss}.LParam,... - 'row', 1:size(X,1),... - 'RT', dt); -X = pr_spm_filter('apply',K,X); diff --git a/lib/marsbar-0.44/@mardo_99/event_specs.m b/lib/marsbar-0.44/@mardo_99/event_specs.m deleted file mode 100644 index 579655a..0000000 --- a/lib/marsbar-0.44/@mardo_99/event_specs.m +++ /dev/null @@ -1,31 +0,0 @@ -function [e_specs, e_names] = event_specs(D) -% method to return event specifications for all event in model -% FORMAT [e_specs e_names] = event_specs(D) -% -% D - design object -% -% Returns -% e_specs - event specification 2 by N matrix where row 1 is the -% session number of the event, row 2 is the event number in -% the session -% -% e_names - names of each event -% -% $Id$ - -if ~is_fmri(D) - error('Needs FMRI design'); -end - -SPM = des_struct(D); -Sess = SPM.Sess; -nsess = length(Sess); - -e_specs = []; -e_names = {}; -e_ctr = 1; -for ss = 1:nsess - nevs = length(Sess{ss}.name); - e_specs = [e_specs [ones(1, nevs) * ss; 1:nevs]]; - e_names = [e_names Sess{ss}.name]; -end diff --git a/lib/marsbar-0.44/@mardo_99/event_x_fir.m b/lib/marsbar-0.44/@mardo_99/event_x_fir.m deleted file mode 100644 index d744f87..0000000 --- a/lib/marsbar-0.44/@mardo_99/event_x_fir.m +++ /dev/null @@ -1,95 +0,0 @@ -function Xn = event_x_fir(D, e_spec, bin_length, bin_no, opts) -% method to return FIR design matrix columns for session -% FORMAT Xn = event_x_fir(D, e_spec, bin_length, bin_no, opts) -% -% D - design object -% e_spec - event specification for single event -% [session no; event no] -% bin_length - bin length in seconds -% bin_no - number of bins for FIR -% opts - structure, containing fields with options -% 'single' - if field present, gives single FIR -% This option removes any duration information, and -% returns a simple per onset FIR model, where ones in the -% design matrix corresponds to 1 event at the given -% offset. See event_fitted_fir.m for more details. -% -% Returns -% Xn - columns in design matrix for FIR model -% -% Note that we have a problem, in that the assumed start bin is not saved -% in the SPM99 design format, so we have to hope it has not changed from -% the current defaults. -% -% $Id$ - -% global parameters -global fMRI_T; -global fMRI_T0; -if isempty(fMRI_T), fMRI_T = 16; end; -if isempty(fMRI_T0), fMRI_T0 = 1; end; - -if nargin < 2 - error('Need event specfication'); -end -if nargin < 3 - bin_length = []; -end -if nargin < 4 - bin_no = []; -end -if nargin < 5 - opts = []; -end - -s = e_spec(1); -e = e_spec(2); -if isempty(bin_length) - bin_length = tr(D); -end -if isempty(bin_no) - bin_no = round(25/bin_length); -end - -SPM = des_struct(D); -Sess = SPM.Sess{s}; -dt = SPM.xX.dt; - -% Check dt against fMRI_T, warn if it differs -recorded_fMRI_T = round(SPM.xX.RT / dt); -if recorded_fMRI_T ~= fMRI_T & verbose(D) - warning(sprintf([... - 'fMRI_T (%d) does not match recorded dt, using recorded dt (%d).\n' ... - 'The original fMRI_T0 has not been recorded, assuming %d.'],... - fMRI_T, recorded_fMRI_T, fMRI_T0)); -end -T = recorded_fMRI_T; -bf = kron(eye(bin_no),ones(round(bin_length/dt),1)); -bf = pr_spm_orth(bf); - -% Reset columns to 1 after orthogonalization -BF{1} = bf / bf(1); - -k = length(Sess.row); - -if isfield(opts, 'single') - [onsets durations] = event_onsets(D, e_spec); - ons = sparse(k*T,1); - for p = 1:length(onsets) - q = round(onsets(p)*T + 1); - ons(q) = 1; - end - SF{1} = ons(1:(k*T)); - if verbose(D) & any(diff(durations)) - warning(['Apparently there were different event durations; ' ... - 'single FIR model likely to be invalid']); - end -else - SF{1} = Sess.sf{e}(:,1); -end - -Xn = pr_spm_volterra(SF,BF,{'FIR'},1); - -% Resample design matrix {X} at acquisition times -%----------------------------------------------- -Xn = Xn([0:k-1]*T + fMRI_T0,:); diff --git a/lib/marsbar-0.44/@mardo_99/fill.m b/lib/marsbar-0.44/@mardo_99/fill.m deleted file mode 100644 index e6b5f31..0000000 --- a/lib/marsbar-0.44/@mardo_99/fill.m +++ /dev/null @@ -1,248 +0,0 @@ -function D = fill(D, actions) -% fills missing entries from SPM FMRI design matrix -% FORMAT D = fill(D, actions) -% -% D - mardo object containing spm design -% actions - string or cell array of strings with actions: -% 'defaults' - fills empty parts of design with defaults -% (in fact this is always done) -% 'filter' - asks for and fills filter, autocorrelation -% 'for_estimation - fills ready for estimation -> 'filter' -% if there is no filter -% 'images' - asks for and fills with images, mask, scaling -% -% Returns -% D - returned mardo SPM design -% -% Copied/pasted then rearranged from SPM99 spm_fmri_spm_ui -% Matthew Brett - 17/11/01 - MRS2TH -% -% $Id$ - -if nargin < 2 - actions = ''; -end -if ~is_fmri(D), return, end -if isempty(actions), actions = {'defaults'}; end -if ischar(actions), actions = {actions}; end -fe = find(ismember(actions, 'for_estimation')); -if ~isempty(fe) - A = []; - if is_fmri(D) - if ~has_filter(D), A = {'filter'}; end - end - actions(fe) = []; - actions = [actions(1:fe(1)-1) A actions(fe(1):end)]; -end -actions = [{'defaults'}, actions]; - -% Get design, put into some useful variables -spmD = des_struct(D); -xX = spmD.xX; -if isfield(spmD, 'Sess') - have_sess = 1; - Sess = spmD.Sess; -else - have_sess = 0; -end - -% get file indices -%--------------------------------------------------------------- -row = block_rows(D); -nsess = length(row); -nscan = zeros(1,nsess); -for i = 1:nsess - nscan(i) = length(row{i}); -end - -done_list = {}; -for a = 1:length(actions) - if ismember(actions{a}, done_list), continue, end - done_list = [actions(a) done_list]; - switch lower(actions{a}) - case 'defaults' - - % prepare various default settings, offer to design - xM = []; % masking - xGX = []; % globals - sGXcalc = 'none'; % global calculation description - sGMsca = 'none'; % grand mean scaling description - Global = 'None'; % proportional scaling or no - - BFstr = ''; DSstr = ''; ntr = []; - if have_sess - BFstr = Sess{1}.BFstr; - DSstr = Sess{1}.DSstr; - if ~length(xX.iC) - DSstr = 'Block [session] effects only'; - end - - % Number of trial types per session - for i = 1:length(Sess) - ntr(i) = length(Sess{i}.name); - end - end - - xsDes = struct( 'Design', DSstr,... - 'Basis_functions', BFstr,... - 'Number_of_sessions', sprintf('%d',nsess),... - 'Conditions_per_session', sprintf('%-3d',ntr),... - 'Global_calculation', sGXcalc,... - 'Grand_mean_scaling', sGMsca,... - 'Global_normalisation', Global); - - if isfield(spmD, 'xsDes') - xsDes = mars_struct('fillafromb', spmD.xsDes, xsDes); - end - - spmD.xsDes = xsDes; - spmD = mars_struct('merge', spmD, ... - struct('xGX', xGX,... - 'xM', xM)); - - case 'images' - [Finter,Fgraph,CmdLine] = spm('FnUIsetup','fMRI stats model setup',0); - % select images into matrix P - P = ''; - if nsess < 16 - for i = 1:nsess - str = sprintf('select scans for session %0.0f',i); - q = spm_get(nscan(i),mars_veropts('get_img_ext'),str); - P = strvcat(P,q); - end - else - str = sprintf('select scans for this study'); - P = spm_get(sum(nscan),mars_veropts('get_img_ext'),str); - end - - % Assemble other design parameters - %======================================================================= - spm_help('!ContextHelp',mfilename) - spm_input('Global intensity normalisation...',1,'d',mfilename); - - % Global normalization - %----------------------------------------------------------------------- - str = 'remove Global effects'; - Global = spm_input(str,'+1','scale|none',{'Scaling' 'None'}); - if ischar(Global), - Global = {Global}; - end - - % get file identifiers and Global values - %======================================================================= - fprintf('%-40s: ','Mapping files') %-# - VY = spm_vol(P); - fprintf('%30s\n','...done') %-# - - %-Check compatability of images - %----------------------------------------------------------------------- - [samef msg] = mars_vol_check(VY); - if ~samef, disp(char(msg)),error('Cannot use images'),end; - - %-Compute Global variate - %------------------------------------------------------------------- - GM = 100; - q = sum(nscan); - g = zeros(q,1); - fprintf('%-40s: %30s','Calculating globals',' '); - for i = 1:q - fprintf('%s%30s',repmat(sprintf('\b'),1,30),sprintf('%4d/%-4d',i,q)); - g(i) = spm_global(VY(i)); - end - fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') - - % scale if specified (otherwise session specific grand mean scaling) - %------------------------------------------------------------------ - gSF = GM./g; - if strcmp(Global,'None') - for i = 1:nsess - j = row{i}; - gSF(j) = GM./mean(g(j)); - end - end - - %-Apply gSF to memory-mapped scalefactors to implement scaling - %--------------------------------------------------------------- - for i = 1:q, VY(i).pinfo(1:2,:) = VY(i).pinfo(1:2,:)*gSF(i); end - - sGXcalc = 'mean voxel value'; - sGMsca = 'session specific'; - - %-Masking structure - %--------------------------------------------------------------- - xM = struct('T', ones(q,1),... - 'TH', g.*gSF,... - 'I', 0,... - 'VM', {[]},... - 'xs', struct('Masking','analysis threshold')); - - % Global structure - xGX.iGXcalc = Global{1}; - xGX.sGXcalc = sGXcalc; - xGX.rg = g; - xGX.sGMsca = sGMsca; - xGX.GM = GM; - xGX.gSF = gSF; - - xsDes = struct(... - 'Global_calculation', sGXcalc,... - 'Grand_mean_scaling', sGMsca,... - 'Global_normalisation', Global); - - spmD.xsDes = mars_struct('ffillmerge',... - spmD.xsDes,... - xsDes); - spmD = mars_struct('ffillmerge', ... - spmD,... - struct('xGX', xGX,... - 'VY', VY,... - 'xM', xM)); - - case 'filter' - % Get filter and autocorrelation options - if ~have_sess, return, end - - [Finter,Fgraph,CmdLine] = spm('FnUIsetup','Set FMRI filter',0); - - % TR if not set (it should be) - if ~isfield(xX, 'RT') - spmD.xX.RT = spm_input('Interscan interval {secs}','+1'); - end - - spm_input('High and low pass filter','+1','d',mfilename) - [spmD.xX.K HFstr LFstr] = pr_get_filter(spmD.xX.RT, Sess); - xsDes = struct(... - 'Interscan_interval', sprintf('%0.2f',spmD.xX.RT),... - 'High_pass_Filter', LFstr,... - 'Low_pass_Filter', HFstr); - spmD.xsDes = mars_struct('ffillmerge',... - spmD.xsDes,... - xsDes); - - case 'autocorr' - [Finter,Fgraph,CmdLine] = spm('FnUIsetup','FMRI autocorrelation model',0); - % intrinsic autocorrelations (Vi) - %----------------------------------------------------------------------- - str = 'Model intrinsic correlations?'; - cVimenu = {'none','AR(1)'}; - cVi = spm_input(str,'+1','b',cVimenu); - - % create Vi struct - %----------------------------------------------------------------------- - Vi = speye(sum(nscan)); - xVi = struct('Vi',Vi,'Form',cVi); - for i = 1:nsess - xVi.row{i} = row{i}; - end - - % fill into design - spmD.xX.xVi = xVi; - spmD.xsDes.Intrinsic_correlations = cVi; - - otherwise - error(['Unpredictable: ' actions{a}]); - end -end - -% put stuff into object -D = des_struct(D,spmD); diff --git a/lib/marsbar-0.44/@mardo_99/fwhm.m b/lib/marsbar-0.44/@mardo_99/fwhm.m deleted file mode 100644 index e8598d2..0000000 --- a/lib/marsbar-0.44/@mardo_99/fwhm.m +++ /dev/null @@ -1,10 +0,0 @@ -function f = fwhm(o) -% method returns FWHM, or empty if not available -% -% $Id: tr.m,v 1.1 2004/01/26 22:08:55 matthewbrett Exp $ - -f = []; -SPM = des_struct(o); -if mars_struct('isthere', SPM, 'FWHM') - f = SPM.FWHM; -end diff --git a/lib/marsbar-0.44/@mardo_99/get_images.m b/lib/marsbar-0.44/@mardo_99/get_images.m deleted file mode 100644 index b6494fd..0000000 --- a/lib/marsbar-0.44/@mardo_99/get_images.m +++ /dev/null @@ -1,8 +0,0 @@ -function VY = get_images(marsD) -% method to get image vols from design -% FORMAT VY = get_images(marsD) -% -% $Id$ - -D = des_struct(marsD); -VY = D.VY; diff --git a/lib/marsbar-0.44/@mardo_99/has_autocorr.m b/lib/marsbar-0.44/@mardo_99/has_autocorr.m deleted file mode 100644 index c7c25ee..0000000 --- a/lib/marsbar-0.44/@mardo_99/has_autocorr.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = has_autocorr(o) -% returns 1 if object contains autocorrelation specification -% -% $Id$ - -tf = 0; diff --git a/lib/marsbar-0.44/@mardo_99/has_filter.m b/lib/marsbar-0.44/@mardo_99/has_filter.m deleted file mode 100644 index bdbd733..0000000 --- a/lib/marsbar-0.44/@mardo_99/has_filter.m +++ /dev/null @@ -1,10 +0,0 @@ -function tf = has_filter(o) -% returns 1 if object contains filter -% -% $Id$ - -tf = 0; -des = des_struct(o); -if isfield(des, 'xX') - tf = isfield(des.xX, 'K'); -end diff --git a/lib/marsbar-0.44/@mardo_99/has_images.m b/lib/marsbar-0.44/@mardo_99/has_images.m deleted file mode 100644 index 66726a5..0000000 --- a/lib/marsbar-0.44/@mardo_99/has_images.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = has_images(o) -% returns 1 if design contains images -% -% $Id$ - -tf = isfield(des_struct(o), 'VY'); diff --git a/lib/marsbar-0.44/@mardo_99/mardo_2.m b/lib/marsbar-0.44/@mardo_99/mardo_2.m deleted file mode 100644 index 2bea93b..0000000 --- a/lib/marsbar-0.44/@mardo_99/mardo_2.m +++ /dev/null @@ -1,301 +0,0 @@ -function o = mardo_2(o) -% method to convert SPM2 design to SPM99 design -% -% Heavily based with thanks on work by Jeff Cooper: -% Written June 2003 by Jeff Cooper (jcooper@stanford.edu) -% -% $Id$ - -% Process design -params = paramfields(o); -SPM99 = params.des_struct; -xX = SPM99.xX; - -SPM.xY = struct('P', char(image_names(o)), ... - 'VY', get_images(o)); -RT = mars_struct('getifthere', SPM99, 'xX', 'RT'); -if ~isempty(RT), SPM.xY.RT = RT; end - -SPM = mars_struct('merge', SPM, ... - mars_struct('split', SPM99, {'xM', 'xGX'})); -SPM.xCon = mars_struct('getifthere', SPM99, 'xCon'); - -% This is the first substructure that we have to do some -% actual work to assemble. Much of the details of the -% condition structures (U) can be gleaned from the SPM99 -% Sess variable - onset vectors, stick functions, etc. - but -% not quite everything. Trial durations are difficult to figure out, but -% we'll give it a go here with the event_onsets method - -if isfield(SPM99, 'Sess'), Sess = SPM99.Sess; else Sess = []; end -for i = 1:length(Sess) - currsess = Sess{i}; - - % indices for this session's row in design matrix - SPM.Sess(i).row = currsess.row; - - % indices for this session's cols in design matrix - SPM.Sess(i).col = currsess.col; - - % number of scans in this session - SPM.nscan(i) = length(currsess.row); - - % We can use the length of the onset cell array as an - % effective number of conditions variable - only 'true' - % conditions have onset vectors, not Volterra items or - % user-specified covariates. - for j = 1:length(currsess.ons) - - % Try getting onsets and durations from design - [ons dur] = event_onsets(D, [i j]); - - % time bin length in seconds - SPM.Sess(i).U(j).dt = xX.dt; - - % name of trial type - SPM.Sess(i).U(j).name = {currsess.name{j}}; - - % vector of onsets - SPM.Sess(i).U(j).ons = ons; - - % duration of trials - SPM.Sess(i).U(j).dur = dur; - - % actual stick functions - SPM2 uses 32-bin offset. - SPM.Sess(i).U(j).u = [zeros(32,1); currsess.sf{j}]; - - % peristimulus time course (seconds) - SPM.Sess(i).U(j).pst = currsess.pst{j}; - - % parameter name - SPM.Sess(i).U(j).P.name = currsess.Pname{j}; - if isempty(currsess.Pname{j}) - % SPM2 includes these values for 'none' - % parameters - just mimicking what they do... - SPM.Sess(i).U(j).P.name = 'none'; - SPM.Sess(i).U(j).P.P = currsess.ons{j}; % values of parameter - SPM.Sess(i).U(j).P.h = 0; % order of polynomial expansion - else - SPM.Sess(i).U(j).P.name = currsess.Pname{j}; % parameter name - SPM.Sess(i).U(j).P.P = currsess.Pv{j}; % parameter values - % leave h and i blank for now... - end - end - % SPM99 doesn't save regressors in independent - % structures as SPM2 does, but it does always append - % them to the end of the session and append 'user - % specified covariates' to the description string of the - % session if they exist, which we can use. - % - % First check and see if there are any: - if ~(isempty(strfind(lower(currsess.DSstr), 'user specified covariates'))) - % i.e., some are in here, so find out what their indices - % are - all the columns that don't correspond to - % specified conditions with onsets and such. - % Note that Volterra items aren't included in - % onsets, either, but they are included in 'the 'name' - % field - so we want to use that as our chopping - % point for finding covariate columns - everything - % after name is a covariate. - reg_indices = currsess.col((length(currsess.name)+1):end); - % extract values from design matrix - SPM.Sess(i).C.C = xX.X(currsess.row, reg_indices); % user-specified covariate values - SPM.Sess(i).name = xX.Xnames(reg_indices); % user-specified covariate names - else - % there are no user specified covariates - SPM.Sess(i).C.C = []; - SPM.Sess(i).C.name = {}; - end - % Everything which is in the 'name' field is either an - % actual condition or a Volterra item, so that's our - % effective number for the Fc array. - for j = 1:length(currsess.name) - SPM.Sess(i).Fc(j).i = currsess.ind{j}; % index for input j and interactions - SPM.Sess(i).Fc(j).name = char(currsess.name(j)); % name for input j and interactions - end -end % Session loop - -if ~isempty(Sess) - %%%%%%%%%% - % SPM.xBF - basis function structure - %%%%%%%%%% - - % NOTE on the BF structure - where SPM99 allows the - % individual specification of basis functions for each trial - % type, SPM2 just has one basis function set for the whole - % experiment. Since it's difficult to figure out which of - % the various SPM99 basis functions to use on any kind of - % reasoned basis, this program takes the arbitrary step of - % just taking the first one from the first session. This - % should work fine for most experiments, but those with - % mixed basis functions that want to select a different one - % among the ones save are encouraged to modify the lines - % below to get the one to their liking... - sess_idx_for_bf = 1; - cond_idx_for_bf = 1; - - SPM.xBF.T = xX.RT / xX.dt; - - % # of time bins per scan - % T0 - the reference time bin - isn't saved by SPM99, and - % it's not extractable from the design matrix in any way I - % can figure out. So we'll take a stab at loading it from - % the site's defaults, and if you re-set it, you'd better be - % paying attention... - % first run local defaults file - that'll pull something - % up uniquely. - spm_defaults; - global defaults; %SPM2-style - global fMRI_T0; %SPM99-style - if ~isempty(defaults) - SPM.xBF.T0 = defaults.stats.fmri.t0; % reference time bin - elseif ~isempty(fMRI_T0) - SPM.xBF.T0 = fMRI_T0; - else - % shouldn't get here - there should be some defaults on - % this system - but not a killer error. One they should - % know about, though... - disp('Warning: Defaults don''t contain reference slice value!'); - SPM.xBF.T0 = 1; - end - % SPM99 onsets were reconstructed in scan units - % units that onsets are in ['scans', 'seconds'] - SPM.xBF.UNITS = 'scans'; - if length(SPM.Sess(1).U) < length(SPM.Sess(1).Fc) - % Volterra flag [1=no Volterra, 2=Volterra modeled] - SPM.xBF.Volterra = 2; - else - SPM.xBF.Volterra = 1; - end - SPM.xBF.dt = xX.dt; % time bin length in seconds - SPM.xBF.name = ''; % string: type of basis function - not saved by SPM99 batching - SPM.xBF.bf = Sess{sess_idx_for_bf}.bf(cond_idx_for_bf); - % the actual basis function matrix - % SPM99 doesn't explicitly save length or order of basis - % functions, but this below should work for all non-Fourier, - % non-Gamma basis fns, and maybe even some of them... - SPM.xBF.length = xX.dt*size(SPM.xBF.bf, 1); % window length of basis fn in secs - SPM.xBF.order = size(SPM.xBF.bf,2); % order of basis fn - -end - -%%%%%%%%%% -% SPM.xVi - temporal non-sphericity struct -%%%%%%%%%% - -% We'll be assuming that SPM99 results, in general, made the -% i.i.d. assumption. Estimation of results with the AR(1) -% option specified proceeds very differently in SPM2 than in -% SPM99, and so those that used AR(1) in SPM99 are warned -% that their results will not translate perfectly to SPM2, -% as the whitening matrix W will always be set to identity -% in importing these results. - -switch xX.xVi.Form - case 'none' - SPM.xVi.form = 'i.i.d'; % string description of xVi - % covariance constraints - sparse identity matrix in this option for both SPM99 and SPM2. - SPM.xVi.Vi = {xX.xVi.Vi}; - SPM.xVi.V = speye(size(xX.xVi)); % estimated non-sphericity itself. - case 'AR(1)' - SPM.xVi.form = 'AR(0.2)'; % string description of xVi - this is parallel to what SPM2 does - SPM.xVi.Vi = {xX.xVi.Vi} % covariance constraints - - % I don't think this will actually make a - % difference, as the whitening matrix W is always - % going to be identity. But it may be useful to - % have. True SPM2 results will also have xVi.V and - % so forth, but not these imported ones... -end - -%%%%%%%%%% -% SPM.xX - design matrix structure -%%%%%%%%%% - -% Here's the big 'un. Much of this stuff will be translated -% directly from the SPM99 results, and it remains to be seen -% how well that's going to work. We will assume that -% ordinary least squares estimation has been used in SPM99, -% and therefore set W to the identity matrix. - -SPM.xX = mars_struct('split', xX, ... - {'X','iH', 'iC', 'iB', 'iG', 'V', 'I' ... - 'xKXs', 'pKX', 'Bcov', 'trRV', 'trRVRV', 'erdf', 'nKX'}); -SPM.xX.name = xX.Xnames; -if isfield(xX, 'K') - if iscell(xX.K) - for i = 1:length(xX.K) - SPM.xX.K(i).RT = SPM.xY.RT; % experimental RT - SPM.xX.K(i).row = xX.K{i}.row; % row indices in design matrix for this filter - SPM.xX.K(i).HParam = xX.K{i}.HParam; % high-pass cutoff period in secs - SPM.xX.K(i).X0 = full(xX.K{i}.KH); % frequencies to be removed by filter. - end - else - SPM.xX.K = xX.K; - end -end -SPM.xX.W = speye(size(xX.X,1)); % whitening matrix - identity for ordinary least squares estimates - -if isfield(SPM99, 'M') - SPM.xVol = mars_struct('split', SPM99, ... - {'M', 'DIM', 'XYZ', 'S', 'R', 'FWHM'}); - SPM.xVol.iM = inv(SPM.xVol.M); % inverse of M - % We will deal with the RPV image later on... -end - -%%%%%%%%%% -% SPM.miscellaneous stuff -%%%%%%%%%% - -% various string descriptions of experimental design -SPM.xsDes = SPM99.xsDes; -if isfield(SPM.xsDes, 'Conditions_per_session') - SPM.xsDes.Trials_per_session = SPM.xsDes.Conditions_per_session; - rmfield(SPM.xsDes, 'Conditions_per_session'); -end -SPM.xsDes.Serial_correlations = SPM.xVi.form; - -SPM.SPMid = ['SPM2: Results imported from SPM99 design: ' SPM99.SPMid]; - -% Try and deal with estimated result volumes -if isfield(SPM99, 'swd') - SPM.swd = SPM99.swd; - if ~exist(SPM99.swd, 'dir') - warning(['Could not find directory: ' SPM.swd]); - else - o_pwd = pwd; - cd(SPM99.swd); - if isfield(SPM99, 'Vbeta') - for i = 1:length(SPM99.Vbeta) - SPM.Vbeta(i) = spm_vol(SPM99.Vbeta{i}); - end - SPM.VResMS = spm_vol(SPM99.VResMS); - SPM.VM = spm_vol(SPM99.VM); - end - for i = 1:length(SPM.xCon) - if ~isempty(SPM.xCon(i).Vcon) - SPM.xCon(i).Vcon = spm_vol(SPM.xCon(i).Vcon); - end - if ~isempty(SPM.xCon(i).Vspm) - SPM.xCon(i).Vspm = spm_vol(SPM.xCon(i).Vspm); - end - end - if isfield(SPM99, 'M') - % Now deal with RPV image - if exist('RPV.img', 'file') - % filehandle of resels per voxel image - SPM.xVol.VRpv = spm_vol('RPV.img'); - else - % Don't really understand this one... - SPM.xVol.VRpv.fname = ['../' SPM.xVol.VRpv.fname]; - end - end - cd(o_pwd); - end -end - -% put into parent object -params.des_struct = SPM; -o = mardo_2(params); - -return diff --git a/lib/marsbar-0.44/@mardo_99/mardo_99.m b/lib/marsbar-0.44/@mardo_99/mardo_99.m deleted file mode 100644 index 4966f65..0000000 --- a/lib/marsbar-0.44/@mardo_99/mardo_99.m +++ /dev/null @@ -1,113 +0,0 @@ -function [o, others] = mardo_99(params, others, varargin) -% class constructor for SPM99 MarsBaR design object -% FORMAT [o, others] = mardo_99(params, others, varargin) -% Inputs -% params - structure,containing fields, or SPM/MarsBaR design -% others - structure, containing other fields to define -% -% Outputs -% o - mardo_99 object (unless disowned) -% others - any unrecognized fields from params, for processing by -% children -% -% This object is called from the mardo object contructor -% with a mardo object as input. mardo_99 checks to see -% if the contained design is an SPM99 design, returns -% the object unchanged if not. If it is an SPM99 -% design, it claims ownership of the passed object. -% -% The constructor can also be called to give class functions, where the -% name of the class function is a character string which is one of: -% 'spm_filter' - applies spm_filter routine to passed args -% -% $Id$ - -myclass = 'mardo_99'; -cvs_v = marsbar('ver'); % was CVS version; now marsbar version - -% Default object structure -defstruct = []; - -if nargin < 1 - defstruct.cvs_version = cvs_v; - o = class(defstruct, myclass, mardo); - others = []; - return -end -if nargin < 2 - others = []; -end - -% parse out string action calls (class functions) -if ischar(params) - switch params - case 'spm_filter' - if nargin < 2 - error('Need filter'); - elseif nargin < 3 - error('Need action string'); - elseif nargin < 4 - o = pr_spm_filter(others, varargin{1}); - else - o = pr_spm_filter(others, varargin{1:2}); - end - return - otherwise - error(sprintf('Is "%s" a filename? Use ``mardo`` to load from files',... - params)); - end -end - -% Deal with passed objects of this (or child) class -if isa(params, myclass) - o = params; - % Check for simple form of call - if isempty(others), return, end - - % Otherwise, we are being asked to set fields of object - % (Moot at the moment, as there are no fields specific for this object) - [p others] = mars_struct('split', others, defstruct); - return -end - -% normal call is via mardo constructor -if isa(params, 'mardo') - % Check to see if this is a suitable design, return if not - des = des_struct(params); - if ~my_design(des), o = params; return, end - uo = params; - params = []; -else - uo = []; -end - -if ~isa(uo, 'mardo') % mardo object not passed - % umbrella object, parse out fields for (this object and children) - % third argument of 0 prevents recursive call back to here - [uo, params] = mardo(params, others, 0); -else - % fill params with other parameters - params = mars_struct('ffillmerge', params, others); -end - -% parse parameters into those for this object, children -[params, others] = mars_struct('ffillsplit', defstruct, params); - -% add cvs tag -params.cvs_version = cvs_v; - -% set the mardo object -o = class(params, myclass, uo); - -% set filter (to allow sparse->full trick to work for spm_spm.m) -SPM = des_struct(o); -K = mars_struct('getifthere', SPM, 'xX', 'K'); -if iscell(K); - SPM.xX.K = pr_spm_filter('set', K); - o = des_struct(o, SPM); -end - -% convert vols to current format -o = convert_vols(o); - -return diff --git a/lib/marsbar-0.44/@mardo_99/mars_spm_graph.m b/lib/marsbar-0.44/@mardo_99/mars_spm_graph.m deleted file mode 100644 index dc945a0..0000000 --- a/lib/marsbar-0.44/@mardo_99/mars_spm_graph.m +++ /dev/null @@ -1,560 +0,0 @@ -function [r_st,marsD,changef] = mars_spm_graph(marsD,rno,Ic) -% Graphical display of adjusted data -% FORMAT [r_st,marsD,changef] = mars_spm_graph(marsD,rno,Ic) -% -% marsD - SPM design object -% required fields in des_struct are: -% xX - Design Matrix structure -% - (see spm_spm.m for structure) -% betas - the betas! -% ResidualMS - the residual mean square -% xCon - contrast definitions -% - required fields are: -% .c - contrast vector/matrix -% (see spm_FcUtil.m for details of contrast structure... ) -% marsY - the data itself (as a data object) -% -% rno - region number (index for marsD.marsY) -% Ic - contrast number (optional) -% -% Returns -% r_st - return structure, with fields -% Y - fitted data for the selected voxel -% y - adjusted data for the selected voxel -% beta - parameter estimates -% SE - standard error of parameter estimates -% cbeta = betas multiplied by contrast -% marsD - design structure, with possibly added contrasts -% changef - set to 1 if design has changed -% -% see spm99 version of spm_graph for details -%_______________________________________________________________________ -% @(#)spm_graph.m 2.29 Karl Friston 00/09/14 -% Modified for MarsBar - Matthew Brett 1/11/01 NRN -% Added return of cbetas at some point before 28/1/03 -% -% $Id$ - -if ~is_mars_estimated(marsD) - error('Need estimated design for plot'); -end -if nargin < 2 - rno = []; -end -if nargin < 3 - Ic = []; -end -changef = 0; - -% make values ready for return -def_r_st = struct(... - 'Y', [],... - 'y', [],... - 'beta', [],... - 'SE', [],... - 'cbeta',[]); -cbeta = []; - -% get stuff from object -mRes = des_struct(marsD); -xCon = mRes.xCon; - -% Check if we want to, and can, assume region no is 1 -if isempty(rno) - if n_regions(mRes.marsY) > 1 - error('Need to specify region number'); - end - rno = 1; -end - -%-Get Graphics figure handle -%----------------------------------------------------------------------- -Fgraph = spm_figure('GetWin','Graphics'); - -%-Delete previous axis and their pagination controls (if any) -%----------------------------------------------------------------------- -spm_results_ui('Clear',Fgraph,2); - -% Get required data -sY = summary_data(mRes.marsY); -y = apply_filter(marsD, sY(:, rno)); - -% Get design matrix for convenience -xX = mRes.xX; - -% Label for region -XYZstr = region_name(mRes.marsY, rno); -XYZstr = XYZstr{1}; - -%-Get parameter estimates, ResidualMS, (compute) fitted data & residuals -%======================================================================= - -%-Parameter estimates: beta = xX.pKX*xX.K*y; -%----------------------------------------------------------------------- -beta = mRes.betas(:, rno); - -%-Compute residuals -%----------------------------------------------------------------------- -R = spm_sp('r',xX.xKXs,pr_spm_filter('apply',xX.K,y)); - -%-Residual mean square: ResidualMS = sum(R.^2)/xX.trRV; -%----------------------------------------------------------------------- -ResidualMS = mRes.ResidualMS(rno); -Bcov = xX.Bcov; -SE = sqrt(ResidualMS*diag(Bcov)); -COL = ['r','b','g','c','y','m','r','b','g','c','y','m']; - - -%-Plot -%======================================================================= - -% find out what to plot -%----------------------------------------------------------------------- -Cplot = { 'Contrast of parameter estimates',... - 'Fitted and adjusted responses',... - 'Event/epoch-related responses',... - 'Plots of parametric responses',... - 'Volterra Kernels'}; - - -% ensure options are appropriate -%----------------------------------------------------------------------- -if ~isfield(mRes,'Sess') - - Cplot = Cplot(1:2); -else - Sess = mRes.Sess; -end -Cp = spm_input('Plot',-1,'m',Cplot); -Cplot = Cplot{Cp}; - -switch Cplot - -% select contrast to plot and compute fitted and adjusted data -%---------------------------------------------------------------------- -case {'Contrast of parameter estimates','Fitted and adjusted responses'} - - % determine current contrasts - %--------------------------------------------------------------- - if isempty(Ic) - % determine which contrast - %--------------------------------------------------------------- - [Ic marsD changef] = ui_get_contrasts(... - marsD, 'T|F',1, 'Select contrast...', ' for plot', 1); - if changef, xCon = get_contrasts(marsD); end - end - TITLE = {Cplot xCon(Ic).name}; - - % fitted (corrected) data (Y = X1o*beta) - %--------------------------------------------------------------- - Y = spm_FcUtil('Yc',xCon(Ic),xX.xKXs,beta); - - % adjusted data - %--------------------------------------------------------------- - y = Y + R; - -end - -switch Cplot - -% plot parameter estimates -%---------------------------------------------------------------------- -case 'Contrast of parameter estimates' - - % comute contrast of parameter estimates and standard error - %-------------------------------------------------------------- - c = xCon(Ic).c; - cbeta = c'*beta; - SE = sqrt(ResidualMS*diag(c'*Bcov*c)); - - % bar chart - %-------------------------------------------------------------- - figure(Fgraph) - subplot(2,1,2) - h = bar(cbeta); - set(h,'FaceColor',[1 1 1]*.8) - for j = 1:length(cbeta) - line([j j],([SE(j) 0 - SE(j)] + cbeta(j)),... - 'LineWidth',3,'Color','r') - end - set(gca,'XLim',[0.4 (length(cbeta) + 0.6)]) - XLAB = 'effect'; - YLAB = ['size of effect',XYZstr]; - - -% all fitted effects or selected effects -%----------------------------------------------------------------------- -case 'Fitted and adjusted responses' - - % get ordinates - %--------------------------------------------------------------- - Xplot = { 'an explanatory variable',... - 'scan or time',... - 'a user specified ordinate'}; - - Cx = spm_input('plot against','!+1','m',Xplot); - - if Cx == 1 - - str = 'Which column or effect?'; - i = spm_input(str,'!+1','m',xX.Xnames); - x = xX.xKXs.X(:,i); - XLAB = xX.Xnames{i}; - - elseif Cx == 2 - - if isfield(xX,'RT') & ~isempty(xX.RT) - x = xX.RT*[1:size(Y,1)]'; - XLAB = 'time {seconds}'; - else - x = [1:size(Y,1)]'; - XLAB = 'scan number'; - end - - elseif Cx == 3 - - x = spm_input('enter ordinate','!+1','e','',size(Y,1)); - XLAB = 'ordinate'; - - end - - % plot - %--------------------------------------------------------------- - figure(Fgraph) - subplot(2,1,2) - [p q] = sort(x); - if all(diff(x(q))) - plot(x(q),y(q),':b'); hold on - plot(x(q),y(q),'.b','MarkerSize',8); hold on - plot(x(q),Y(q),'r' ); hold off - - else - plot(x(q),y(q),'.b','MarkerSize',8); hold on - plot(x(q),Y(q),'.r','MarkerSize',16); hold off - xlim = get(gca,'XLim'); - xlim = [-1 1]*diff(xlim)/4 + xlim; - set(gca,'XLim',xlim) - - end - YLAB = ['response',XYZstr]; - - -% modeling evoked responses based on Sess -%---------------------------------------------------------------------- -case 'Event/epoch-related responses' - - - % average over sessions? - %-------------------------------------------------------------- - ss = length(Sess); - if ss > 1 - - % determine if the same basis functions have been used - %------------------------------------------------------ - for s = 1:ss - rep = length(Sess{s}.bf) == length(Sess{1}.bf); - if ~rep, break, end - for t = 1:length(Sess{s}.bf) - rep = all(size(Sess{s}.bf{t}) == size(Sess{1}.bf{t})); - if ~rep, break, end - rep = all(all( Sess{s}.bf{t} == Sess{1}.bf{t} )); - if ~rep, break, end - end - if ~rep, break, end - end - - % average over sessions? - %------------------------------------------------------ - if rep - str = 'average over sessions?'; - rep = spm_input(str,'+1','y/n',[1 0]); - end - - % selected sessions - %------------------------------------------------------ - if rep - ss = 1:ss; - else - str = sprintf('which session (1 to %d)',ss); - ss = spm_input(str,'+1','n','1',1,ss); - end - end - - % get plot type - %-------------------------------------------------------------- - Rplot = { 'fitted response',... - 'fitted response and PSTH',... - 'fitted response +/- standard error',... - 'fitted response and adjusted data'}; - - if isempty(y), Rplot = Rplot([1 3]); end - Cr = spm_input('plot in terms of','+1','m',Rplot); - TITLE = Rplot{Cr}; - YLAB = ['response',XYZstr]; - XLAB{1} = 'peri-stimulus time {secs}'; - - - % get selected trials - %-------------------------------------------------------------- - tr = length(Sess{ss(1)}.pst); - if tr > 1 - str = sprintf('which trials or conditions (1 to %d)',tr); - tr = spm_input(str,'+1','n'); - end - - - % plot - %-------------------------------------------------------------- - switch TITLE - case 'fitted response and PSTH' - str = 'bin size for PSTH {secs}'; - BIN = spm_input(str,'+1','r','2',1); - - otherwise, BIN = 2; end - - % reconstruct response with filtering - %-------------------------------------------------------------- - figure(Fgraph) - subplot(2,1,2) - hold on - dx = xX.dt; - XLim = 0; - u = 1; - for t = tr - - for s = ss - - % basis functions, filter and parameters - %---------------------------------------------- - j = 1:size(Sess{s}.sf{t},2):length(Sess{s}.ind{t}); - j = Sess{s}.col(Sess{s}.ind{t}(j)); - B = beta(j); - X = Sess{s}.bf{t}; - q = 1:size(X,1); - x = (q - 1)*dx; - K{1} = struct( 'HChoice', 'none',... - 'HParam', [],... - 'LChoice', xX.K{s}.LChoice,... - 'LParam', xX.K{s}.LParam,... - 'row', q,... - 'RT', dx); - - % fitted responses with standard error - %---------------------------------------------- - KX = pr_spm_filter('apply',K,X); - Y(q,s) = KX*B; - se(:,s) = sqrt(diag(X*Bcov(j,j)*X')*ResidualMS); - end - - % average over sessions - %------------------------------------------------------ - Y = sum(Y,2)/length(ss); - - % peristimulus times and adjusted data (Y + R) - %------------------------------------------------------ - pst = []; - y = []; - for s = ss - p = Sess{s}.pst{t}(:); - bin = round(p/dx); - q = find((bin >= 0) & (bin < size(X,1))); - pst = [pst; p]; - p = R(Sess{s}.row(:)); - p(q) = p(q) + Y(bin(q) + 1); - y = [y; p]; - end - - - % PSTH - %------------------------------------------------------ - INT = -BIN:BIN:max(pst); - PSTH = []; - SEM = []; - PST = []; - for k = 1:(length(INT) - 1) - q = find(pst > INT(k) & pst <= INT(k + 1)); - n = length(q); - if n - PSTH = [PSTH mean(y(q))]; - SEM = [SEM std(y(q))/sqrt(n)]; - PST = [PST mean(pst(q))]; - end - end - - % plot - %------------------------------------------------------ - switch TITLE - - case 'fitted response' - %---------------------------------------------- - plot(x,Y,COL(u)) - - case 'fitted response and PSTH' - %---------------------------------------------- - errorbar(PST,PSTH,SEM,[':' COL(u)]) - plot(PST,PSTH,['.' COL(u)],'MarkerSize',16) - plot(PST,PSTH,COL(u),'LineWidth',2) - plot(x,Y,['-.' COL(u)]) - - case 'fitted response +/- standard error' - %---------------------------------------------- - plot(x,Y,COL(u)) - plot(x,Y + se,['-.' COL(u)],x,Y - se,['-.' COL(u)]) - - case 'fitted response and adjusted data' - %---------------------------------------------- - plot(x,Y,COL(u),pst,y,['.' COL(u)],'MarkerSize',8) - - end - - % xlabel - %------------------------------------------------------ - XLAB{end + 1} = [Sess{s}.name{t} ' - ' COL(u)]; - u = u + 1; - XLim = max([XLim max(x)]); - - end - - hold off; axis on - set(gca,'XLim',[-4 XLim]) - -% modeling evoked responses based on Sess -%---------------------------------------------------------------------- -case 'Plots of parametric responses' - - % Get session - %-------------------------------------------------------------- - s = length(Sess); - if s > 1 - s = spm_input('which session','+1','n1',[],s); - end - - % Get [parametric] trial - %-------------------------------------------------------------- - Vname = {}; - j = []; - for i = 1:length(Sess{s}.Pv) - if length(Sess{s}.Pv{i}) - Vname{end + 1} = Sess{s}.name{i}; - j = [j i]; - end - end - if isempty(Vname) - warning('No parametric responses specified'); - end - t = j(spm_input('which effect','+1','m',Vname)); - - % parameter estimates and fitted response - %------------------------------------------------------------- - B = beta(Sess{s}.col(Sess{s}.ind{t})); - Q = Sess{s}.Pv{t}; - SF = Sess{s}.sf{t}; - SF = SF(find(SF(:,1)),:); - X = Sess{s}.bf{t}; - q = 1:size(X,1); - x = q*xX.dt; - K{1} = struct( 'HChoice', 'none',... - 'HParam', [],... - 'LChoice', xX.K{s}.LChoice,... - 'LParam', xX.K{s}.LParam,... - 'row', q,... - 'RT', xX.dt); - - KX = pr_spm_filter('apply',K,X); - p = size(SF,2); - b = []; - for i = 1:size(KX,2) - b = [b SF*B([1:p] + (i - 1)*p)]; - end - Y = KX*b'; - - % plot - %------------------------------------------------------------- - figure(Fgraph) - subplot(2,1,2) - surf(x',Q',Y') - shading flat - TITLE = Sess{s}.name{t}; - XLAB = 'perstimulus time (secs)'; - YLAB = Sess{s}.Pname{t}; - zlabel(['responses',XYZstr]); - - -% modeling evoked responses based on Sess -%---------------------------------------------------------------------- -case 'Volterra Kernels' - - - % Get session - %-------------------------------------------------------------- - s = length(Sess); - if s > 1 - s = spm_input('which session','+1','n1',[],s); - end - - % Get [non-parametric] trial - %-------------------------------------------------------------- - Vname = {}; - j = []; - for i = 1:length(Sess{s}.name) - Vname{end + 1} = Sess{s}.name{i}; - end - t = spm_input('which effect','+1','m',Vname); - - % Parameter estimates - %-------------------------------------------------------------- - B = beta(Sess{s}.col(Sess{s}.ind{t})); - - % plot - %-------------------------------------------------------------- - figure(Fgraph) - subplot(2,1,2) - - % second order kernel - %-------------------------------------------------------------- - if iscell(Sess{s}.bf{t}) - - Y = 0; - for i = 1:length(Sess{s}.bf{t}) - Y = Y + B(i)*Sess{s}.bf{t}{i}; - end - p = ([1:size(Y,2)] - 1)*xX.dt; - q = ([1:size(Y,1)] - 1)*xX.dt; - imagesc(p,q,Y) - axis xy - - TITLE = {'Second order Volterra Kernel' Sess{s}.name{t}}; - XLAB = 'perstimulus time (secs)'; - YLAB = 'perstimulus time (secs)'; - - % first order kernel - %-------------------------------------------------------------- - else - j = 1:size(Sess{s}.sf{t},2):length(Sess{s}.ind{t}); - Y = Sess{s}.bf{t}*B(j); - p = ([1:length(Y)] - 1)*xX.dt; - plot(p,Y) - grid on - - TITLE = {'First order Volterra Kernel' Sess{s}.name{t}}; - XLAB = 'perstimulus time (secs)'; - YLAB = ['responses',XYZstr]; - - end -end - -%-Label and call Plot UI -%---------------------------------------------------------------------- -axis square -if strcmp(get(get(gca,'Children'),'type'),'image') - axis image -end -xlabel(XLAB,'FontSize',10) -ylabel(YLAB,'FontSize',10) -title(TITLE,'FontSize',16) - -spm_results_ui('PlotUi',gca) - -% Complete return values -r_st = mars_struct('fillafromb', def_r_st, struct(... - 'Y', Y, 'y', y, 'beta', beta, 'SE', SE, 'cbeta', cbeta)); diff --git a/lib/marsbar-0.44/@mardo_99/modality.m b/lib/marsbar-0.44/@mardo_99/modality.m deleted file mode 100644 index abf2b3b..0000000 --- a/lib/marsbar-0.44/@mardo_99/modality.m +++ /dev/null @@ -1,12 +0,0 @@ -function mod_str = modality(D) -% method returns modality of design -% -% $Id$ - -SPM = des_struct(D); -try - SPM.Sess{1}; - mod_str = 'fmri'; -catch - mod_str = 'pet'; -end diff --git a/lib/marsbar-0.44/@mardo_99/private/my_design.m b/lib/marsbar-0.44/@mardo_99/private/my_design.m deleted file mode 100644 index f355cc0..0000000 --- a/lib/marsbar-0.44/@mardo_99/private/my_design.m +++ /dev/null @@ -1,12 +0,0 @@ -function tf = my_design(des) -% returns 1 if design looks like it is of SPM99 type -% -% $Id$ - -tf = 0; -if isfield(des, 'SPMid') - % Can be SPM99 design with SPM99 tag or MarsBaR tag - % (MarsBaR tag used only by MarsBaR <= 0.23) - tf = ~isempty(strmatch('SPM99', des.SPMid)) | ... - ~isempty(strmatch('MarsBar', des.SPMid)); -end diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_estimate.m b/lib/marsbar-0.44/@mardo_99/private/pr_estimate.m deleted file mode 100644 index f5462a9..0000000 --- a/lib/marsbar-0.44/@mardo_99/private/pr_estimate.m +++ /dev/null @@ -1,169 +0,0 @@ -function SPM = pr_estimate(SPM, marsY) -% Estimation of a General Linear Model -% FORMAT SPM = pr_estimate(SPM, marsY) -% Inputs -% SPM - SPM design structure -% marsY - marsY data object, or 2D data (Y) matrix -% -% Outputs -% SPM - modified estimated design structure, with data contained as -% field marsY -% -% Originally written by Jean-Baptiste Poline -% $Id$ - -%-Say hello -%----------------------------------------------------------------------- -Finter = spm('FigName','Stats: estimation...'); spm('Pointer','Watch'); - -%------------------------------------------------------------------------- -%- set the methods - -COV_estim = 'assumed'; % covariance is assumed to be imposed by filter K -GLM_resol = 'OLS'; % ordinary least square - - -%------------------------------------------------------------------------- -%- get the design structure, the filter and the data -xX = SPM.xX; -if ~isfield(xX,'X'), - error('The design does not contain a design matrix'); -end - -% allow matrix or object to be passed as input data -marsY = marsy(marsY); -Y = summary_data(marsY); -n_roi = size(Y,2); %- Y is a time by n_roi matrix - -% Remove columns with no variance -in_cols = any(diff(Y)); -if ~any(in_cols), error('No variance to estimate model'); end -Y = Y(:, in_cols); - -% We are going to ignore AR(1) options -if mars_struct('isthere', xX, 'xVi', 'Form') - if ~strcmp(xX.xVi.Form, 'none') - warning(['Sorry, we are going to ignore autocorrelation option: ' ... - xX.xVi.Form]); - end -end - -%---------------------------------------------------------------------------------- -%- Estimation of the covariance structure of the Ys -fprintf('\nEstimating covariance...'); -switch COV_estim - - case {'AR(p)'} - %- compute the temporal cov of Y (V) with AR(p) - if ~isfield(xX,'xVi') - xX.xVi = struct( 'Vi', speye(size(xX.X,1)),... - 'Form', 'AR(p)'); - end - % xX.xVi = estimate_cov(Y,xX); - - - case {'assumed'} - if ~isfield(xX,'xVi') - xX.xVi = struct( 'Vi', speye(size(xX.X,1)),... - 'Form', 'none'); - end - %- else, the covariance structure is supposed to be - %- stored in xX.xVi - - otherwise - warning('COV_estim does not exist'); -end -fprintf('Done\n'); - -switch GLM_resol - - case {'OLS'} - fprintf('Using OLS\n'); - %- no filter already defined - if ~isfield(xX,'K') - xX.K = speye(size(xX.X,1)); - end - % else assume that the filter is xX.K - - KVi = pr_spm_filter('apply', xX.K, xX.xVi.Vi); - V = pr_spm_filter('apply', xX.K, KVi'); - Y = pr_spm_filter('apply', xX.K, Y); - fprintf('Setting filter...'); - KXs = spm_sp('Set', pr_spm_filter('apply', xX.K, xX.X)); - fprintf('Done.\n'); - clear KVi; - - case {'MaxLik'} - 'MaxLik' - %- compute the inverse filter - put it in K ? - %- filter data and design - %- V = speye(size(xX.X,1)); - - otherwise - warning('GLM_resol does not exist'); -end - -%- compute GLM -fprintf('Computing estimates...'); -if ~spm_sp('isspc',KXs), Xs = spm_sp('set',KXs); else Xs = KXs; end - -[trRV trRVRV] = spm_SpUtil('trRV',Xs,V); -beta = spm_sp('x-', Xs, Y); %-Parameter estimates -res = spm_sp('r', Xs, Y); %-Residuals -ResMS = sum(res.^2)./trRV; %-Res variance estimation -xX.erdf = trRV^2/trRVRV; - -fprintf('Done.\n'); - -% fill up design related stuff -xX.V = V; %-V matrix -xX.xKXs = KXs; %-Filtered design matrix -xX.pKX = spm_sp('x-',xX.xKXs); -xX.pKXV = xX.pKX*xX.V; %-for contrast variance weight -xX.Bcov = xX.pKXV*xX.pKX'; %-Variance of est. param. -[xX.trRV,xX.trRVRV] ... %-Variance expectations - = spm_SpUtil('trRV',xX.xKXs,xX.V); -xX.nKX = spm_DesMtx('sca',xX.xKXs.X,xX.Xnames);% scaled design matrix for display - -% Put back into design -nBeta = size(xX.X, 2); -SPM.betas = ones(nBeta, n_roi) + NaN; -SPM.betas(:, in_cols) = beta; -SPM.ResidualMS = ones(1, n_roi) + NaN; -SPM.ResidualMS(in_cols) = ResMS; - -SPM.xX = xX; -SPM.marsY = marsY; - -%-Default F-contrasts (in contrast structure) -%======================================================================= -F_iX0 = []; -if isfield(SPM, 'F_iX0') - F_iX0 = SPM.F_iX0; -end -if isempty(F_iX0) - F_iX0 = struct( 'iX0', [],... - 'name', 'all effects'); -elseif ~isstruct(F_iX0) - F_iX0 = struct( 'iX0', F_iX0,... - 'name', 'effects of interest'); -end - -%-Create Contrast structure array -%----------------------------------------------------------------------- -xCon = spm_FcUtil('Set',F_iX0(1).name,'F','iX0',F_iX0(1).iX0,xX.xKXs); -for i = 2:length(F_iX0) - xcon = spm_FcUtil('Set',F_iX0(i).name,'F','iX0',F_iX0(i).iX0,xX.xKXs); - xCon = [xCon xcon]; -end -SPM.xCon = xCon; - -%======================================================================= -%- E N D: Cleanup GUI -%======================================================================= -spm_progress_bar('Clear') -spm('FigName','Stats: done',Finter); spm('Pointer','Arrow') -fprintf('%-40s: %30s\n','Completed',spm('time')) %-# -fprintf('...use the results section for assessment\n\n') %-# - -return diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_fmri_design.m b/lib/marsbar-0.44/@mardo_99/private/pr_fmri_design.m deleted file mode 100644 index 3659659..0000000 --- a/lib/marsbar-0.44/@mardo_99/private/pr_fmri_design.m +++ /dev/null @@ -1,242 +0,0 @@ -function [SPM] = pr_fmri_design(SPM) -% MarsBaR version of spm_fMRI design - asssembles a design for fMRI studies -% FORMAT [SPM] = pr_fmri_design(SPM) -% -% This file is a hardly edited version of: -% @(#)spm_fMRI_design.m 2.27 Karl Friston 99/09/29 -% See that (SPM99) version for comments etc -% -% $Id$ - -%-GUI setup -%----------------------------------------------------------------------- -SPMid = spm('SFnBanner',mfilename,marsbar('ver')); -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','fMRI stats model setup',0); -spm_help('!ContextHelp',mfilename) - -% construct Design matrix {X} - cycle over sessions -%======================================================================= - -% Initialize variables -%----------------------------------------------------------------------- -STOC = 0; - -% global parameters -%----------------------------------------------------------------------- -global fMRI_T; -global fMRI_T0; -if isempty(fMRI_T), fMRI_T = 16; end; -if isempty(fMRI_T0), fMRI_T0 = 1; end; - -% get nscan and RT -%----------------------------------------------------------------------- -spm_input('Basic parameters...',1,'d',mfilename) -RT = spm_input('Interscan interval {secs}','+1','r',[],1); -nscan = spm_input(['scans per session e.g. 64 64 64'],'+1'); -STOC = 1; -nsess = length(nscan); -dt = RT/fMRI_T; % time bin {secs} - -% separate specifications for non-relicated sessions -%----------------------------------------------------------------------- -rep = 0; -tim = 0; -if nsess > 1 - str = 'are conditions replicated'; - rep = spm_input(str,'+1','yes|no',[1 0]) - if rep & ~any(nscan - nscan(1)) - str = ['are timing/parameters the same']; - tim = spm_input(str,'+1','yes|no',[1 0]); - end -end -Xx = []; -Xb = []; -Xname = {}; -Bname = {}; -Sess = {}; -for s = 1:nsess - - % set prompt string - %--------------------------------------------------------------- - if tim - Fstr = 'All sessions'; - else - Fstr = sprintf('Session %d/%d',s,nsess); - end - - % Event/epoch related responses - %=============================================================== - k = nscan(s); - - % specify event/epoch onsets {SF} for this session - %--------------------------------------------------------------- - if (s == 1) | ~rep - - [SF,Cname,Pv,Pname,DSstr] = ... - pr_spm_get_ons(k,fMRI_T,dt,STOC,Fstr,[],[],s); - ntrial = size(SF,2); - - elseif ~tim - - [SF,Cname,Pv,Pname,DSstr] = ... - pr_spm_get_ons(k,fMRI_T,dt,STOC,Fstr,ntrial,Cname,s); - end - - % get basis functions for this session - %--------------------------------------------------------------- - if (s == 1) | ~rep - - % get basis functions for responses - %------------------------------------------------------- - [BF BFstr] = pr_spm_get_bf(Cname,fMRI_T,dt,Fstr,s); - end - - - - - % complete design matrix partition for this session - %--------------------------------------------------------------- - if (s == 1) | ~tim - - - %-Reset ContextHelp - %------------------------------------------------------- - spm_help('!ContextHelp',mfilename) - spm_input('Design matrix options...',1,'d',mfilename) - - if ~ntrial - - % declare variables - %----------------------------------------------- - ONS = {}; % onset times - PST = {}; % Peri-stimulus times - X = []; % design matrix - Xn = {}; % regressor names - IND = {}; % design matrix indices - name = {}; % condition names - - else - - % peri-stimulus {PST} and onset {ONS} (seconds) - %----------------------------------------------- - for i = 1:ntrial - on = find(SF{i}(:,1))*dt; - pst = [1:k]*RT - on(1); - for j = 1:length(on) - u = [1:k]*RT - on(j); - v = find(u >= -1); - pst(v) = u(v); - end - ONS{i} = on; - PST{i} = pst; - end - - - % convolve with basis functions - %----------------------------------------------- - str = 'interactions among trials (Volterra)'; - if spm_input(str,'+1','y/n',[1 0]) - - [X Xn IND BF name] = pr_spm_volterra(SF,BF,Cname,2); - - else - [X Xn IND BF name] = pr_spm_volterra(SF,BF,Cname,1); - end - - - % Resample design matrix {X} at acquisition times - %----------------------------------------------- - X = X([0:k-1]*fMRI_T + fMRI_T0,:); - end - - - % get user specified regressors - %======================================================= - spm_input('Other regressors',1,'d',Fstr) - D = []; - c = spm_input('user specified regressors','+1','w1',0); - while size(D,2) < c - str = sprintf('regressor %i',size(D,2) + 1); - D = [D spm_input(str,2,'e',[],[k Inf])]; - end - if c & length(DSstr) - DSstr = [DSstr '& user specified covariates ']; - elseif c - DSstr = 'User specified covariates '; - end - - % append regressors and names - %------------------------------------------------------- - for i = 1:size(D,2) - X = [X D(:,i)]; - str = sprintf('regressor: %i',i); - Xn{end + 1} = spm_input(['name of ' str],'+0','s',str); - end - - - - % Confounds: Session effects - %======================================================= - B = ones(k,1); - Bn{1} = sprintf('constant'); - - end - - % Session structure - %--------------------------------------------------------------- - Sess{s}.BFstr = BFstr; - Sess{s}.DSstr = DSstr; - Sess{s}.rep = tim; - Sess{s}.row = size(Xx,1) + [1:k]; - Sess{s}.col = size(Xx,2) + [1:size(X,2)]; - Sess{s}.name = name; - Sess{s}.ind = IND; - Sess{s}.bf = BF; - Sess{s}.sf = SF; - Sess{s}.pst = PST; - Sess{s}.ons = ONS; - Sess{s}.Pv = Pv; - Sess{s}.Pname = Pname; - - % Append names - %--------------------------------------------------------------- - q = length(Xname); - for i = 1:length(Xn) - Xname{q + i} = [sprintf('Sn(%i) ',s) Xn{i}]; - end - q = length(Bname); - for i = 1:length(Bn) - Bname{q + i} = [sprintf('Sn(%i) ',s) Bn{i}]; - end - - % append into Xx and Xb - %=============================================================== - [x y] = size(Xx); - [i j] = size(X); - Xx(([1:i] + x),([1:j] + y)) = spm_detrend(X); - [x y] = size(Xb); - [i j] = size(B); - Xb(([1:i] + x),([1:j] + y)) = B; - -end %- for s = 1:nsess - -% finished -%----------------------------------------------------------------------- -xX = struct( 'X', [Xx Xb],... - 'dt', dt,... - 'RT', RT,... - 'iH', [],... - 'iC', [1:size(Xx,2)],... - 'iB', [1:size(Xb,2)] + size(Xx,2),... - 'iG', [],... - 'Xnames', {[Xname Bname]}); - - -%-End -%----------------------------------------------------------------------- -fprintf('\t%-32s: ','Saving fMRI design') %-# -SPM = struct('SPMid', SPMid, ... - 'xX', xX,... - 'Sess', {Sess}); -fprintf('%30s\n\n','...saved') %-# -spm_input('!DeleteInputObj') diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_get_filter.m b/lib/marsbar-0.44/@mardo_99/private/pr_get_filter.m deleted file mode 100644 index 9e2c29c..0000000 --- a/lib/marsbar-0.44/@mardo_99/private/pr_get_filter.m +++ /dev/null @@ -1,107 +0,0 @@ -function [K, LFstr, HFstr] = pr_get_filter(RT, row) -% gets filter using spm_fmri_spm_ui routines -% FORMAT [K, LFstr, HFstr]= pr_get_filter(RT, row) -% or -% FORMAT [K, LFstr, HFstr]= pr_get_filter(RT, Sess) -% -% $Id$ - -if nargin < 2 - error('Need TR, row / Sess matrix'); -end - -% number of sessions -nsess = length(row); - -% rows from Sess -if isfield(row{1}, 'row') - Sess = row; - for s = 1:nsess - row{s} = Sess{s}.row; - end -else - Sess = []; -end - -% copied from spm_fmri_spm_ui -BM = 0; - -% High-pass filtering -%----------------------------------------------------------------------- -if BM - cLF = 'none'; -else - cLF = spm_input('High-pass filter?','+1','b','none|specify'); -end -switch cLF - - case 'specify' - - if ~isempty(Sess) - % default based on peristimulus time - % param = cut-off period (max = 512, min = 32) - %--------------------------------------------------------------- - HParam = 512*ones(1,nsess); - for i = 1:nsess - for j = 1:length(Sess{i}.pst) - HParam(i) = min([HParam(i) 2*max(RT + Sess{i}.pst{j})]); - end - end - HParam = ceil(HParam); - HParam(HParam < 32) = 32; - else % don't have SPM to work from - HParam = 120 * ones(1,nsess); - end - str = 'session cutoff period (secs)'; - HParam = spm_input(str,'+1','e',HParam,[1 nsess]); - - % LF description - %--------------------------------------------------------------- - LFstr = sprintf('[min] Cutoff period %d seconds',min(HParam)); - - case 'none' - %--------------------------------------------------------------- - HParam = cell(1,nsess); - LFstr = cLF; - -end - - -% Low-pass filtering -%----------------------------------------------------------------------- -if BM - cHF = 'none'; -else - cHF = spm_input('Low-pass filter?','+1','none|Gaussian|hrf'); - - -end -switch cHF - - case 'Gaussian' - %--------------------------------------------------------------- - LParam = spm_input('Gaussian FWHM (secs)','+1','r',4); - HFstr = sprintf('Gaussian FWHM %0.1f seconds',LParam); - LParam = LParam/sqrt(8*log(2)); - - case {'hrf', 'none'} - %--------------------------------------------------------------- - LParam = []; - HFstr = cHF; - -end - -% create filter struct and band-pass specification -%----------------------------------------------------------------------- -for i = 1:nsess - K{i} = struct( 'HChoice', cLF,... - 'HParam', HParam(i),... - 'LChoice', cHF,... - 'LParam', LParam,... - 'row', row{i},... - 'RT', RT); -end - -% Construct K struct -%======================================================================= -K = pr_spm_filter('set',K); diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_spm_filter.m b/lib/marsbar-0.44/@mardo_99/private/pr_spm_filter.m deleted file mode 100644 index 4e77315..0000000 --- a/lib/marsbar-0.44/@mardo_99/private/pr_spm_filter.m +++ /dev/null @@ -1,180 +0,0 @@ -function [vargout] = pr_spm_filter(Action,K,Y) -% contruct and/or apply high and/or low pass filter -% Copied from spm_filter.m for SPM99. -% FORMAT [K] = spm_filter('set' ,K) -% FORMAT [Y] = spm_filter('apply',K,Y) -% FORMAT [Y] = spm_filter('high' ,K,Y) -% FORMAT [Y] = spm_filter('low' ,K,Y) -% -% Action - 'set' fills in filter structure K -% Action - 'apply' applies K to Y = K*Y -% Action - 'high' only high-pass component -% Action - 'low ' only low-pass component -% K - filter convolution matrix or: -% K{s} - cell of structs containing session-specific specifications -% -% K{s}.RT - repeat time in seconds -% K{s}.row - row of Y constituting session s -% K{s}.LChoice - Low-pass filtering {'hrf' 'Gaussian' 'none'} -% K{s}.LParam - Gaussian parameter in seconds -% K{s}.HChoice - High-pass filtering {'specify' 'none'} -% K{s}.HParam - cut-off period in seconds -% -% K{s}.HP - low frequencies to be removed -% K{s}.LP - sparse toepltz low-pass convolution matrix -% -% Y - data matrix -% -% K - filter structure -% Y - filtered data K.K*Y -%___________________________________________________________________________ -% -% spm_filter implements band pass filtering in an efficient way by -% using explicitly the projector matrix form of the High pass -% component. spm_filter also configures the filter structure in -% accord with the specification fields if required -%___________________________________________________________________________ -% @(#)spm_filter.m 2.5 Karl Friston 00/10/04 - - -% set or apply -%--------------------------------------------------------------------------- -switch Action - - case 'set' - %------------------------------------------------------------------- - for s = 1:length(K) - - % matrix order - %----------------------------------------------------------- - k = length(K{s}.row); - - % make low pass filter - %----------------------------------------------------------- - switch K{s}.LChoice - - case 'none' - %--------------------------------------------------- - h = 1; - d = 0; - - case 'hrf' - %--------------------------------------------------- - h = pr_spm_hrf(K{s}.RT); - h = [h; zeros(size(h))]; - g = abs(fft(h)); - h = real(ifft(g)); - h = fftshift(h)'; - n = length(h); - d = [1:n] - n/2 - 1; - - case 'Gaussian' - %--------------------------------------------------- - sigma = K{s}.LParam/K{s}.RT; - h = round(4*sigma); - h = exp(-[-h:h].^2/(2*sigma^2)); - n = length(h); - d = [1:n] - (n + 1)/2; - if n == 1, h = 1; end - - otherwise - %--------------------------------------------------- - error('Low pass Filter option unknown'); - return - - end - - % create and normalize low pass filter - %----------------------------------------------------------- - K{s}.KL = spdiags(ones(k,1)*h,d,k,k); - K{s}.KL = spdiags(1./sum(K{s}.KL')',0,k,k)*K{s}.KL; - - - % make high pass filter - %----------------------------------------------------------- - switch K{s}.HChoice - - case 'none' - %--------------------------------------------------- - K{s}.KH = []; - - case 'specify' - %--------------------------------------------------- - n = fix(2*(k*K{s}.RT)/K{s}.HParam + 1); - X = spm_dctmtx(k,n); - K{s}.KH = sparse(X(:,[2:n])); - - otherwise - %--------------------------------------------------- - error('High pass Filter option unknown'); - return - - end - - end - - % return structure - %------------------------------------------------------------------- - vargout = K; - - - case {'apply','high','low'} - %------------------------------------------------------------------- - if iscell(K) - - - % ensure requisite feild are present - %----------------------------------------------------------- - if ~isfield(K{1},'KL') - K = pr_spm_filter('set',K); - end - - for s = 1:length(K) - - % select data - %--------------------------------------------------- - y = Y(K{s}.row,:); - - % apply low pass filter - %--------------------------------------------------- - if ~strcmp(Action,'high') - KL = K{s}.KL; - if issparse(KL), KL = full(KL); end - y = KL*y; - end - - % apply high pass filter - %--------------------------------------------------- - if ~isempty(K{s}.KH) & ~strcmp(Action,'low') - KH = K{s}.KH; - if issparse(KH), KH = full(KH); end - y = y - KH*(KH'*y); - end - - % reset filtered data in Y - %--------------------------------------------------- - Y(K{s}.row,:) = y; - - end - - % K is simply a convolution matrix - %------------------------------------------------------------------- - else - if issparse(K), K = full(K); end - Y = K*Y; - end - - % return filtered data - %------------------------------------------------------------------- - vargout = Y; - - case 'none' - %------------------------------------------------------------------- - vargout = Y; - - otherwise - %------------------------------------------------------------------- - warning('Filter option unknown'); - - -end diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_spm_get_bf.m b/lib/marsbar-0.44/@mardo_99/private/pr_spm_get_bf.m deleted file mode 100644 index fb60ed5..0000000 --- a/lib/marsbar-0.44/@mardo_99/private/pr_spm_get_bf.m +++ /dev/null @@ -1,301 +0,0 @@ -function [BF,BFstr] = pr_spm_get_bf(name,T,dt,Fstr,n_s,n_c) -% creates basis functions for each trial type {i} in struct BF{i} -% FORMAT [BF BFstr] = spm_get_bf(name,T,dt,Fstr,n_s [,n_c]) -% -% name - name{1 x n} name of trials or conditions -% T - time bins per scan -% dt - time bin length {seconds} -% Fstr - Prompt string (usually indicates session) -% n_s - Session number -% n_c - Condition number (optional) -% -% BF{i} - Array of basis functions for trial type {i} -% BFstr - description of basis functions specified -%_______________________________________________________________________ -% -% spm_get_bf prompts for basis functions to model event or epoch-related -% responses. The basis functions returned are unitary and orthonormal -% when defined as a function of peri-stimulus time in time-bins. -% It is at this point that the distinction between event and epoch-related -% responses enters. -%_______________________________________________________________________ -% @(#)spm_get_bf.m 2.20 Karl Friston 01/08/22 -% -% $Id$ - - -%-GUI setup -%----------------------------------------------------------------------- -spm_help('!ContextHelp',mfilename) - -%-Condition arguments -%----------------------------------------------------------------------- -if nargin < 6, n_c = []; end - - -% if no trials -%----------------------------------------------------------------------- -n = length(name); -if ~n - BF = {}; - BFstr = 'none'; - return -end - -% determine sort of basis functions -%----------------------------------------------------------------------- -Rtype = {'events',... - 'epochs',... - 'mixed'}; -if n == 1 - Rtype = Rtype(1:2); - spm_input(name{1},1,'d',Fstr) -else - spm_input(Fstr,1,'d') -end - -Rov = spm_input('are these trials',2,'b',Rtype); -Fstr=''; - -switch Rov - - % assemble basis functions {bf} - %=============================================================== - case 'events' - - % model event-related responses - %--------------------------------------------------------------- - Ctype = { - 'hrf (alone)',... - 'hrf (with time derivative)',... - 'hrf (with time and dispersion derivatives)',... - 'basis functions (Fourier set)',... - 'basis functions (Fourier set with Hanning)',... - 'basis functions (Gamma functions)',... - 'basis functions (Gamma functions with derivatives)',... - 'basis functions (Finite Impulse Response)'}; - str = 'Select basis set'; - Cov = spm_input(str,2,'m',Ctype); - BFstr = Ctype{Cov}; - - - % create basis functions - %--------------------------------------------------------------- - if Cov == 4 | Cov == 5 - - % Windowed (Hanning) Fourier set - %------------------------------------------------------- - str = 'window length {secs}'; - pst = spm_input(str,3,'e',32); - pst = [0:dt:pst]'; - pst = pst/max(pst); - h = spm_input('order',4,'e',4); - - - % hanning window - %------------------------------------------------------- - if Cov == 4 - g = ones(size(pst)); - else - g = (1 - cos(2*pi*pst))/2; - end - - % zeroth and higher terms - %------------------------------------------------------- - bf = g; - for i = 1:h - bf = [bf g.*sin(i*2*pi*pst)]; - bf = [bf g.*cos(i*2*pi*pst)]; - end - - elseif Cov == 6 | Cov == 7 - - - % Gamma functions alone - %------------------------------------------------------- - pst = [0:dt:32]'; - dx = 0.01; - bf = spm_gamma_bf(pst); - - % Gamma functions and derivatives - %------------------------------------------------------- - if Cov == 7 - bf = [bf (spm_gamma_bf(pst - dx) - bf)/dx]; - end - - - elseif Cov == 8 - - - % Finite Impulse Response - %------------------------------------------------------- - bin = spm_input('bin size (seconds)',3,'e',2); - nb = spm_input('number of bins',4,'e',8); - - bf = kron(eye(nb),ones(round(bin/dt),1)); - - - elseif Cov == 1 | Cov == 2 | Cov == 3 - - - % hrf and derivatives - %------------------------------------------------------- - [bf p] = pr_spm_hrf(dt); - - % add time derivative - %------------------------------------------------------- - if Cov == 2 | Cov == 3 - - dp = 1; - p(6) = p(6) + dp; - D = (bf(:,1) - pr_spm_hrf(dt,p))/dp; - bf = [bf D(:)]; - p(6) = p(6) - dp; - - % add dispersion derivative - %----------------------------------------------- - if Cov == 3 - - dp = 0.01; - p(3) = p(3) + dp; - D = (bf(:,1) - pr_spm_hrf(dt,p))/dp; - bf = [bf D(:)]; - end - end - end - - - % Orthogonalize and fill in basis function structure - %--------------------------------------------------------------- - bf = pr_spm_orth(bf); - for i = 1:n - BF{i} = bf; - end - - - % assemble basis functions {bf} - %=============================================================== - case 'epochs' - - - % covariates of interest - Type - %--------------------------------------------------------------- - Ctype = {'basis functions (Discrete Cosine Set)',... - 'basis functions (Mean & exponential decay)',... - 'fixed response (Half-sine)',... - 'fixed response (Box-car)'}; - str = 'Select type of response'; - Cov = spm_input(str,2,'m',Ctype); - - BFstr = Ctype{Cov}; - - % convolve with HRF? - %--------------------------------------------------------------- - if Cov == 1 - str = 'number of basis functions'; - h = spm_input(str,3,'e',2); - end - - % convolve with HRF? - %--------------------------------------------------------------- - HRF = spm_input('convolve with hrf',3,'b','yes|no',[1 0]); - - % ask for temporal differences - %--------------------------------------------------------------- - str = 'add temporal derivatives'; - TD = spm_input(str,4,'b','yes|no',[1 0]); - - - % Assemble basis functions for each trial type - %--------------------------------------------------------------- - for i = 1:n - - str = ['epoch length {scans} for ' name{i}]; - W = spm_input(str,'+1','r','',1); - pst = [1:W*T]' - 1; - pst = pst/max(pst); - - % Discrete cosine set - %------------------------------------------------------- - if Cov == 1 - - bf = []; - for j = 0:(h - 1) - bf = [bf cos(j*pi*pst)]; - end - - % Mean and exponential - %------------------------------------------------------- - elseif Cov == 2 - - bf = [ones(size(pst)) exp(-pst/4)]; - - % Half sine wave - %------------------------------------------------------- - elseif Cov == 3 - - bf = sin(pi*pst); - - % Box car - %------------------------------------------------------- - elseif Cov == 4 - - bf = ones(size(pst)); - - end - - % convolve with hemodynamic response function - hrf - %------------------------------------------------------- - if HRF - hrf = pr_spm_hrf(dt); - [p q] = size(bf); - D = []; - for j = 1:q - D = [D conv(bf(:,j),hrf)]; - end - bf = D; - end - - % add temporal differences if specified - %------------------------------------------------------- - if TD - bf = [bf [diff(bf); zeros(1,size(bf,2))]/dt]; - end - - % Orthogonalize and fill in Sess structure - %------------------------------------------------------- - BF{i} = pr_spm_orth(bf); - end - - - % mixed event and epoch model - %=============================================================== - case 'mixed' - for i = 1:n - BF(i) = pr_spm_get_bf(name(i),T,dt,'',n_s,i); - end - BFstr = 'mixed'; -end - - - -%======================================================================= -%- S U B - F U N C T I O N S -%======================================================================= - - -% compute Gamma functions functions -%----------------------------------------------------------------------- -function bf = spm_gamma_bf(u) -% returns basis functions used for Volterra expansion -% FORMAT bf = spm_gamma_bf(u); -% u - times {seconds} -% bf - basis functions (mixture of Gammas) -%_______________________________________________________________________ -u = u(:); -bf = []; -for i = 2:4 - m = 2^i; - s = sqrt(m); - bf = [bf spm_Gpdf(u,(m/s)^2,m/s^2)]; -end diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_spm_get_ons.m b/lib/marsbar-0.44/@mardo_99/private/pr_spm_get_ons.m deleted file mode 100644 index e0a75df..0000000 --- a/lib/marsbar-0.44/@mardo_99/private/pr_spm_get_ons.m +++ /dev/null @@ -1,437 +0,0 @@ -function [sf,Cname,Pv,Pname,DSstr] = pr_spm_get_ons(k,T,dt,STOC,Fstr,v,Cname,s) -% returns onset times for events -% FORMAT [sf,Cname,Pv,Pname,DSstr] = spm_get_ons(k,T,dt,STOC,Fstr,v,Cname,s) -% -% k - number of scans -% T - time bins per scan -% dt - time bin length (secs) -% STOC - flag to enable stochastic designs [0 or 1] -% Fstr - Prompt string (usually indicates session) -% v - number of conditions or trials : can be empty -% Cname - {1 x v} cell of names for each condition : can be empty -% s - session number (used by batch system) -% -% sf - {1 x n} cell of stick function matrices -% Cname - {1 x n} cell of names for each condition -% Pv - {1 x n} cell of parametric vectors -% Pname - {1 x n} cell of names for each parameter -% DSstr - Design string -%_______________________________________________________________________ -% -% spm_get_ons contructs a cell of sparse delta functions specifying the -% onset of events or epochs (or both). These are convolved with a basis set -% at a later stage to give regressors that enter into the design matrix. -% Interactions of evoked responses with some parameter (time or a specified -% variate Pv) enter at this stage as additional columns in sf with each delta -% function multiplied by the [expansion of the] trial-specific parameter. -% If parametric modulation is modeled, P contains the original variate and -% Pname is its name. Otherwise Pv{i} = [] and Pname{i} = ''; -% -% Notes on responding to questions: -% -% 'number of conditions or trials': The number of conditions, trials, -% events or epochs in the design. Generally the baseline condition -% (epoch-related) or null event (event-related) should not be included -% e.g. for a simple ABABAB.. design enter 1 -% -% STOCHASTIC DESIGNS -% -% 'stochastic design': If you want a random design select yes. The ensuing -% design matrix and onset times in Sess are then used in -% subsequent analysis of the data and stimulus design respectively. -% -% 'include a null event': for stochastic designs a null event should -% be included if you want to estimate responses common to -% all trial types -% -% 'SOA (scans)': Stimulus onset asynchrony for the sucessive occurrence -% of trials. This is the time (in scans) between the onset -% of sucessive stimuli or trials (usually a fraction of a scan) -% -% 'relative frequency [trial 1,..n null]': Enter a vector with a -% relative frequency of presentation for each trial type -% (and the null event if included). The null event is last. -% The most efficient designs are given when all the frequencies -% are equal. -% -% 'stationary|modulated': If the occurence probabilities are -% the same for all scans then choose 'stationary'. Modulated -% designs are more efficient but entail 'runs' of the -% same trial type. -% -% NON STOCHASTIC DESIGNS -% -% 'Fixed|Variable': If the event of epoch starts with a fixed -% SOA choose 'Fixed'. If the SOA changes within any trial type -% choose variable. -% -% 'vector of onsets (scans) for trial n': If the SOA are variable -% you have to enter a vector of onet times for each event or -% epoch. Time is specified in terms of scans, where the -% start of the session begins at 0. -% -% 'variable durations'. If you want to model trains of -% onsets then select 'yes'. You will then be prompted for -% a vector of durations for each onset. This is useful when -% modeling short epochs of variable duration. -% -% 'SOA (scans)' and 'first trial (scans)': If the SOA is fixed you -% only have to specify what it is and when the first condition -%ses in terms of an interaction with the specified -% variate. -% -% SLCIE TIMIING -% -% With longs TRs you may want to shift the regressors so that they are -% aligned to a particular slice. This is effected by resetting the -% values of fMRI_T and fMRI_T0 in som_defaults. fMRI_T is the number of -% time-bins per scan used when building regressors. Onsets are defined -% in temporal units of scans starting at 0. fMRI_T0 is the first -% time-bin at which the regressors are resampled to coincide with data -% acquisition. If fMRI_T0 = 1 then the regressors will be appropriate -% for the first slice. If you want to temporally realign the regressors -% so that they match responses in the middle slice then make fMRI_T0 = -% fMRI_T/2 (assuming there is a negligible gap between volume -% acquisitions. Default values are fMRI_T = 16 and fMRI_T0 = 1. -% -% -%_______________________________________________________________________ -% @(#)spm_get_ons.m 2.30 Karl Friston 01/03/22 - -%-GUI setup -%----------------------------------------------------------------------- -spm_help('!ContextHelp',mfilename) - - -%-Condition arguments -%----------------------------------------------------------------------- -if nargin < 5, Fstr = ''; end -spm_input(Fstr,1,'d') - - -% initialize variables -%----------------------------------------------------------------------- -sf = {}; -Pv = {}; -Pname = {}; -DSstr = ''; -%-------- -sillyvar=0; - - -% get stick functions {ons} and names -%======================================================================= - - -% get trials -%----------------------------------------------------------------------- -if isempty(v) - v = spm_input('number of conditions or trials',2,'w1'); -end -if isempty(Cname) - Cname = {}; - for i = 1:v - % get names - %--------------------------------------------------------------- - str = sprintf('name for condition/trial %d ?',i); - Cname{i} = spm_input(str,3,'s',sprintf('trial %d',i)); - end -end - - - -% event/epoch-related responses -%----------------------------------------------------------------------- -if v - - - % stochastic designs - %--------------------------------------------------------------- - spm_input('Trial specification...',1,'d',Fstr) - if STOC - STOC = spm_input('stochastic design','+1','y/n',[1 0]); - end - if STOC - - - % minimum SOA - %------------------------------------------------------- - ne = spm_input('include a null event','+1','y/n',[1 0]); - soa = spm_input('SOA (scans)','+1','r',2)*T; - on = fix(1:soa:(k*T)); - ns = length(on); - DSstr = [DSstr sprintf('Stochastic: %.2fsec SOA ',soa*dt)]; - - - % occurence probabilities - stationary - %------------------------------------------------------- - if ne - str = sprintf('relative frequency [trial 1,..%d null]',v); - else - str = sprintf('relative frequency [trial 1,..%d]',v); - end - P = ones(1,(v + ne)); - P = spm_input(str,'+1','r',P,[1 (v + ne)]); - str = 'occurence probability'; - if spm_input(str,'+1','stationary|modulated',[1 0]) - DSstr = [DSstr '(stationary) ']; - P = P(:)*ones(1,ns); - - % occurence probabilities - modulated (32 sec period) - %------------------------------------------------------- - else - DSstr = [DSstr '(modulated) ']; - p = ones((v + ne),ns); - dc = 32/dt; - for i = 1:(v + ne); - q = sin(2*pi*(on/dc + (i - 1)/(v + ne))); - p(i,:) = 1 + q; - end - P = diag(P)*p; - end - - - % assign trials - %------------------------------------------------------- - P = [zeros(1,ns); cumsum(P)]; - P = P*diag(1./max(P)); - q = zeros(size(on)); - Q = rand(size(on)); - for i = 1:(v + ne); - j = find(Q >= P(i,:) & Q < P(i + 1,:)); - q(j) = i; - end - - - % create stick functions - %------------------------------------------------------- - ons = sparse(on,q,1,k*T,v + ne); - - - % stick function array (and delete null event) - %------------------------------------------------------- - for i = 1:v - sf{i} = full(ons(:,i)); - end - - - % non-stochastic designs - %--------------------------------------------------------------- - else - - - % get onsets - %----------------------------------------------------------- - Sstr = spm_input('SOA',2,'Fixed|Variable'); - DSstr = [DSstr Sstr ' SOA ']; - i = 1; - while i <= v - - - % get onsets - %------------------------------------------------------- - switch Sstr - - - case 'Fixed' - %- In batch mode, Sstr is always 'Variable' - %----------------------------------------------- - str = ['SOA (scans) for ' Cname{i}]; - soa = spm_input(str,3,'r'); - on = spm_input('time to 1st trial (scans)',4,'r',0); - on = {on:soa:k}; - dur = {zeros(size(on{1}))}; - - - case 'Variable' - %----------------------------------------------- - str = ['vector of onsets (scans) - ' Cname{i}]; - on = spm_input(str,3); - if ~iscell(on), on = {on}; end - - % get durationa - %----------------------------------------------- - dur = {}; - for j = 1:length(on) - dur{j} = zeros(size(on{j})); - if length(on) == 1 - str = 'variable durations'; - if spm_input(str,'+1','y/n',[1 0],2) - dur{j} = spm_input('durations (scans)',... - '+1','e',[],[1 length(on{j})]); - dur{j} = round(dur{j}*T); - end - end - end - - - end - - - % create stick functions - %----------------------------------------------- - for j = 1:length(on) - ons = sparse(k*T,1); - for p = 1:length(on{j}) - q = round(on{j}(p)*T + 1); - ons(q:(q + dur{j}(p))) = 1; - end - sf{i} = ons(1:(k*T)); - i = i + 1; - end - - - end - end - - - - % get parameters, contruct interactions and append - %================================================================ - spm_input('Parametric specification...','+1','d',Fstr) - - - % paramteric representation of causes - defaults for main effects - %---------------------------------------------------------------- - for i = 1:v - Pv{i} = []; - Pname{i} = ''; - end - - - % get parameter type - %---------------------------------------------------------------- - Ptype = {'none',... - 'time',... - 'other'}; - Ptype = spm_input('parametric modulation','+1','b',Ptype); - switch Ptype - - - case 'none' - %-------------------------------------------------------- - return - - - case 'other' - %-------------------------------------------------------- - Pstr = spm_input('name of parameter','+1','s'); - - - case 'time' - %-------------------------------------------------------- - Pstr = Ptype; - end - - - % get parameters of expansion - %---------------------------------------------------------------- - Etype = {'linear',... - 'exponen',... - 'polynom'}; - Etype = spm_input('expansion','+1','b',Etype); - DSstr = [DSstr '[ x ' Pstr ' (' Etype ')] ']; - switch Etype - - - case 'exponen' - %-------------------------------------------------------- - if strcmp(Ptype,'time') - h = round(k*T*dt/4); - h = spm_input('time constant {secs}','+1','r',h); - - - else - h = spm_input('decay constant','+1','r'); - end - - - case 'polynom' - %-------------------------------------------------------- - str = 'order of polynomial expansion'; - h = spm_input(str,'+1','r',2); - - - end - - - - % cycle over selected trial types - %---------------------------------------------------------------- - str = sprintf('which trial[s] 1 to %d',v); - Ypos = spm_input('!NextPos'); - - - for i = spm_input(str,'+1','e',1) - %----------------- - sillyvar=sillyvar+1; - spm_input(Cname{i},Ypos,'d',Fstr); - on = find(sf{i}(:,1)); - ns = length(on); - - - % get parameters - %------------------------------------------------------- - switch Ptype - - - case 'other' - %----------------------------------------------- - str = ['parameters for ' Cname{i}]; - p = spm_input(str,'+1','r',[],[ns,1]); - - - case 'time' - %----------------------------------------------- - p = on*dt; - - - end - - - % expansion - %-------------------------------------------------------- - switch Etype - - - - case 'polynom' - %------------------------------------------------ - u = spm_detrend(p(:)); - v = zeros(size(u,1),h + 1); - q = sparse(size(sf{i},1),h); - for j = 0:h - v(:,(j + 1)) = (u.^j) - v*(pinv(v)*(u.^j)); - end - for j = 1:h - u = v(:,(j + 1)); - q(:,j) = sparse(on,1,u,size(sf{i},1),1); - end - - - case 'exponen' - %------------------------------------------------ - q = exp(-p/h); - q = spm_detrend(q(:)); - q = sparse(on,1,q,size(sf{i},1),1); - - - case 'linear' - %------------------------------------------------ - q = spm_detrend(p(:)); - q = sparse(on,1,q,size(sf{i},1),1); - - - - end - - - % append as modulated stick functions - %-------------------------------------------------------- - sf{i} = [sf{i} q]; - Pv{i} = p; - Pname{i} = Pstr; - - - end -end diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_spm_hrf.m b/lib/marsbar-0.44/@mardo_99/private/pr_spm_hrf.m deleted file mode 100644 index 43bb900..0000000 --- a/lib/marsbar-0.44/@mardo_99/private/pr_spm_hrf.m +++ /dev/null @@ -1,40 +0,0 @@ -function [hrf,p] = pr_spm_hrf(RT,P); -% returns a hemodynamic response function -% FORMAT [hrf,p] = pr_spm_hrf(RT,[p]); -% RT - scan repeat time -% p - parameters of the response function (two gamma functions) -% -% defaults -% (seconds) -% p(1) - delay of response (relative to onset) 6 -% p(2) - delay of undershoot (relative to onset) 16 -% p(3) - dispersion of response 1 -% p(4) - dispersion of undershoot 1 -% p(5) - ratio of response to undershoot 6 -% p(6) - onset (seconds) 0 -% p(7) - length of kernel (seconds) 32 -% -% hrf - hemodynamic response function -% p - parameters of the response function -%_______________________________________________________________________ -% @(#)spm_hrf.m 2.7 Karl Friston 99/05/17 - -% global parameter -%----------------------------------------------------------------------- -global fMRI_T; -if isempty(fMRI_T), fMRI_T = 16; end; - -% default parameters -%----------------------------------------------------------------------- -p = [6 16 1 1 6 0 32]; -if nargin > 1 - p(1:length(P)) = P; -end - -% modelled hemodynamic response function - {mixture of Gammas} -%----------------------------------------------------------------------- -dt = RT/fMRI_T; -u = [0:(p(7)/dt)] - p(6)/dt; -hrf = spm_Gpdf(u,p(1)/p(3),dt/p(3)) - spm_Gpdf(u,p(2)/p(4),dt/p(4))/p(5); -hrf = hrf([0:(p(7)/RT)]*fMRI_T + 1); -hrf = hrf'/sum(hrf); diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_spm_orth.m b/lib/marsbar-0.44/@mardo_99/private/pr_spm_orth.m deleted file mode 100644 index 99f657a..0000000 --- a/lib/marsbar-0.44/@mardo_99/private/pr_spm_orth.m +++ /dev/null @@ -1,21 +0,0 @@ -function bf = pr_spm_orth(BF) -% recursive orthogonalization of basis functions -% FORMAT bf = pr_spm_orth(bf) -% -% From spm_get_bf.m, see that file for credits -% -% $Id$ - -if nargin < 1 - error('Need BF'); -end - -bf = BF(:,1); -bf = bf/sqrt(mean(bf.^2)); -for i = 2:size(BF,2) - D = BF(:,i); - D = D - bf*(pinv(bf)*D); - if any(D) - bf = [bf D/sqrt(mean(D.^2))]; - end -end diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_spm_ui.m b/lib/marsbar-0.44/@mardo_99/private/pr_spm_ui.m deleted file mode 100644 index c4a13af..0000000 --- a/lib/marsbar-0.44/@mardo_99/private/pr_spm_ui.m +++ /dev/null @@ -1,1329 +0,0 @@ -function varargout=pr_spm_ui(varargin) -% MarsBaR: setting up the general linear model for independent data -% -% MarsBaR version copied with minor edits from: -% 99/11/15 Andrew Holmes @(#)spm_spm_ui.m 2.33 -% See that file for comments and help -% -% $Id$ - -%-Condition arguments -%----------------------------------------------------------------------- -if (nargin==0), Action = 'CFG'; else, Action = varargin{1}; end - -% For selecting images, later -img_flt = mars_veropts('get_img_ext'); - -switch lower(Action), case 'cfg' -%======================================================================= -% - C O N F I G U R E D E S I G N -%======================================================================= -% pr_spm_ui('CFG',D) -if nargin<2, D = []; else, D = varargin{2}; end - -%-GUI setup -%----------------------------------------------------------------------- -SPMid = spm('SFnBanner',mfilename,marsbar('ver')); -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Stats: Setup analysis',0); -spm_help('!ContextHelp',mfilename) - -%-Option definitions -%----------------------------------------------------------------------- -%-Generic factor names -sF = {'sF1','sF2','sF3','sF4'}; - -%-Covariate by factor interaction options -sCFI = {'';... %-1 - 'with sF1';'with sF2';'with sF3';'with sF4';... %-2:5 - 'with sF2 (within sF4)';'with sF3 (within sF4)'}; %-6,7 - -%-DesMtx argument components for covariate by factor interaction options -% (Used for CFI's Covariate Centering (CC), GMscale & Global normalisation) -CFIforms = { '[]', 'C', '{}';... %-1 - 'I(:,1)', 'FxC', '{D.sF{1}}';... %-2 - 'I(:,2)', 'FxC', '{D.sF{2}}';... %-3 - 'I(:,3)', 'FxC', '{D.sF{3}}';... %-4 - 'I(:,4)', 'FxC', '{D.sF{4}}';... %-5 - 'I(:,[4,2])', 'FxC', '{D.sF{4},D.sF{2}}';... %-6 - 'I(:,[4,3])', 'FxC', '{D.sF{4},D.sF{3}}' }; %-7 - -%-Centre (mean correction) options for covariates & globals (CC) -% (options 9-12 are for centering of global when using AnCova GloNorm) (GC) -sCC = { 'around overall mean';... %-1 - 'around sF1 means';... %-2 - 'around sF2 means';... %-3 - 'around sF3 means';... %-4 - 'around sF4 means';... %-5 - 'around sF2 (within sF4) means';... %-6 - 'around sF3 (within sF4) means';... %-7 - '';... %-8 - 'around user specified value';... %-9 - '(as implied by AnCova)';... %-10 - 'GM';... %-11 - '(redundant: not doing AnCova)'}'; %-12 -%-DesMtx I forms for covariate centering options -CCforms = {'ones(nScan,1)',CFIforms{2:end,1},''}'; - - -%-Global normalization options (options 1-7 match CFIforms) (GloNorm) -sGloNorm = { 'AnCova';... %-1 - 'AnCova by sF1';... %-2 - 'AnCova by sF2';... %-3 - 'AnCova by sF3';... %-4 - 'AnCova by sF4';... %-5 - 'AnCova by sF2 (within sF4)';... %-6 - 'AnCova by sF3 (within sF4)';... %-7 - 'proportional scaling';... %-8 - ''}; %-9 - -%-Grand mean scaling options (GMsca) -sGMsca = { 'scaling of overall grand mean';... %-1 - 'scaling of sF1 grand means';... %-2 - 'scaling of sF2 grand means';... %-3 - 'scaling of sF3 grand means';... %-4 - 'scaling of sF4 grand means';... %-5 - 'scaling of sF2 (within sF4) grand means';... %-6 - 'scaling of sF3 (within sF4) grand means';... %-7 - '(implicit in PropSca global normalisation)';... %-8 - '' }; %-9 -%-NB: Grand mean scaling by subject is redundent for proportional scaling - - -%-Global calculation options (GXcalc) -sGXcalc = { 'omit';... %-1 - 'user specified';... %-2 - 'mean voxel value (within per image fullmean/8 mask)'}; %-3 - - - -%======================================================================= -%-D E S I G N P A R A M E T E R S -%======================================================================= -%-Get design type -%----------------------------------------------------------------------- -nVar = 1; -if isempty(D) - - %-Multivariate repsonse variable? - %--------------------------------------------------------------- - if spm_input('Multivariate analysis?','+1','y/n',[1,0],2) - nVar = spm_input('number of variates?','+1','n1'); - end - - D = pr_spm_ui( ... - char(spm_input('Select design class...','+1','m',... - {'Basic stats','Standard PET designs','SPM96 PET designs'},... - {'DesDefs_Stats','DesDefs_PET','DesDefs_PET96'},2))); -end - -D = D(spm_input('Select design type...','+1','m',{D.DesName}')); - - -%-Set factor names for this design -%----------------------------------------------------------------------- -sCC = sf_estrrep(sCC,[sF',D.sF']); -sCFI = sf_estrrep(sCFI,[sF',D.sF']); -sGloNorm = sf_estrrep(sGloNorm,[sF',D.sF']); -sGMsca = sf_estrrep(sGMsca,[sF',D.sF']); - -%-Get filenames & factor indicies -%----------------------------------------------------------------------- -[P,I] = pr_spm_ui('Files&Indices',D.sF,D.n,D.b.aTime,nVar); -nScan = size(I,1); %-#obs - -%-Additional design parameters -%----------------------------------------------------------------------- -bL = any(diff(I,1),1); %-Multiple factor levels? - % NB: bL(2) might be thrown by user specified f1 levels - % (D.b.aTime & D.n(2)>1) - assumme user is consistent? -bFI = [bL(1),bL(2:3)&~bL(4),bL(4),bL([2,3])&bL(4)]; - %-Allowable interactions for covariates - %-Only offer interactions with multi-level factors, and - % don't offer by F2|F3 if bL(4)! - -%-Build Condition (H) and Block (B) partitions -%======================================================================= -eval(['[H,Hnames] = spm_DesMtx(',D.Hform,');']) -if rank(H)==nScan, error('unestimable condition effects'), end -eval(['[B,Bnames] = spm_DesMtx(',D.Bform,');']) -if rank(B)==nScan, error('unestimable block effects'), end - -%-Drop a constant H partition if B partition can model constant -if size(H,2)>0 & all(H(:)==1) & (rank([H B])==rank(B)) - H = []; Hnames = {}; - warning('Dropping redundant constant H partition') -end - - -%-Covariate partition(s): interest (C) & nuisance (G) excluding global -%======================================================================= -nC = D.nC; %-Default #covariates -C = {[],[]}; Cnames = {{},{}}; %-Covariate DesMtx partitions & names -xC = []; %-Struct array to hold raw covariates - - -dcname = {'CovInt','NusCov'}; %-Default root names for covariates -dstr = {'covariate','nuisance variable'}; - -GUIpos = spm_input('!NextPos'); -nc = [0,0]; -for i=1:2 % 1:covariates of interest, 2:nuisance variables - if isinf(nC(i)), nC(i)=spm_input(['# ',dstr{i},'s'],GUIpos,'w1'); end - - while nc(i) < nC(i) - - %-Create prompt, get covariate, get covariate name - %--------------------------------------------------------------- - if nC(i)==1, str=dstr{i}; else, str=sprintf('%s %d',dstr{i},nc(i)+1); end - c = spm_input(str,GUIpos,'r',[],[nScan,Inf]); - if any(isnan(c(:))), break, end %-NaN is dummy value to exit - nc(i) = nc(i)+1; %-#Covariates (so far) - if nC(i)>1, tstr = sprintf('%s^{%d}',dcname{i},nc(i)); - else, tstr = dcname{i}; end - cname = spm_input([str,' name?'],'+1','s',tstr); - rc = c; %-Save covariate value - rcname = cname; %-Save covariate name - - %-Interaction option? (if single covariate vector entered)? - %--------------------------------------------------------------- - if size(c,2) == 1 - if length(D.iCFI{i})>1 - %-User choice of interaction options, default is negative - %-Only offer interactions for appropriate factor combinations - iCFI = intersect(abs(D.iCFI{i}),find([1,bFI])); - dCFI = max([1,intersect(iCFI,-D.iCFI{i}(D.iCFI{i}<0))]); - iCFI = spm_input([str,': interaction?'],'+1','m',... - sCFI(iCFI),iCFI,find(iCFI==dCFI)); - else - iCFI = abs(D.iCFI{i}); %-AutoSelect default option - end - else - iCFI = 1; - end - - %-Centre covariate(s)? (Default centring to correspond to CFI) - % Always offer "no centering" as default for design matrix blocks - %--------------------------------------------------------------- - DiCC = D.iCC{i}; - if size(c,2)>1, DiCC = union(DiCC,-8); end - if length(DiCC)>1 - %-User has a choice of centering options - %-Only offer factor specific for appropriate factor combinations - iCC = intersect(abs(DiCC),find([1,bFI,1]) ); - %-Default is max -ve option in D, overridden by iCFI if CFI - if iCFI==1, dCC=-DiCC(DiCC<0); else, dCC=iCFI; end - dCC = max([1,intersect(iCC,dCC)]); - iCC = spm_input([str,': centre?'],'+1','m',... - sCC(iCC),iCC,find(iCC==dCC)); - else - iCC = abs(DiCC); %-AutoSelect default option - end - %-Centre within factor levels as appropriate - if any(iCC==[1:7]), c = c - spm_meanby(c,eval(CCforms{iCC})); end - - %-Do any interaction (only for single covariate vectors) - %--------------------------------------------------------------- - if iCFI>1 %-(NB:iCFI=1 if size(c,2)>1) - tI = [eval(CFIforms{iCFI,1}),c]; - tConst = CFIforms{iCFI,2}; - tFnames = [eval(CFIforms{iCFI,3}),{cname}]; - [c,cname] = spm_DesMtx(tI,tConst,tFnames); - elseif size(c,2)>1 %-Design matrix block - [null,cname] = spm_DesMtx(c,'X',cname); - else - cname = {cname}; - end - - %-Store raw covariate details in xC struct for reference - %-Pack c into appropriate DesMtx partition - %--------------------------------------------------------------- - %-Construct description string for covariate - str = {sprintf('%s: %s',str,rcname)}; - if size(rc,2)>1, str = {sprintf('%s (block of %d covariates)',... - str{:},size(rc,2))}; - end - if iCC<8, str=[str;{['used centered ',sCC{iCC}]}]; end - if iCFI>1, str=[str;{['fitted as interaction ',sCFI{iCFI}]}]; end - - tmp = struct( 'rc',rc, 'rcname',rcname,... - 'c',c, 'cname',{cname},... - 'iCC',iCC, 'iCFI',iCFI,... - 'type',i,... - 'cols',[1:size(c,2)] + ... - size([H,C{1}],2) + ... - size([B,C{2}],2)*(i-1),... - 'descrip',{str} ); - if isempty(xC), xC=tmp; else, xC=[xC,tmp]; end - C{i} = [C{i},c]; - Cnames{i} = [Cnames{i}; cname]; - - end % (while) - -end % (for) -clear c tI tConst tFnames -spm_input('!SetNextPos',GUIpos); - -%-Unpack into C & G design matrix sub-partitions -G = C{2}; Gnames = Cnames{2}; -C = C{1}; Cnames = Cnames{1}; - - -%-Options... -%======================================================================= -%-Global normalization options (GloNorm) -%----------------------------------------------------------------------- -if length(D.iGloNorm)>1 - %-User choice of global normalisation options, default is negative - %-Only offer factor specific for appropriate factor combinations - iGloNorm = intersect(abs(D.iGloNorm),find([1,bFI,1,1])); - dGloNorm = max([0,intersect(iGloNorm,-D.iGloNorm(D.iGloNorm<0))]); - iGloNorm = spm_input('GloNorm: Select global normalisation','+1','m',... - sGloNorm(iGloNorm),iGloNorm,find(iGloNorm==dGloNorm)); -else - iGloNorm = abs(D.iGloNorm); -end - - -%-Grand mean scaling options (GMsca) -%----------------------------------------------------------------------- -if iGloNorm==8 - iGMsca=8; %-grand mean scaling implicit in PropSca GloNorm -elseif length(D.iGMsca)==1 - iGMsca = abs(D.iGMsca); -else - %-User choice of grand mean scaling options - %-Only offer factor specific for appropriate factor combinations - iGMsca = intersect(abs(D.iGMsca),find([1,bFI,0,1])); - %-Default is max -ve option in D, overridden by iGloNorm if AnCova - if iGloNorm==9, dGMsca=-D.iGMsca(D.iGMsca<0); else, dGMsca=iGloNorm; end - dGMsca = max([0,intersect(iGMsca,dGMsca)]); - iGMsca = spm_input('GMsca: grand mean scaling','+1','m',... - sGMsca(iGMsca),iGMsca,find(iGMsca==dGMsca)); -end - - -%-Value for PropSca / GMsca (GM) -%----------------------------------------------------------------------- -if iGMsca == 9 %-Not scaling (GMsca or PropSca) - GM = 0; %-Set GM to zero when not scaling -else %-Ask user value of GM - if iGloNorm==8 - str = 'PropSca global mean to'; - else - str = [strrep(sGMsca{iGMsca},'scaling of','scale'),' to']; - end - GM = spm_input(str,'+1','r',D.GM,1); - %-If GM is zero then don't GMsca! or PropSca GloNorm - if GM==0, iGMsca=9; if iGloNorm==8, iGloNorm=9; end, end -end - -%-Sort out description strings for GloNorm and GMsca -%----------------------------------------------------------------------- -sGloNorm = sGloNorm{iGloNorm}; -sGMsca = sGMsca{iGMsca}; -if iGloNorm==8 - sGloNorm = sprintf('%s to %-4g',sGloNorm,GM); -elseif iGMsca<8 - sGMsca = sprintf('%s to %-4g',sGMsca,GM); -end - - -%-Global centering (for AnCova GloNorm) (GC) -%----------------------------------------------------------------------- -%-Specify the centering option for the global covariate for AnCova -%-Basically, if 'GMsca'ling then should centre to GM (iGC=11). Otherwise, -% should centre in similar fashion to AnCova (i.e. by the same factor(s)), -% such that models are seperable (iGC=10). This is particularly important -% for subject specific condition effects if then passed on to a second-level -% model. (See also spm_adjmean_ui.m) SPM96 (& earlier) used to just centre -% GX around its (overall) mean (iGC=1). - -%-This code allows more general options to be specified (but is a bit complex) -%-Setting D.iGC=[-10,-11] gives the standard choices above - -%-If not doing AnCova then GC is irrelevant -if ~any(iGloNorm==[1:7]) - iGC = 12; - gc = []; -else - %-Annotate options 10 & 11 with specific details - %--------------------------------------------------------------- - %-Tag '(as implied by AnCova)' with actual AnCova situation - sCC{10} = [sCC{iGloNorm},' (<= ',sGloNorm,')']; - %-Tag 'GM' case with actual GM & GMsca case - sCC{11} = sprintf('around GM=%g (i.e. %s after grand mean scaling)',... - GM,strrep(sCC{iGMsca},'around ','')); - - %-Constuct vector of allowable iGC - %--------------------------------------------------------------- - %-Weed out redundent factor combinations from pre-set allowable options - iGC = intersect(abs(D.iGC),find([1,bFI,1,1,1,1])); - %-Omit 'GM' option if didn't GMsca (iGMsca~=8 'cos doing AnCova) - if any(iGMsca==[8,9]), iGC = setdiff(iGC,11); end - %-Omit 'GM' option if same as '(as implied by AnCova)' - if iGloNorm==iGMsca, iGC = setdiff(iGC,11); end - - %-If there's a choice, set defaults (if any), & get answer - %--------------------------------------------------------------- - if length(iGC)>1 - dGC = max([0,intersect(iGC,-D.iGC(D.iGC<0))]); - str = 'Centre global covariate'; - if iGMsca<8, str = [str,' (after grand mean scaling)']; end - iGC = spm_input(str,'+1','m',sCC(iGC),iGC,find(iGC==dGC)); - elseif isempty(iGC) - error('Configuration error: empty iGC') - end - - %-If 'user specified' then get value - %--------------------------------------------------------------- - if iGC==9 - gc = spm_input('Centre globals around','+0','r',D.GM,1); - sCC{9} = sprintf('%s of %g',sCC{iGC},gc); - else - gc = 0; - end -end - - -%-Thresholds & masks defining voxels to analyse (MASK) -%======================================================================= -GUIpos = spm_input('!NextPos'); - -%-Analysis threshold mask -%----------------------------------------------------------------------- -%-Work out available options: -% -Inf=>None, complex=>proportional, real=>absolute (i.e. times global) -M_T = D.M_.T; if isempty(M_T), M_T = [-Inf, 100, 0.8*sqrt(-1)]; end -M_T = { 'none', M_T(min(find(isinf(M_T))));... - 'absolute', M_T(min(find(isfinite(M_T)&(M_T==real(M_T)))));... - 'prop''nal', M_T(min(find(isfinite(M_T)&(M_T~=real(M_T))))) }; - -%-Work out available options -%-If there's a choice between proportional and absolute then ask -%----------------------------------------------------------------------- -q = ~[isempty(M_T{1,2}), isempty(M_T{2,2}), isempty(M_T{3,2})]; - -if all(q(2:3)) - tmp = spm_input('Threshold masking',GUIpos,'b',M_T(q,1),find(q)); - q(setdiff([1:3],tmp))=0; -end - -%-Get mask value - note that at most one of q(2:3) is true -%----------------------------------------------------------------------- -if ~any(q) %-Oops - nothing specified! - M_T = -Inf; -elseif all(q==[1,0,0]) %-no threshold masking - M_T = -Inf; -else %-get mask value - if q(1), args = {'br1','None',-Inf,abs(M_T{1+find(q(2:3)),2})}; - else, args = {'r',abs(M_T{1+find(q(2:3)),2})}; end - if q(2) - M_T = spm_input('analysis threshold',GUIpos,args{:}); - elseif q(3) - M_T = spm_input('analysis thresh (prop''n of global)',GUIpos,... - args{:}); - if isfinite(M_T) & isreal(M_T), M_T=M_T*sqrt(-1); end - else - error('Shouldn''t get here!') - end -end - -%-Make a description string -%----------------------------------------------------------------------- -if isinf(M_T) - xsM.Analysis_threshold = 'None (-Inf)'; -elseif isreal(M_T) - xsM.Analysis_threshold = sprintf('images thresholded at %6g',M_T); -else - xsM.Analysis_threshold = sprintf(['images thresholded at %6g ',... - 'times global'],imag(M_T)); -end - - -%-Implicit masking: Ignore zero voxels in low data-types? -%----------------------------------------------------------------------- -% (Implicit mask is NaN in higher data-types.) -type = mars_vol_utils('type', spm_vol(P{1,1})); -if ~spm_type(type,'nanrep') - switch D.M_.I - case Inf, M_I = spm_input('Implicit mask (ignore zero''s)?',... - '+1','y/n',[1,0],1); %-Ask - case {0,1}, M_I = D.M_.I; %-Pre-specified - otherwise, error('unrecognised D.M_.I type') - end - - if M_I, xsM.Implicit_masking = 'Yes: zero''s treated as missing'; - else, xsm.Implicit_masking = 'No'; end -else - M_I = 1; - xsM.Implicit_masking = 'Yes: NaN''s treated as missing'; -end - - -%-Explicit mask images (map them later...) -%----------------------------------------------------------------------- -switch(D.M_.X) -case Inf, M_X = spm_input('explicitly mask images?','+1','y/n',[1,0],2); -case {0,1}, M_X = D.M_.X; -otherwise, error('unrecognised D.M_.X type') -end -if M_X, M_P = spm_get(Inf,img_flt,{'select mask images'}); else, M_P = {}; end - - -%-Global calculation (GXcalc) -%======================================================================= -iGXcalc = abs(D.iGXcalc); -%-Only offer "omit" option if not doing any GloNorm, GMsca or PropTHRESH -if ~(iGloNorm==9 & iGMsca==9 & (isinf(M_T)|isreal(M_T))) - iGXcalc = intersect(iGXcalc,[2:size(sGXcalc,1)]); -end -if isempty(iGXcalc) - error('no GXcalc options') -elseif length(iGXcalc)>1 - %-User choice of global calculation options, default is negative - dGXcalc = max([1,intersect(iGXcalc,-D.iGXcalc(D.iGXcalc<0))]); - iGXcalc = spm_input('Global calculation','+1','m',... - sGXcalc(iGXcalc),iGXcalc,find(iGXcalc==dGXcalc)); -else - iGXcalc = abs(D.iGXcalc); -end - -if iGXcalc==2 %-Get user specified globals - g = spm_input('globals','+0','r',[],[nScan,nVar]); -end -sGXcalc = sGXcalc{iGXcalc}; - - -%======================================================================= -% - C O N F I G U R E D E S I G N -%======================================================================= -spm('FigName','Stats: configuring',Finter,CmdLine); -spm('Pointer','Watch'); - - -%-Images & image info: Map Y image files and check consistency of -% dimensions and orientation / voxel size -%======================================================================= -fprintf('%-40s: ','Mapping files') %-# -for i = 1:nVar - VY(:,i) = spm_vol(char(P{:,i})); -end - -%-Check compatability of images -%----------------------------------------------------------------------- -[samef msg] = mars_vol_check(VY); -if ~samef, disp(char(msg)),error('Cannot use images'),end; - -fprintf('%30s\n','...done') %-# - - -%-Global values, scaling and global normalisation -%======================================================================= -%-Compute global values -%----------------------------------------------------------------------- -switch iGXcalc, case 1 - %-Don't compute => no GMsca (iGMsca==9) or GloNorm (iGloNorm==9) - g = []; -case 2 - %-User specified globals -case 3 - %-Compute as mean voxel value (within per image fullmean/8 mask) - g = zeros(nScan,nVar); - fprintf('%-40s: %30s','Calculating globals',' ') %-# - for i = 1:nScan - for j = 1:nVar - if nVar>1 - str = sprintf('%3d(%02d)/%d(%d)',i,j,nScan,nVar); - else - str = sprintf('%3d/%-3d',i,nScan); - end - fprintf('%s%30s',repmat(sprintf('\b'),1,30),str)%-# - g(i,j) = spm_global(VY(i,j)); - end - end - fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-# -otherwise - error('illegal iGXcalc') -end -rg = g; - - -fprintf('%-40s: ','Design configuration') %-# - - -%-Scaling: compute global scaling factors gSF required to implement proportional -% scaling global normalisation (PropSca) or grand mean scaling (GMsca), -% as specified by iGMsca (& iGloNorm) -%----------------------------------------------------------------------- -switch iGMsca, case 8 - %-Proportional scaling global normalisation - if iGloNorm~=8, error('iGloNorm-iGMsca(8) mismatch for PropSca'), end - gSF = GM./g; - g = GM*ones(nScan,nVar); -case {1,2,3,4,5,6,7} - %-Grand mean scaling according to iGMsca - gSF = GM./spm_meanby(g,eval(CCforms{iGMsca})); - g = g.*gSF; -case 9 - %-No grand mean scaling - gSF = ones(nScan,nVar); -otherwise - error('illegal iGMsca') -end - - -%-Apply gSF to memory-mapped scalefactors to implement scaling -%----------------------------------------------------------------------- -for i=1:nScan - for j = 1:nVar - VY(i,j).pinfo(1:2,:) = VY(i,j).pinfo(1:2,:)*gSF(i,j); - end -end - - -%-AnCova: Construct global nuisance covariates partition (if AnCova) -%----------------------------------------------------------------------- -if any(iGloNorm==[1:7]) - - %-Centre global covariate as requested - %--------------------------------------------------------------- - switch iGC, case {1,2,3,4,5,6,7} %-Standard sCC options - gc = spm_meanby(g,eval(CCforms{iGC})); - case 8 %-No centering - gc = 0; - case 9 %-User specified centre - %-gc set above - case 10 %-As implied by AnCova option - gc = spm_meanby(g,eval(CCforms{iGloNorm})); - case 11 %-Around GM - gc = GM; - otherwise %-unknown iGC - error('unexpected iGC value') - end - - for i = 1:nVar - - %-AnCova - add scaled centred global to DesMtx `G' partition - %------------------------------------------------------- - rcname='global'; if nVar>1, rcname=sprintf('global-%d',i); end - tI = [eval(CFIforms{iGloNorm,1}),g(:,i)-gc(:,i)]; - tConst = CFIforms{iGloNorm,2}; - tFnames = [eval(CFIforms{iGloNorm,3}),{rcname}]; - [f,gname] = spm_DesMtx(tI,tConst,tFnames); - clear tI tConst tFnames - - %-Save GX info in xC struct for reference - str = {sprintf('%s: %s',dstr{2},rcname)}; - if any(iGMsca==[1:7]), str=[str;{['(after ',sGMsca,')']}]; end - if iGC~=8, str=[str;{['used centered ',sCC{iGC}]}]; end - if iGloNorm > 1 - str=[str;{['fitted as interaction ',sCFI{iGloNorm}]}]; - end - tmp = struct( 'rc',rg(:,i).*gSF(:,i), 'rcname',rcname,... - 'c',f, 'cname' ,{gname},... - 'iCC',iGC, 'iCFI' ,iGloNorm,... - 'type', 3,... - 'cols',[1:size(f,2)]+size([H C B G],2),... - 'descrip', {str} ); - - G = [G,f]; Gnames = [Gnames; gname]; - if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end - - end - -elseif iGloNorm==8 | iGXcalc>1 - - %-Globals calculated, but not AnCova: Make a note of globals - %--------------------------------------------------------------- - if iGloNorm==8 - str = { 'global values: (used for proportional scaling)';... - '("raw" unscaled globals shown)'}; - elseif isfinite(M_T) & ~isreal(M_T) - str = { 'global values: (used to compute analysis threshold)'}; - else - str = { 'global values: (computed but not used)'}; - end - - for i = 1:nVar - rcname='global'; if nVar>1, rcname=sprintf('global-%d',i); end - tmp = struct( 'rc',rg(:,i), 'rcname',rcname,... - 'c',{[]}, 'cname' ,{{}},... - 'iCC',0, 'iCFI' ,0,... - 'type', 3,... - 'cols', {[]},... - 'descrip', {str} ); - if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end - end -end - - -%-Save info on global calculation in xGX structure -%----------------------------------------------------------------------- -xGX = struct(... - 'iGXcalc',iGXcalc, 'sGXcalc',sGXcalc, 'rg',rg,... - 'iGMsca',iGMsca, 'sGMsca',sGMsca, 'GM',GM,'gSF',gSF,... - 'iGC', iGC, 'sGC', sCC{iGC}, 'gc', gc,... - 'iGloNorm',iGloNorm, 'sGloNorm',sGloNorm); - - - -%-Construct masking information structure and compute actual analysis -% threshold using scaled globals (rg.*gSF) -%----------------------------------------------------------------------- -if isreal(M_T), M_TH = M_T * ones(nScan,nVar); %-NB: -Inf is real -else, M_TH = imag(M_T) * (rg.*gSF); end - -if ~isempty(M_P) - VM = spm_vol(char(M_P)); - xsM.Explicit_masking = [{'Yes: mask images :'};{VM.fname}']; -else - VM=[]; - xsM.Explicit_masking = 'No'; -end -xM = struct('T',M_T, 'TH',M_TH, 'I',M_I, 'VM',{VM}, 'xs',xsM); - - - -%-Construct full design matrix (X), parameter names (Xnames), -% and design information structure (xX) -%======================================================================= -X = [H C B G]; -Xnames = [Hnames; Cnames; Bnames; Gnames]; -tmp = cumsum([size(H,2), size(C,2), size(B,2), size(G,2)]); -xX = struct( 'I', I,... - 'sF', {D.sF},... - 'X', X,... - 'sigma', 0,... - 'iH', [1:size(H,2)],... - 'iC', [1:size(C,2)] + tmp(1),... - 'iB', [1:size(B,2)] + tmp(2),... - 'iG', [1:size(G,2)] + tmp(3),... - 'Xnames', {Xnames}); - - - -%-Pre-specified contrast for F-test on effects of interest -%======================================================================= -if ~isempty([H,C]) - %-Some effects designated "of interest" - F_iX0 = (size(H,2)+size(C,2)) + [1:size(B,2)+size(G,2)]; -else - %-No effects designated "of interest" - F-test for B=0 - F_iX0 = []; -end - - -%-Design description (an nx2 cellstr) - for saving and display -%======================================================================= -tmp = { sprintf('%d condition, +%d covariate, +%d block, +%d nuisance',... - size(H,2),size(C,2),size(B,2),size(G,2));... - sprintf('%d total, having %d degrees of freedom',... - size(X,2),rank(X));... - sprintf('leaving %d degrees of freedom from %d images',... - size(X,1)-rank(X),size(X,1)) }; -xsDes = struct( 'Design', {D.DesName},... - 'Global_calculation', {sGXcalc},... - 'Grand_mean_scaling', {sGMsca},... - 'Global_normalisation', {sGloNorm},... - 'Parameters', {tmp} ); - - -fprintf('%30s\n','...done') %-# - -SPM = struct('xX', xX,... - 'VY', VY,... - 'xM', xM,... - 'F_iX0', F_iX0,... - 'xC', xC,... - 'xsDes', xsDes,... - 'SPMid', SPMid,... - 'cfg', 'SPMcfg'); -varargout = {SPM}; - -%-End -%======================================================================= -spm('Pointer','Arrow') -fprintf('%-40s: %30s\n','Completed',spm('time')) %-# -fprintf('\n\n') - -case 'files&indices' -%======================================================================= -% - Get files and factor indices -%======================================================================= -% [P,I] = pr_spm_ui('Files&Indices',DsF,Dn,DbaTime,nV) -% DbaTime=D.b.aTime; Dn=D.n; DsF=D.sF; -if nargin<5, nV = 1; else, nV = varargin{5}; end -if nargin<4, DbaTime = 1; else, DbaTime = varargin{4}; end -if nargin<3, Dn = [Inf,Inf,Inf,Inf]; else, Dn=varargin{3}; end -if nargin<2, DsF = {'Fac1','Fac2','Fac3','Fac4'}; else, DsF=varargin{2}; end - -%-Initialise variables -%----------------------------------------------------------------------- -i4 = []; % factor 4 index (usually group) -i3 = []; % factor 3 index (usually subject), per f4 -i2 = []; % factor 2 index (usually condition), per f3/f4 -i1 = []; % factor 1 index (usually replication), per f2/f3/f4 -P = {}; % cell array of string filenames - -%-Accrue filenames and factor level indicator vectors -%----------------------------------------------------------------------- -bMV = nV>1; -if isinf(Dn(4)), n4 = spm_input(['#',DsF{4},'''s'],'+1','n1'); - else, n4 = Dn(4); end -bL4 = n4>1; - -ti2 = ''; -GUIpos = spm_input('!NextPos'); -for j4 = 1:n4 - spm_input('!SetNextPos',GUIpos); - sF4P=''; if bL4, sF4P=[DsF{4},' ',int2str(j4),': ']; end - if isinf(Dn(3)), n3=spm_input([sF4P,'#',DsF{3},'''s'],'+1','n1'); - else, n3 = Dn(3); end - bL3 = n3>1; - - if DbaTime & Dn(2)>1 - %disp('NB:selecting in time order - manually specify conditions') - %-NB: This means f2 levels might not be 1:n2 - GUIpos2 = spm_input('!NextPos'); - for j3 = 1:n3 - sF3P=''; if bL3, sF3P=[DsF{3},' ',int2str(j3),': ']; end - str = [sF4P,sF3P]; - tP = {}; - n21 = Dn(2)*Dn(1); - for v=1:nV - vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end - ttP = spm_get(n21,img_flt,{[str,'select images',vstr]}); - n21 = length(ttP); - tP = [tP,ttP]; - end - ti2 = spm_input([str,' ',DsF{2},'?'],GUIpos2,'c',ti2',n21,Dn(2)); - %-Work out i1 & check - [tl2,null,j] = unique(ti2); - tn1 = zeros(size(tl2)); ti1 = zeros(size(ti2)); - for i=1:length(tl2) - tn1(i)=sum(j==i); ti1(ti2==tl2(i))=1:tn1(i); end - if isfinite(Dn(1)) & any(tn1~=Dn(1)) - %-#i1 levels mismatches specification in Dn(1) - error(sprintf('#%s not %d as pre-specified',DsF{1},Dn(1))) - end - P = [P;tP]; - i4 = [i4; j4*ones(n21,1)]; - i3 = [i3; j3*ones(n21,1)]; - i2 = [i2; ti2]; - i1 = [i1; ti1]; - end - - else - - if isinf(Dn(2)) - n2 = spm_input([sF4P,'#',DsF{2},'''s'],'+1','n1'); - else - n2 = Dn(2); - end - bL2 = n2>1; - - if n2==1 & Dn(1)==1 %-single scan per f3 (subj) - %disp('NB:single scan per f3') - str = [sF4P,'select images, ',DsF{3},' 1-',int2str(n3)]; - tP = {}; - for v=1:nV - vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end - ttP = spm_get(n3,img_flt,{[str,vstr]}); - tP = [tP,ttP]; - end - P = [P;tP]; - i4 = [i4; j4*ones(n3,1)]; - i3 = [i3; [1:n3]']; - i2 = [i2; ones(n3,1)]; - i1 = [i1; ones(n3,1)]; - else - %-multi scan per f3 (subj) case - %disp('NB:multi scan per f3') - for j3 = 1:n3 - sF3P=''; if bL3, sF3P=[DsF{3},' ',int2str(j3),': ']; end - if Dn(1)==1 - %-No f1 (repl) within f2 (cond) - %disp('NB:no f1 within f2') - str = [sF4P,sF3P,'select images: ',DsF{2},... - ' 1-',int2str(n2)]; - tP = {}; - for v=1:nV - vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end - ttP = spm_get(n2,img_flt,{[str,vstr]}); - tP = [tP,ttP]; - end - P = [P;tP]; - i4 = [i4; j4*ones(n2,1)]; - i3 = [i3; j3*ones(n2,1)]; - i2 = [i2; [1:n2]']; - i1 = [i1; ones(n2,1)]; - else - %-multi f1 (repl) within f2 (cond) - %disp('NB:f1 within f2') - for j2 = 1:n2 - sF2P=''; - if bL2, sF2P=[DsF{2},' ',int2str(j2),': ']; end - str = [sF4P,sF3P,sF2P,' select images...']; - tP = {}; - n1 = Dn(1); - for v=1:nV - vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end - ttP = spm_get(n1,img_flt,{[str,vstr]}); - n1 = length(ttP); - tP = [tP,ttP]; - end - P = [P;tP]; - i4 = [i4; j4*ones(n1,1)]; - i3 = [i3; j3*ones(n1,1)]; - i2 = [i2; j2*ones(n1,1)]; - i1 = [i1; [1:n1]']; - end % (for j2) - end % (if Dn(1)==1) - end % (for j3) - end % (if n2==1 &...) - end % (if DbaTime & Dn(2)>1) -end % (for j4) -varargout = {P,[i1,i2,i3,i4]}; - - -case 'desdefs_stats' -%======================================================================= -% - Basic Stats Design definitions... -%======================================================================= -% D = pr_spm_ui('DesDefs_Stats'); -% These are the basic Stats design definitions... - -%-Note: struct expands cell array values to give multiple records: -% => must embed cell arrays within another cell array! -%-Negative indices indicate defaults (first used) - -D = struct(... - 'DesName','One sample t-test',... - 'n', [Inf 1 1 1], 'sF',{{'obs','','',''}},... - 'Hform', 'I(:,2),''-'',''mean''',... - 'Bform', '[]',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',-Inf,'I',Inf,'X',Inf),... - 'b',struct('aTime',0)); - -D = [D, struct(... - 'DesName','Two sample t-test',... - 'n', [Inf 2 1 1], 'sF',{{'obs','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',1))]; - -D = [D, struct(... - 'DesName','Paired t-test',... - 'n', [1 2 Inf 1], 'sF',{{'','cond','pair',''}},... - 'Hform', 'I(:,2),''-'',''condition''',... - 'Bform', 'I(:,3),''-'',''\gamma''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','One way Anova',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','Simple regression (correlation)',... - 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,2),''-'',''\mu''',... - 'nC',[1,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','Multiple regression',... - 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,2),''-'',''\mu''',... - 'nC',[Inf,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','AnCova',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,1],'iCC',{{8,1}},'iCFI',{{1,1}},... - 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],... - 'iGloNorm',9,'iGC',12,... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',0))]; - -varargout = {D}; - - -case 'desdefs_pet' -%======================================================================= -% - Standard (SPM99) PET/SPECT Design definitions... -%======================================================================= -% D = pr_spm_ui('DesDefs_PET'); -% These are the standard PET design definitions... - -%-Single subject -%----------------------------------------------------------------------- -D = struct(... - 'DesName','Single-subject: conditions & covariates',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[Inf,Inf],'iCC',{{[-1,3,8],[-1,8]}},'iCFI',{{[1,3],1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1)); - -D = [D, struct(... - 'DesName','Single-subject: covariates only',... - 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[Inf,Inf],'iCC',{{[-1,8],[-1,8]}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1))]; - -%-Multi-subject -%----------------------------------------------------------------------- -D = [D, struct(... - 'DesName','Multi-subj: conditions & covariates',... - 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{[1,3,4,8],[1,4,8]}},'iCFI',{{[1,3,-4],[1,-4]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,... - 'iGloNorm',[4,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1))]; - -D = [D, struct(... - 'DesName','Multi-subj: cond x subj interaction & covariates',... - 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},... - 'Hform', 'I(:,[3,2]),''-'',{''subj'',''cond''}',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{[1,3,4,8],[1,4,8]}},'iCFI',{{[1,3,-4],[1,-4]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,... - 'iGloNorm',[4,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1))]; - -D = [D, struct(... - 'DesName','Multi-subj: covariates only',... - 'n',[Inf 1 Inf 1], 'sF',{{'repl','','subject',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{[1,4,8],[1,4,8]}},'iCFI',{{[1,-4],[1,-4]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,... - 'iGloNorm',[4,8:9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -%-Multi-group -%----------------------------------------------------------------------- -D = [D, struct(... - 'DesName','Multi-group: conditions & covariates',... - 'n',[Inf Inf Inf Inf], 'sF',{{'repl','condition','subject','group'}},... - 'Hform', 'I(:,[4,2]),''-'',{''stud'',''cond''}',... - 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{[5:8],[5,7,8]}},'iCFI',{{[1,5,6,-7],[1,5,-7]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-7,9],'GM',50,... - 'iGloNorm',[7,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',1))]; - -D = [D, struct(... - 'DesName','Multi-group: covariates only',... - 'n',[Inf 1 Inf Inf], 'sF',{{'repl','','subject','group'}},... - 'Hform', '[]',... - 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{[5,7,8],[5,7,8]}},'iCFI',{{[1,5,-7],[1,5,-7]}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-7,9],'GM',50,... - 'iGloNorm',[7,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -%-Population comparisons -%----------------------------------------------------------------------- -D = [D, struct(... - 'DesName',... - 'Population main effect: 2 cond''s, 1 scan/cond (paired t-test)',... - 'n',[1 2 Inf 1], 'sF',{{'','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName',... - 'Dodgy population main effect: >2 cond''s, 1 scan/cond',... - 'n',[1 Inf Inf 1], 'sF',{{'','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','Compare-populations: 1 scan/subject (two sample t-test)',... - 'n',[Inf 2 1 1], 'sF',{{'subject','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','Compare-populations: 1 scan/subject (AnCova)',... - 'n',[Inf 2 1 1], 'sF',{{'subject','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,Inf],'iCC',{{8,1}},'iCFI',{{1,1}},... - 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -%-The Full Monty! -%----------------------------------------------------------------------- -D = [D, struct(... - 'DesName','The Full Monty...',... - 'n',[Inf Inf Inf Inf], 'sF',{{'repl','cond','subj','group'}},... - 'Hform', 'I(:,[4,2]),''-'',{''stud'',''cond''}',... - 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{[1:8],[1:8]}},'iCFI',{{[1:7],[1:7]}},... - 'iGXcalc',[1,2,3],'iGMsca',[1:7],'GM',50,... - 'iGloNorm',[1:9],'iGC',[1:11],... - 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),... - 'b',struct('aTime',1))]; - - -varargout = {D}; - -case 'desdefs_pet96' -%======================================================================= -% - SPM96 PET/SPECT Design definitions... -%======================================================================= -% D = pr_spm_ui('DesDefs_PET96'); - -%-Single subject -%----------------------------------------------------------------------- -D = struct(... - 'DesName','SPM96:Single-subject: replicated conditions',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0)); - -D = [D, struct(... - 'DesName','SPM96:Single-subject: replicated conditions & covariates',... - 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Single-subject: covariates only',... - 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,3),''-'',''\mu''',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -%-Multi-subject -%----------------------------------------------------------------------- -D = [D, struct(... - 'DesName','SPM96:Multi-subject: different conditions',... - 'n', [1 Inf Inf 1], 'sF',{{'','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''scancond''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-subject: replicated conditions',... - 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-subject: different conditions & covariates',... - 'n', [1 Inf Inf 1], 'sF',{{'','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''cond''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,4],[1,4]}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-subject: replicated conditions & covariates',... - 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},... - 'Hform', 'I(:,2),''-'',''condition''',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,3,4],[1,4]}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-subject: covariates only',... - 'n',[Inf 1 Inf 1], 'sF',{{'repl','','subject',''}},... - 'Hform', '[]',... - 'Bform', 'I(:,3),''-'',''subj''',... - 'nC',[Inf,Inf],'iCC',{{[1,4,8],[1,4,8]}},'iCFI',{{[1,4],[1,4]}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,4,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -%-Multi-study -%----------------------------------------------------------------------- -D = [D, struct(... - 'DesName','SPM96:Multi-study: different conditions',... - 'n',[1 Inf Inf Inf], 'sF',{{'','cond','subj','study'}},... - 'Hform', 'I(:,[4,2]),''-'',{''study'',''cond''}',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-study: replicated conditions',... - 'n',[Inf Inf Inf Inf], 'sF',{{'repl','cond','subj','study'}},... - 'Hform', 'I(:,[4,2]),''-'',{''study'',''condition''}',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-study: different conditions & covariates',... - 'n',[1 Inf Inf Inf], 'sF',{{'','cond','subj','study'}},... - 'Hform', 'I(:,[4,2]),''-'',{''study'',''cond''}',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,6,7],[1,5,7]}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-study: replicated conditions & covariates',... - 'n',[Inf Inf Inf Inf], 'sF',{{'','cond','subj','study'}},... - 'Hform', 'I(:,[4,2]),''-'',{''study'',''condition''}',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,6,7],[1,5,7]}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -D = [D, struct(... - 'DesName','SPM96:Multi-study: covariates only',... - 'n',[Inf 1 Inf Inf], 'sF',{{'repl','','subj','study'}},... - 'Hform', '[]',... - 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',... - 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,7],[1,5,7]}},... - 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,... - 'iGloNorm',[1,5,7,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -%-Group comparisons -%----------------------------------------------------------------------- -D = [D, struct(... - 'DesName','SPM96:Compare-groups: 1 scan per subject',... - 'n',[Inf Inf 1 1], 'sF',{{'subject','group','',''}},... - 'Hform', 'I(:,2),''-'',''group''',... - 'Bform', '[]',... - 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},... - 'iGXcalc',3,'iGMsca',[1,9],'GM',50,... - 'iGloNorm',[1,8,9],'iGC',10,... - 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),... - 'b',struct('aTime',0))]; - -varargout = {D}; - - -otherwise -%======================================================================= -% - U N K N O W N A C T I O N -%======================================================================= -warning(['Illegal Action string: ',Action]) - - -%======================================================================= -% - E N D -%======================================================================= -end - - - - -%======================================================================= -%- S U B - F U N C T I O N S -%======================================================================= - -function str = sf_estrrep(str,srstr) -%======================================================================= -for i = 1:size(srstr,1) - str = strrep(str,srstr{i,1},srstr{i,2}); -end -return diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_spm_volterra.m b/lib/marsbar-0.44/@mardo_99/private/pr_spm_volterra.m deleted file mode 100644 index 462d1d9..0000000 --- a/lib/marsbar-0.44/@mardo_99/private/pr_spm_volterra.m +++ /dev/null @@ -1,97 +0,0 @@ -function [X,Xn,IND,BF,name] = spm_Volterra(SF,BF,name,N) -% returns [design] matrix of explanatory variables -% FORMAT [X Xn IND BF name] = spm_Volterra(SF,BF,name,N); -% SF{i} - multivariate causes: SF{i}(:,j) = casue i, expansion j -% BF{i} - Basis functions: BF{i} = basis set for cause i -% name{i} - name of cause i -% N - [1 or 2] order of Volterra expansion -% -% X - Design Matrix -% Xn{i} - name of cause i (now including interactions among causes) -% IND{i} - indices pertaining to cause i (and interactions) -%___________________________________________________________________________ -% -% For first order expansions spm_Volterra simply convolves the causes -% (e.g. stick functions) in SF by the basis functions in BF to create -% a design matrix X. For second order expansions new entries appear -% in IND, BF and name that correspond to the interaction among the -% orginal causes (if the events are sufficiently close in time). -% The basis functions for these are two dimensional and are used to -% assemble the second order kernel in spm_graph.m. Second order effects -% are computed for only the first column of SF. -%___________________________________________________________________________ -% @(#)spm_Volterra.m 2.1 Karl Friston 99/05/11 - - -% Construct X -%=========================================================================== - -% 1st order terms -%--------------------------------------------------------------------------- -X = []; -Xn = {}; -IND = cell(1,size(SF,2)); -for i = 1:size(SF,2) - for j = 1:size(BF{i},2) - for k = 1:size(SF{i},2) - x = SF{i}(:,k); - d = 1:length(x); - x = conv(full(x),BF{i}(:,j)); - x = x(d); - X = [X x]; - IND{i} = [IND{i} size(X,2)]; - if size(SF{i},2) > 1 - str = [name{i} sprintf('(%i)[%i]',j,(k - 1))]; - else - str = [name{i} sprintf('(%i)',j)]; - end - Xn{end + 1} = str; - end - end -end - -% return if first order -%--------------------------------------------------------------------------- -if N == 1, return, end - -% 2nd order terms -%--------------------------------------------------------------------------- -k = length(name); -for i = 1:size(SF,2) - for j = i:size(SF,2) - - % ensure events can interact - %----------------------------------------------------------- - skip = 0; - if i == j - p = diff(find(SF{i}(:,1))); - skip = (size(BF{i},1) <= min(p)) | ~any(diff(p)); - end - - if ~skip - - k = k + 1; - ind = []; - bf = {}; - for p = 1:size(BF{i},2) - for q = 1:size(BF{j},2) - ni = [name{i} sprintf('(%i)',p)]; - nj = [name{j} sprintf('(%i)',q)]; - x = SF{i}(:,1); - y = SF{j}(:,1); - x = conv(full(x),BF{i}(:,p)); - y = conv(full(y),BF{j}(:,q)); - x = x(d); - y = y(d); - X = [X x.*y]; - ind = [ind size(X,2)]; - Xn{end + 1} = [ni ' x ' nj]; - bf = [bf {BF{i}(:,p)*BF{j}(:,q)'}]; - end - end - name{k} = [name{i} ' x ' name{j}]; - IND{k} = ind; - BF{k} = bf; - end - end -end diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_stat_compute.m b/lib/marsbar-0.44/@mardo_99/private/pr_stat_compute.m deleted file mode 100644 index e836b99..0000000 --- a/lib/marsbar-0.44/@mardo_99/private/pr_stat_compute.m +++ /dev/null @@ -1,83 +0,0 @@ -function [Num, Stat, P, Pc] = pr_stat_compute(xCon, Xs, V, betas, ResidualMS); -% calculates contrast value, stats and p values for contrasts -% FORMAT [Num, Stat, P, Pc] = pr_stat_compute(xCon, Xs, V, betas, ResidualMS); -% -% xCon - contrast structure -% Xs - design matrix -% V - covariance matrix -% betas - parameter estimates -% ResidualMS - root mean square of residuals -% -% Output -% Num - contrast value (ess for F test) -% Stat - statistic value -% P - uncorrected p value -% Pc - P value corrected for number of columns analyzed -%-------------------------------------------------------------------- -% -% $Id$ - -nROI = size(betas,2); -nCon = length(xCon); - -xpxm = spm_sp('xpx-',Xs); -xpVx = Xs.X'*V*Xs.X; -Bcov = xpxm*xpVx*xpxm; - -[trRV trRVRV] = spm_SpUtil('trRV',Xs,V); -erdf = trRV^2/trRVRV; -RMS = sqrt(ResidualMS); - -T_indices = []; -F_indices = []; -dfnum = []; - -Stat = zeros(nCon, nROI); -P = zeros(nCon, nROI); -check_Tvalue = zeros(nCon, nROI); - -for ii = 1:nCon - -% [edf_tsp edf_Xsp] = spm_FcUtil('FconEdf', xCon(ii), Xs, V); - - switch(xCon(ii).STAT) - case 'T' - %----------- to check calculation with h ----------- - h = spm_FcUtil('Hsqr', xCon(ii), Xs); - [trMV trMVMV]= spm_SpUtil('trMV', ... - spm_FcUtil('X1o',xCon(ii),Xs), V); - - check_Tvalue(ii,:) = ((h*betas)/trMV)./RMS; - check_dfnum(ii) = trMV; - - %----------- t value ----------- - - Num(ii,:) = xCon(ii).c'*betas; - Stat(ii,:) = Num(ii,:) ./ ... - (RMS .* sqrt((xCon(ii).c'*Bcov*xCon(ii).c))); - P(ii,:) = 1 - spm_Tcdf(Stat(ii,:), erdf); - T_indices = [T_indices ii]; - - - case 'F' - [trMV trMVMV]= spm_SpUtil('trMV', ... - spm_FcUtil('X1o',xCon(ii),Xs), V); - dfnum = [dfnum trMV^2/trMVMV]; - h = spm_FcUtil('Hsqr', xCon(ii), Xs); - - Num(ii,:) = sum( (h*betas).^2, 1 ); - Stat(ii,:) = (Num(ii,:)/trMV) ./ (RMS.^2); - check_Tvalue(ii,:) = Stat(ii,:) ; - P(ii,:) = 1 - spm_Fcdf(Stat(ii,:), ... - [dfnum(end) erdf]); - F_indices = [F_indices ii]; - - - otherwise - error(['unknown STAT "',xCon(ii).STAT,'"']) - end -end - -%- corrected P value for the number of ROI -%-------------------------------------------------------------------- -Pc = ones(nCon, nROI) - (ones(nCon, nROI) - P).^nROI; diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_stat_compute_mv.m b/lib/marsbar-0.44/@mardo_99/private/pr_stat_compute_mv.m deleted file mode 100644 index 8d88c88..0000000 --- a/lib/marsbar-0.44/@mardo_99/private/pr_stat_compute_mv.m +++ /dev/null @@ -1,128 +0,0 @@ -function [MVres]= pr_stat_compute_mv(xCon, Xs, V, betas, ResidualMS, Y) -% compute multivariate statistics across ROIs -% FORMAT [MVres]= pr_stat_compute_mv(xCon, Xs, V, betas, ResidualMS, Y) -% -% xCon - contrast structure -% Xs - design matrix -% V - covariance matrix -% betas - parameter estimates -% ResidialMS - mean sum of squares of residuals -% Y - data natrix -% -% Output -% MVres - result structure -% -% $Id$ - -[nBetas nROI] = size(betas); -nCon = length(xCon); -[trRV trRVRV] = spm_SpUtil('trRV',Xs,V); -erdf = trRV^2/trRVRV; -RMS = sqrt(ResidualMS); -%-------------------------------------------------------------------- -%- Multivariate analysis -%-------------------------------------------------------------------- - -MVres = struct('y_pre',[], 'y_obs', [], 'Pf', [], 'u', [], 'ds', [] ); - -if nCon == 1, return, end - -YpY = Y'*Y; - -for ii = 1:nCon - - xC = xCon(ii); - - %-------------------------------------------------------------------- - [NF, nu, h, d, M12, XG, sXG] = sf_model_mlm(Xs, V, nROI, xC, erdf); - - %-------------------------------------------------------------------- - %- Compute svd - %-------------------------------------------------------------------- - %- fprintf('%-40s\n','Computing Principal Components') - - Z = ((NF*betas)./(ones(size(NF,1),1)*RMS)); - S = Z*Z'; - S = S/sum(nROI); - [u s u] = svd(S,0); - ds = diag(s); - clear s; - - - %-------------------------------------------------------------------- - %- STATISTICS if any ... - %-------------------------------------------------------------------- - %- Fq : F values for the last q eigein values. - %- P : P values.for the last q eigein values. - - Fq = zeros(1,h); - for q = 0:h-1; - nu1 = d*(h-q); - nu2 = d*nu - (d-1)*(4*(h-q)+2*nu)/(h-q+2); - Fq(q+1) = ((nu-2)/nu) * nu2/(nu2-2)*sum(ds(q+1:h))/(h-q); - end - Pf = 1 - spm_Fcdf(Fq,nu1,nu2); - - - %- fprintf('%-40s\n','Computing predicted and observed temporal reponse') -%keyboard - - y_pre = (pinv(XG)'* M12 * u)*diag(sqrt(ds)); % predicted temporal reponse - - gV = (diag(1./sqrt(ds))*Z)'*u; - y_obs = (Y./(ones(size(Y,1),1)*RMS)/nROI)*gV; - - %- save results for this constrast - MVres(ii).y_pre = y_pre; - MVres(ii).y_obs = y_obs; - MVres(ii).Pf = Pf; - MVres(ii).u = u; - MVres(ii).ds = ds; - MVres(ii).df = [nu1 nu2]; - -end - - - - - - -%=================================================================== -function [NF,nu,h,d,M12,XG,sXG] = sf_model_mlm(Xs, V, nROI, xC, erdf); -% Set sub-space of interest and the related matrix of normalisation. -% FORMAT [NF,nu,h,d,M12,XG] = mm_model(); -%- nu, h, d : degrees of freedom -%- NF : matrix of normalisation -%=================================================================== - - -%-------------------------------------------------------------------- -%- SET, COMPUTE,NORMALIZE SPACES OF INTEREST -%-------------------------------------------------------------------- -%- set X10 and XG -%- XG= X -PG(X), PG projection operator on XG (cf. eq 1, 2) -%-------------------------------------------------------------------- -sX1o = spm_sp('set',spm_FcUtil('X1o',xC,Xs)); -sXG = spm_sp('set',spm_FcUtil('X0',xC,Xs)); -X1o = spm_sp('oP',sX1o,Xs.X); -XG = spm_sp('r',sXG,Xs.X); - -%- Compute Normalized effexts : M1/2=X'G*V*XG (cf eq 3) -%-------------------------------------------------------------------- -% warning off; -up = spm_sp('ox',sX1o); ; %- PG=up*up' -qi = up'*Xs.X; -sigma = up'*V*up; -M12 = (chol(sigma)*qi)'; -M_12 = pinv(M12); - -%- Compute NF : normalise factor (cf eq 4) -%-------------------------------------------------------------------- -NF = M_12*spm_sp('X',Xs)'*spm_sp('r',sXG,spm_sp('X',Xs)); - -%- degrees of freedom -%- nROI : number of ROI (corresponds to the number of Resels) -%-------------------------------------------------------------------- -d = nROI*(4*log(2)/pi)^(3/2); -h = sX1o.rk; %-rank of the sub-space of interest. -nu = erdf; diff --git a/lib/marsbar-0.44/@mardo_99/save_spm.m b/lib/marsbar-0.44/@mardo_99/save_spm.m deleted file mode 100644 index 86f8b48..0000000 --- a/lib/marsbar-0.44/@mardo_99/save_spm.m +++ /dev/null @@ -1,49 +0,0 @@ -function tf = save_spm(D, fname); -% method to save design as SPM format design structure -% FORMAT tf = save_spm(D, fname); -% -% Inputs -% D - design object -% fname - filename -% -% Outputs -% tf - flag ==1 if successful -% -% $Id$ - -if nargin < 2 - if is_spm_estimated(D) - fname = 'SPM.mat'; - elseif has_images(D) - fname = 'SPMcfg.mat'; - elseif is_fmri(D) - fname = 'SPM_fMRIDesMtx.mat'; - else - error('Cannot work out design type for default filename'); - end -end - -% Convert vols to native format -D = convert_vols(D, native_vol_ver(D)); - -SPM = des_struct(D); -if ~mars_utils('isabspath', fname) - Swd = mars_struct('getifthere', SPM, 'swd'); - if isempty(Swd) - error('No path passed, and none in design'); - end - fname = fullfile(Swd, fname); -else - SPM.swd = fileparts(fname); -end - -try - if verbose(D) - fprintf('Saving design to file %s\n', fname); - end - savestruct(SPM, fname); - tf = 1; -catch - warning(lasterr); - tf = 0; -end diff --git a/lib/marsbar-0.44/@mardo_99/set_images.m b/lib/marsbar-0.44/@mardo_99/set_images.m deleted file mode 100644 index 413a4b4..0000000 --- a/lib/marsbar-0.44/@mardo_99/set_images.m +++ /dev/null @@ -1,11 +0,0 @@ -function marsD = set_images(marsD, VY) -% method to set image vols into design -% -% $Id$ - -if nargin < 2 - error('Need image volumes'); -end -D = des_struct(marsD); -D.VY = VY; -marsD = des_struct(marsD, D); diff --git a/lib/marsbar-0.44/@mardo_99/tr.m b/lib/marsbar-0.44/@mardo_99/tr.m deleted file mode 100644 index 5cd3309..0000000 --- a/lib/marsbar-0.44/@mardo_99/tr.m +++ /dev/null @@ -1,10 +0,0 @@ -function t = tr(o) -% method returns TR in seconds, or empty if not available -% -% $Id$ - -t = []; -SPM = des_struct(o); -if mars_struct('isthere', SPM, 'xX', 'RT') - t = SPM.xX.RT; -end diff --git a/lib/marsbar-0.44/@mardo_99/type.m b/lib/marsbar-0.44/@mardo_99/type.m deleted file mode 100644 index 260949b..0000000 --- a/lib/marsbar-0.44/@mardo_99/type.m +++ /dev/null @@ -1,6 +0,0 @@ -function str = type(o) -% returns SPM version string corresponding to design type -% -% $Id$ - -str = 'SPM99'; diff --git a/lib/marsbar-0.44/@mardo_99/ui_build.m b/lib/marsbar-0.44/@mardo_99/ui_build.m deleted file mode 100644 index d3c8ff6..0000000 --- a/lib/marsbar-0.44/@mardo_99/ui_build.m +++ /dev/null @@ -1,27 +0,0 @@ -function D = ui_build(D, dtype) -% method to create / fill design via GUI -% FORMAT D = ui_build(D, dtype) -% -% D - design object -% dtype - one of 'PET', 'FMRI', 'Basic') -% -% Returns -% D - design object with new design -% -% $Id$ - -if nargin < 2 - error('Need design type'); -end - -switch lower(dtype) - case 'pet' - SPM = pr_spm_ui('cfg',spm_spm_ui('DesDefs_PET')); - case 'basic' - SPM = pr_spm_ui('cfg',spm_spm_ui('DesDefs_Stats')); - case 'fmri' - SPM = pr_fmri_design; - otherwise - error(['Did not recognize design type: ' dtype]); -end -D = des_struct(D, SPM); diff --git a/lib/marsbar-0.44/@mardo_99/ui_get_event.m b/lib/marsbar-0.44/@mardo_99/ui_get_event.m deleted file mode 100644 index 43c2c1e..0000000 --- a/lib/marsbar-0.44/@mardo_99/ui_get_event.m +++ /dev/null @@ -1,39 +0,0 @@ -function [e_spec, e_name] = ui_get_event(D) -% method to select an event -% FORMAT [e_spec, e_name] = ui_get_event(D) -% D - design -% -% Returns -% e_spec - 2 by 1 matrix with -% e_epec(1) - session number -% e_spec(2) - event number in session -% e_name - name of event -% -% $Id$ - -if ~is_fmri(D) - error('Need FMRI design'); -end -SPM = des_struct(D); -Sess = SPM.Sess; - -% get session -%-------------------------------------------------------------- -s = length(Sess); -if s > 1 - s = spm_input('which session','+1','n1',1,s); -end - -u = length(Sess{s}.name); -Uname = {}; -for i = 1:u - Uname{i} = Sess{s}.name{i}; -end - -% get effect -%-------------------------------------------------------------- -str = sprintf('which effect'); -u = spm_input(str,'+1','m',Uname); - -e_spec = [s u]'; -e_name = Uname{u}; diff --git a/lib/marsbar-0.44/@mardo_99/ui_get_filter.m b/lib/marsbar-0.44/@mardo_99/ui_get_filter.m deleted file mode 100644 index 530657c..0000000 --- a/lib/marsbar-0.44/@mardo_99/ui_get_filter.m +++ /dev/null @@ -1,27 +0,0 @@ -function [D,descrip] = ui_get_filter(D) -% method to get filter via GUI -% FORMAT [D,descrip] = ui_get_filter(D) -% -% Input -% D - design -% -% Returns -% D - design with modified filter -% descrip - cell array of strings describing filter -% -% $Id$ - -SPM = des_struct(D); -[K Hf Lf] = pr_get_filter(SPM.xX.RT, SPM.Sess); -SPM.xX.K = K; -if ~isfield(SPM, 'xsDes') - SPM.xsDes = []; -end -SPM.xsDes.High_pass_Filter = Lf; -SPM.xsDes.Low_pass_Filter = Hf; - -% return args -D = des_struct(D, SPM); - -descrip = {['High_pass_Filter:\t%s', Lf],... - ['Low_pass_Filter: \t%s', Hf]}; diff --git a/lib/marsbar-0.44/@mardo_99/ui_report.m b/lib/marsbar-0.44/@mardo_99/ui_report.m deleted file mode 100644 index 26c5562..0000000 --- a/lib/marsbar-0.44/@mardo_99/ui_report.m +++ /dev/null @@ -1,971 +0,0 @@ -function varargout = ui_report(D, varargin) -% mathod for SPM99 design reporting -% -% Copied with minor edits from: -% @(#)spm_DesRep.m 2.22 Andrew Holmes 01/03/14 -% -% See that file for detailed commentary -% -% $Id$ - -%-Format arguments -%----------------------------------------------------------------------- -if nargin < 2 - action = 'desrepui'; -else - action = varargin{1}; -end - -%-Generic CallBack code -%----------------------------------------------------------------------- -cb = 'tmp = get(findobj(''Tag'', ''DesRepUI''),''UserData''); '; - -% simplify access to design -SPM = des_struct(D); - -% Add empty fields where necessary -try - SPM.xC; -catch - SPM.xC = {}; -end -try - SPM.xsDes; -catch - SPM.xsDes = []; -end - -switch lower(action) - -%======================================================================= -case 'desrepui' %-Design reporting UI -%======================================================================= -% h = spm_DesRep('DesRepUI') -% h = spm_DesRep('DesRepUI',D) - -%-Table of variable availability -%----------------------------------------------------------------------- -% SPM_fMRIDesMtx.mat SPMcfg.mat SPM.mat -% .xX v/ v/ v/ -% .VY x v/ v/ -% .xM x v/ v/ -% .F_iX0 x v/ v/ -% .xC x / [] v/(p) v/(p) -% .Sess v/ v/(f) v/(f) -% .xsDes x v/ v/ -% -% .SPMid -% -% .cfg - -%-Add a scaled design matrix to the design data structure -%----------------------------------------------------------------------- -if ~isfield(SPM.xX,'nKX'), SPM.xX.nKX = spm_DesMtx('Sca',SPM.xX.X,SPM.xX.Xnames); end - -% put back into design object -D = des_struct(D, SPM); - -%-Draw menu -%======================================================================= - -%-Get Interactive window and delete any previous DesRepUI menu -%----------------------------------------------------------------------- -Finter = spm_figure('GetWin','Interactive'); -delete(findobj(get(Finter,'Children'),'flat','Tag','DesRepUI')) - -%-Draw top level menu -%----------------------------------------------------------------------- -hC = uimenu(Finter,'Label','Design',... - 'Separator','on',... - 'Tag','DesRepUI',... - 'UserData',D,... - 'HandleVisibility','on'); - -%-DesMtx (SPM & SPMcfg) -%----------------------------------------------------------------------- -hDesMtx = uimenu(hC,'Label','Design Matrix','Accelerator','D',... - 'CallBack',[cb,... - 'ui_report(tmp, ''DesMtx'')'],... - 'UserData',hC,... - 'HandleVisibility','off'); - -%-Design matrix orthogonality -%----------------------------------------------------------------------- -h = uimenu(hC,'Label','Design orthogonality','Accelerator','O',... - 'CallBack',[cb,... - 'ui_report(tmp, ''DesOrth'')'],... - 'UserData',hC,... - 'HandleVisibility','off'); - -%-Explore design -%----------------------------------------------------------------------- -hExplore = uimenu(hC,'Label','Explore','HandleVisibility','off'); - -switch modality(D) -case 'pet' - hFnF = uimenu(hExplore,'Label','Files and factors','Accelerator','F',... - 'CallBack',[cb,... - 'ui_report(tmp, ''Files&Factors'')'],... - 'UserData',hC,... - 'HandleVisibility','off'); - hCovs = uimenu(hExplore,'Label','Covariates','Accelerator','C',... - 'CallBack',[cb,... - 'ui_report(tmp, ''Covs'')'],... - 'UserData',hC,... - 'HandleVisibility','off'); - if isempty(SPM.xC), set(hCovs,'Enable','off'), end -case 'fmri' - for j = 1:length(SPM.Sess) - h = uimenu(hExplore,'Label',sprintf('Session %.0f ',j),... - 'HandleVisibility','off'); - for k = 1:length(SPM.Sess{j}.name) - uimenu(h,'Label',SPM.Sess{j}.name{k},... - 'CallBack',[cb,... - sprintf('ui_report_fmri(tmp,%d,%d);',j,k)],... - 'UserData',hC,... - 'HandleVisibility','off') - end - end -end - - -%-Clear, Quit, Help -%----------------------------------------------------------------------- -uimenu(hC,'Label','Clear','Accelerator','L','Separator','on',... - 'CallBack','spm_results_ui(''Clear'')',... - 'HandleVisibility','off'); -uimenu(hC,'Label','Help','Separator','on',... - 'CallBack','spm_help(''spm_DesRep'')',... - 'HandleVisibility','off'); - -%-Pop open 'Interactive' window -%----------------------------------------------------------------------- -figure(Finter) - -%-Return handle of menu -%----------------------------------------------------------------------- -varargout = {hC}; - - -%======================================================================= -case 'files&factors' %-Summarise files & factors -%======================================================================= -% ui_report(D, 'Files&Factors',fnames,I,xC,sF,xs) - -fnames = image_names(D); -I = SPM.xX.I; -xC = SPM.xC; -sF = SPM.xX.sF; -xs = SPM.xsDes; %-Structure of description strings - -if isempty(fnames) - fnames = cell(size(SPM.xX.X, 1), 1); -else - [fnames,CPath] = spm_str_manip(fnames,'c'); %-extract common path -end -nScan = size(I,1); %-#images -nVar = size(fnames,2); %-Variates -bL = any(diff(I,1),1); %-Multiple factor levels? - -%-Get graphics window & window scaling -Fgraph = spm_figure('GetWin','Graphics'); -spm_results_ui('Clear',Fgraph,0) -FS = spm('FontSizes'); - -%-Display header information -%----------------------------------------------------------------------- -hTax = axes('Position',[0.03,0.85,0.94,0.1],... - 'DefaultTextFontSize',FS(9),... - 'XLim',[0,1],'YLim',[0,1],... - 'Visible','off'); - -text(0.5,1,'Statistical analysis: Image files & covariates...',... - 'Fontsize',FS(14),'Fontweight','Bold',... - 'HorizontalAlignment','center') - -dx1 = 0.05; -dx2 = 0.08; - -x = 0; text(x+.02,.1,'image #','Rotation',90) -if bL(4), x=x+dx1; text(x+.01,.1,sF{4},'Rotation',90), end -if bL(3), x=x+dx1; text(x+.01,.1,sF{3},'Rotation',90), end -if bL(2), x=x+dx1; text(x+.01,.1,sF{2},'Rotation',90), end -if bL(1), x=x+dx1; text(x+.01,.1,sF{1},'Rotation',90), end - -for j = 1:length(xC) - n = size(xC(j).rc,2); - if n>1, tmp=xC(j).cname; else, tmp={xC(j).rcname}; end - for k=1:n - x=x+dx2; - text(x,.1,tmp{k},'Rotation',90,'Interpreter','TeX') - end -end - -x=x+dx2; -text(x,0.65,'Base directory:','FontWeight','Bold') -text(x,0.5,CPath,'FontSize',FS(8)) -text(x,0.2,'filename tails...') - -line('XData',[0 1],'YData',[0 0],'LineWidth',3,'Color','r') - -%-Tabulate file & covariate information -%----------------------------------------------------------------------- -hAx = axes('Position',[0.03,0.05,0.94,0.8],... - 'DefaultTextFontSize',FS(8),... - 'Units','points',... - 'Visible','off'); -AxPos = get(hAx,'Position'); set(hAx,'YLim',[0,AxPos(4)]) - -dy = FS(9); y0 = floor(AxPos(4)) -dy; y = y0; - -for i = 1:nScan - - %-Scan indices - x = 0; text(x,y,sprintf('%03d',i)) - if bL(4), x=x+dx1; text(x,y,sprintf('%02d',I(i,4))), end - if bL(3), x=x+dx1; text(x,y,sprintf('%02d',I(i,3))), end - if bL(2), x=x+dx1; text(x,y,sprintf('%02d',I(i,2))), end - if bL(1), x=x+dx1; text(x,y,sprintf('%02d',I(i,1))), end - - %-Covariates - for j = 1:length(xC) - for k=1:size(xC(j).rc,2) - x=x+dx2; - text(x,y,sprintf('%6g',xC(j).rc(i,k)),... - 'HorizontalAlignment','Center') - end - end - - %-Filename tail(s) - could be multivariate - x=x+dx2; - for j = 1:nVar - text(x,y,fnames{i,j}) - y=y-dy; - end - - %-Paginate if necessary - if y1 - text(0.5,0,sprintf('Page %d/%d',spm_figure('#page')*[1,1]),... - 'FontSize',FS(8),'FontAngle','italic') - spm_figure('NewPage',[hAx;get(hAx,'Children')]) -end - -%-Pop up the Graphics window -%----------------------------------------------------------------------- -figure(Fgraph) - - - -%======================================================================= -case {'desmtx','desorth'} %-Display design matrix / design orthogonality -%======================================================================= -% ui_report(D, 'DesMtx',xX,fnames,xs) -% ui_report(D, 'DesOrth',xX,fnames) - -xX = SPM.xX; -fnames = image_names(D); - -xs = SPM.xsDes; %-Structure of description strings - -desmtx = strcmp(lower(varargin{1}),'desmtx'); - - -%-Locate DesMtx (X), scaled DesMtx (nX) & get parameter names (Xnames) -%----------------------------------------------------------------------- -if isfield(xX,'xKXs') & ... - ~isempty(xX.xKXs) & isstruct(xX.xKXs) - iX = 1; - [nScan,nPar] = size(xX.xKXs.X); -elseif isfield(xX,'X') & ~isempty(xX.X) - iX = 0; - [nScan,nPar] = size(xX.X); -else - error('Can''t find DesMtx in this structure!') -end - -if isfield(xX,'nKX') & ~isempty(xX.nKX) - inX = 1; else, inX = 0; end - -if isfield(xX,'Xnames') & ~isempty(xX.Xnames) - Xnames = xX.Xnames; else, Xnames = {}; end - - -%-Compute design orthogonality matrix if DesOrth -%----------------------------------------------------------------------- -if ~desmtx - if iX - tmp = sqrt(sum(xX.xKXs.X.^2)); - O = xX.xKXs.X'*xX.xKXs.X./kron(tmp',tmp); - tmp = sum(xX.xKXs.X); - else - tmp = sqrt(sum(xX.X.^2)); - O = xX.X'*xX.X./kron(tmp',tmp); - tmp = sum(xX.X); - end - tmp = abs(tmp)1 - ColorOrder = get(hAx,'ColorOrder'); - text(0.3,y,'Key :',... - 'HorizontalAlignment','Right',... - 'FontWeight','Bold','FontSize',FS(9)) - for j = 1:size(xC(i).rc,2) - color = ColorOrder(mod(j-1,size(ColorOrder,1))+1,:); - if size(xC(i).rc,2)==length(xC(i).cname) - str = xC(i).cname{j}; - else - str = sprintf('column %d',j); - end - text(0.31,y,str,'FontSize',FS(9),... - 'Color',color) - text(0.5,xC(i).rc(1,j),[str,' \rightarrow'],... - 'Parent',hAx,... - 'FontSize',FS(8),'FontWeight','Bold',... - 'HorizontalAlignment','Right',... - 'Interpreter','TeX',... - 'Color',color) - y=y-dy; - end - y=y-dy; - end - - - %-Associated parameters - %--------------------------------------------------------------- - text(0.3,y,'Design matrix columns :',... - 'HorizontalAlignment','Right',... - 'FontWeight','Bold','FontSize',FS(9)) - if isempty(xC(i).cols) - text(0.31,y,'(none)','FontSize',FS(9)) - else - for j = xC(i).cols - text(0.31,y,sprintf('%d : %s',j,Xnames{j}),... - 'FontSize',FS(9),'Interpreter','TeX') - y=y-dy; - end - end - y=y-dy; - - - %-Highlight parameter names - %--------------------------------------------------------------- - hCurPNames = hPNames(xC(i).cols); - set(hCurPNames,'Color','r','FontWeight','Bold','FontSize',FS(8)) - - - %-Paginate (if more than one covariate) - %--------------------------------------------------------------- - if length(xC)>1 - spm_figure('NewPage',[hSTitle; hAx; get(hAx,'Children');... - hCurPNames; hDAx; get(hDAx,'Children')]); - end - -end - -%-Pop up the Graphics window -%----------------------------------------------------------------------- -figure(Fgraph) - - -%======================================================================= -case 'scantick' -%======================================================================= -% ui_report(D, 'ScanTick',nScan,lim) -% ( Show at most 32, showing every 2nd/3rd/4th/... as necessary to pair ) -% ( down to <32 items. Always show last item so #images is indicated. ) -if nargin<4, lim=32; else, lim=varargin{3}; end -if nargin<3, error('insufficient arguments'), end -nScan = varargin{2}; - -p = max(1,ceil(nScan/lim)); -s = 1:p:nScan; s(end)=nScan; - -varargout = {s,lim}; - - -%======================================================================= -case {'surfdesmtx_cb','surfdesmtxmo_cb','surfdesmtxup_cb'} %-Surf DesMtx -%======================================================================= -% ui_report(D, 'SurfDesMtx_CB') -% ui_report(D, 'SurfDesMtxMo_CB') -% ui_report(D, 'SurfDesMtxUp_CB') - -h = get(gca,'Xlabel'); - -if strcmp(lower(varargin{1}),'surfdesmtxup_cb') - UD = get(h,'UserData'); - set(h,'String',UD.String,'Interpreter',UD.Interpreter,... - 'UserData',UD.UserData) - set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','') - return -end - - -if strcmp(lower(varargin{1}),'surfdesmtx_cb') - UD = struct( 'String', get(h,'String'),... - 'Interpreter', get(h,'Interpreter'),... - 'UserData', get(h,'UserData')); - set(h,'UserData',UD) - set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfDesMtxMo_CB'')'],... - 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfDesMtxUp_CB'')']) -end - -mm = [get(gca,'YLim')',get(gca,'XLim')']+[.5,.5;-.5,-.5]; -ij = get(gca,'CurrentPoint'); -ij = round(min(max(ij(1,[2,1]),mm(1,:)),mm(2,:))); - -istr = 'none'; -switch get(gcbf,'SelectionType') -case 'normal' - try, str = sprintf('X(%d,%d) = %g',ij(1),ij(2),... - subsref(get(gco,'UserData'),... - struct('type',{'.','()'},'subs',{'X',{ij(1),ij(2)}}))); - catch, str='(no cached design matrix to surf)'; end -case 'extend' - try, str = sprintf('Image %d: %s',ij(1),... - spm_str_manip(... - subsref(get(gco,'UserData'),... - struct('type',{'.','()'},... - 'subs',{'fnames',{ij(1),':'}})),'Ca40')); - catch, str='(no cached image filenames to surf)'; end -case 'alt' - try, str = sprintf('Parameter %d: %s',ij(2),... - subsref(get(gco,'UserData'),... - struct('type',{'.','{}'},'subs',{'Xnames',{ij(2)}}))); - istr = 'tex'; - catch, str='(no cached parameter names to surf)'; end -case 'open' - try, assignin('base','ans',subsref(get(gco,'UserData'),... - struct('type',{'.'},'subs',{'X'}))) - evalin('base','ans') - catch, fprintf('%s GUI: can''t find design matrix\n',mfilename) - end - return -end - -set(h,'String',str,'Interpreter',istr) - - -%======================================================================= -case {'surfestim_cb','surfestimmo_cb','surfestimup_cb'} %-Surf ParEstIm -%======================================================================= -% ui_report(D, 'SurfEstIm_CB') -% ui_report(D, 'SurfEstImMo_CB') -% ui_report(D, 'SurfEstImUp_CB') - -h = get(gca,'Xlabel'); - -if strcmp(lower(varargin{1}),'surfestimup_cb') - UD = get(h,'UserData'); - set(h,'String',UD.String,'Interpreter',UD.Interpreter,... - 'UserData',UD.UserData) - set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','') - return -end - -if strcmp(lower(varargin{1}),'surfestim_cb') - UD = struct( 'String', get(h,'String'),... - 'Interpreter', get(h,'Interpreter'),... - 'UserData', get(h,'UserData')); - set(h,'UserData',UD) - set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfEstImMo_CB'')'],... - 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfEstImUp_CB'')']) -end - -mm = [get(gca,'XLim')]+[.5,-.5]; -i = get(gca,'CurrentPoint'); -i = round(min(max(i(1,1),mm(1)),mm(2))); - -istr = 'none'; -switch get(gcbf,'SelectionType') -case 'normal' - try, tmp = {' (not unique)',' (unique)'}; - str = sprintf('Parameter %d : %s%s',... - i,... - subsref(get(gco,'UserData'),... - struct('type',{'.','{}'},'subs',{'Xnames',{i}})),... - tmp{subsref(get(gco,'UserData'),... - struct('type',{'.','()'},'subs',{'est',{i}}))+1}); - istr = 'tex'; - catch, str='(no cached data to surf)'; end -case {'extend','alt'} - return -case 'open' - try, UD = get(gco,'UserData'); - assignin('base','ans',... - subsref(get(gco,'UserData'),... - struct('type',{'.'},'subs',{'est'}))) - evalin('base','ans') - catch, fprintf('%s GUI: can''t find design orthogonality\n',mfilename) - end - return -end - -set(h,'String',str,'Interpreter',istr) - - - -%======================================================================= -case {'surfdeso_cb','surfdesomo_cb','surfdesoup_cb'} %-Surf DesOrthIm -%======================================================================= -% ui_report(D, 'SurfDesO_CB') -% ui_report(D, 'SurfDesOMo_CB') -% ui_report(D, 'SurfDesOUp_CB') - -h = get(gca,'Xlabel'); - -if strcmp(lower(varargin{1}),'surfdesoup_cb') - UD = get(h,'UserData'); - set(h,'String',UD.String,'Interpreter',UD.Interpreter,... - 'UserData',UD.UserData) - set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','') - return -end - -if strcmp(lower(varargin{1}),'surfdeso_cb') - UD = struct( 'String', get(h,'String'),... - 'Interpreter', get(h,'Interpreter'),... - 'UserData', get(h,'UserData')); - set(h,'UserData',UD) - set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfDesOMo_CB'')'],... - 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfDesOUp_CB'')']) -end - -mm = [get(gca,'YLim')',get(gca,'XLim')']+[.5,.5;-.5,-.5]; -ij = get(gca,'CurrentPoint'); -ij = round(min(max(ij(1,[2,1]),mm(1,:)),mm(2,:))); -if ij(1)>ij(2), return, end - -istr = 'none'; -switch get(gcbf,'SelectionType') -case 'normal' - try - UD = get(gco,'UserData'); - if abs(abs(UD.O(ij(1),ij(2)))-1) < eps*1e1 - str = '{\bf colinear}'; - elseif abs(UD.O(ij(1),ij(2))) < eps*1e1 - str = '{\bf orthogonal}'; - else - str = '{\bf not orthogonal}'; - end - if ~diff(ij), str=[str,' {\it(same column)}']; end - if UD.bC(ij(1),ij(2)), tmp=' ={\it r}'; else, tmp=''; end - str = { sprintf('{\\bf %s} (col %d) & {\\bf %s} (col %d)',... - UD.Xnames{ij(1)},ij(1),... - UD.Xnames{ij(2)},ij(2)),... - sprintf('cos(\\theta)%s = %1.2f',... - tmp,UD.O(ij(1),ij(2))),... - ['\rightarrow ',str]}; - istr = 'tex'; - catch, str='(no cached data to surf)'; end -case {'extend','alt'} - return -case 'open' - try, UD = get(gco,'UserData'); - assignin('base','ans',UD.O) - evalin('base','ans') - catch, fprintf('%s GUI: can''t find design orthogonality\n',mfilename) - end - return -end - -set(h,'String',str,'Interpreter',istr) - - -%======================================================================= -case {'surfcon_cb','surfconmo_cb','surfconup_cb'} %-Surf Contrast -%======================================================================= -% ui_report(D, 'SurfCon_CB') -% ui_report(D, 'SurfConOMo_CB') -% ui_report(D, 'SurfConOUp_CB') - -cUD = get(gco,'UserData'); -if ~isstruct(cUD) | ~isfield(cUD,'h') - warning('contrast GUI objects setup incorrectly'), return -end -h = cUD.h; - -if strcmp(lower(varargin{1}),'surfconup_cb') - UD = get(h,'UserData'); - set(h,'String',UD.String,'Interpreter',UD.Interpreter,... - 'UserData',UD.UserData) - set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','') - return -end - -if strcmp(lower(varargin{1}),'surfcon_cb') - UD = struct( 'String', get(h,'String'),... - 'Interpreter', get(h,'Interpreter'),... - 'UserData', get(h,'UserData')); - set(h,'UserData',UD) - set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfConMo_CB'')'],... - 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfConUp_CB'')']) -end - -mm = [get(gca,'YLim')',get(gca,'XLim')']+[.5,.5;-.5,-.5]; -ij = get(gca,'CurrentPoint'); -ij = round(min(max(ij(1,[2,1]),mm(1,:)),mm(2,:))); - -istr = 'none'; -switch get(gcbf,'SelectionType') -case 'normal' - try - if cUD.i>0, str = sprintf('%d',cUD.i); else, str = ''; end - switch get(gco,'Type') - case 'image' - str = sprintf('%s\\{F\\}: {\\bf%s} (%d,%d) = %.2f',... - str,cUD.xCon.name,ij(2),ij(1),... - cUD.xCon.c(ij(2),ij(1))); - case 'patch' - str = sprintf('%s\\{T\\}: {\\bf%s} (%d) = %.2f',... - str,cUD.xCon.name,ij(2),... - cUD.xCon.c(ij(2))); - otherwise, error('unexpected object type') - end - istr = 'TeX'; - catch, str='(no cached data to surf)'; end -case {'alt','extend'} - return -case 'open' - try, assignin('base','ans',cUD.xCon.c') - evalin('base','ans') - catch, fprintf('%s GUI: can''t find contrast\n',mfilename) - end - return -end - -set(h,'String',str,'Interpreter',istr) - - -%======================================================================= -otherwise %-Unknown action string -%======================================================================= -error(['Unknown action string: ',varargin{1}]) - - - -%======================================================================= -end diff --git a/lib/marsbar-0.44/@mardo_99/ui_report_fmri.m b/lib/marsbar-0.44/@mardo_99/ui_report_fmri.m deleted file mode 100644 index 2d27138..0000000 --- a/lib/marsbar-0.44/@mardo_99/ui_report_fmri.m +++ /dev/null @@ -1,184 +0,0 @@ -function ui_report_fmri(D,s,i) -% Interactive review of fMRI design matrix -% FORMAT ui_report_fmri(D,s,i) -% -% Copied with minor edits from: -% @(#)spm_fMRI_design_show.m 2.17 2.16 Karl Friston 99/09/20 -% see that file for comments -% -% $Id$ - -SPM = des_struct(D); -xX = SPM.xX; -Sess = SPM.Sess; - -%-Generic CallBack code -%----------------------------------------------------------------------- -cb = 'tmp = get(findobj(''Tag'', ''DesRepUI''),''UserData''); '; - -% Do not proceed unless there are trials specified -%----------------------------------------------------------------------- -for j = 1:length(Sess) - if ~length(Sess{j}.name) - spm('alert*','User-specifed regressors only!',mfilename,sqrt(-1)); - return - end -end - - -%-Defaults: Setup GUI -%----------------------------------------------------------------------- -if nargin < 3 - s = 1; - i = 1; - - %-Get Interactive window and delete any previous DesRepUI menu - %--------------------------------------------------------------- - Finter = spm_figure('GetWin','Interactive'); - delete(findobj(get(Finter,'Children'),'flat','Tag','DesRepUI')) - - %-Add a scaled design matrix to the design data structure - %--------------------------------------------------------------- - if ~isfield(xX,'nKX'), xX.nKX = spm_DesMtx('Sca',xX.X,xX.Xnames); end - - %-Draw menu - %--------------------------------------------------------------- - hC = uimenu(Finter,'Label','Explore fMRI design',... - 'Separator','on',... - 'Tag','DesRepUI',... - 'UserData',D,... - 'HandleVisibility','on'); - for j = 1:length(Sess) - h = uimenu(hC,'Label',sprintf('Session %.0f ',j),... - 'HandleVisibility','off'); - for k = 1:length(Sess{j}.name) - cb = ['tmp = get(get(gcbo,''UserData''),',... - '''UserData''); ',... - sprintf(['ui_report_fmri(',... - 'tmp,%d,%d);'],j,k)]; - uimenu(h,'Label',Sess{j}.name{k},... - 'CallBack',cb,... - 'UserData',hC,... - 'HandleVisibility','off') - end - end -end - - -%-Graphics... -%======================================================================= - -%-Get Graphics window -%----------------------------------------------------------------------- -Fgraph = spm_figure('GetWin','Graphics'); -spm_results_ui('Clear',Fgraph,0) - - -% Display design matrix X -%----------------------------------------------------------------------- -axes('Position',[0.125,0.700,0.155,0.225]) -if isfield(xX,'nKX') - hDesMtxIm = image(xX.nKX*32+32); -else - hDesMtxIm = imagesc(spm_en(xX.X)); -end -xlabel('effect') -ylabel('scan') -title('Design Matrix','FontSize',16) - -%-Setup callbacks to allow interrogation of design matrix -%----------------------------------------------------------------------- -set(hDesMtxIm,'UserData',struct('X',xX.X,'Xnames',{xX.Xnames})) -set(hDesMtxIm,'ButtonDownFcn',[cb 'ui_report(tmp, ''SurfDesMtx_CB'')']) - - - -% Session subpartition -%----------------------------------------------------------------------- -axes('Position',[0.550,0.700,0.155,0.225]) -sX = xX.X(Sess{s}.row,Sess{s}.col); -imagesc(spm_en(sX)') -set(gca,'YTick',[1:size(sX,1)]) -set(gca,'YTickLabel',xX.Xnames(Sess{s}.col)') -title({sprintf('Session %d',s) Sess{s}.DSstr}) - -% Collinearity -%----------------------------------------------------------------------- -tmp = sqrt(sum(sX.^2)); -O = sX'*sX./kron(tmp',tmp); -tmp = abs(sum(sX))= i - - % Basis set and peristimulus sampling - %--------------------------------------------------------------- - axes('Position',[0.125,0.110,0.325,0.225]) - t = [1:size(Sess{s}.bf{i},1)]*xX.dt; - pst = Sess{s}.pst{i}; - plot(t,Sess{s}.bf{i},pst,0*pst,'.','MarkerSize',16) - str = sprintf('TR = %0.0fsecs',xX.RT); - xlabel({'time (secs)' str sprintf('%0.0fms time bins',1000*xX.dt)}) - title({'Basis set and peristimulus sampling' Sess{s}.BFstr}) - axis tight - grid on - - % if a paramteric variate is specified - %--------------------------------------------------------------- - if length(Sess{s}.Pv{i}) - - % onsets and parametric modulation - %------------------------------------------------------- - axes('Position',[0.580,0.110,0.325,0.225]) - plot(Sess{s}.ons{i},Sess{s}.Pv{i},'.','MarkerSize',8) - title({'trial specific parameters' Sess{s}.Pname{i}}) - xlabel('time (secs}') - ylabel(Sess{s}.Pname{i}) - grid on - end -end - -%-Pop up Graphics figure window -%----------------------------------------------------------------------- -figure(Fgraph); diff --git a/lib/marsbar-0.44/@marmoire/add_if_absent.m b/lib/marsbar-0.44/@marmoire/add_if_absent.m deleted file mode 100644 index f78704d..0000000 --- a/lib/marsbar-0.44/@marmoire/add_if_absent.m +++ /dev/null @@ -1,14 +0,0 @@ -function o = add_if_absent(o, item, data) -% Adds item only if not already present -% -% $Id$ - -if nargin < 2 - error('Need name of item to add'); -end -if nargin < 3 - error('Need data to put into item'); -end -if ~item_exists(o, item) - o = add_item(o, item, data); -end diff --git a/lib/marsbar-0.44/@marmoire/add_item.m b/lib/marsbar-0.44/@marmoire/add_item.m deleted file mode 100644 index 67bbdb9..0000000 --- a/lib/marsbar-0.44/@marmoire/add_item.m +++ /dev/null @@ -1,27 +0,0 @@ -function o = add_item(o, item_name, item_contents) -% add item to armoire -% FORMAT o = add_item(o, item, I) -% -% o - object -% item_name - item name -% item_contents = item ... contents -% -% $Id $ - -if nargin < 2 - error('Need item name to add'); -end -if nargin < 3 - item_contents = []; -end -I = default_item(o); -if isempty(item_contents) - item_contents = I; -else - def_fns = fieldnames(I); - new_fns = def_fns(~ismember(def_fns, fieldnames(item_contents))); - for fn = new_fns' - item_contents = setfield(item_contents, fn{1}, getfield(I, fn{1})); - end -end -o = set_item_struct(o, item_name, item_contents); diff --git a/lib/marsbar-0.44/@marmoire/clear_item_data.m b/lib/marsbar-0.44/@marmoire/clear_item_data.m deleted file mode 100644 index d16f253..0000000 --- a/lib/marsbar-0.44/@marmoire/clear_item_data.m +++ /dev/null @@ -1,18 +0,0 @@ -function [o, errf] = clear_item_data(o, item) -% sets data for item to empty -% FORMAT [o errf] = clear_item_data(o, item); -% -% o - object -% item - name of item to clear data for -% -% Returns -% o - object with data cleared for this item -% errf - flag is 1 if data was not cleared for some reason -% -% $Id$ - -if nargin < 2 - error('Need item to clear data'); -end - -[o errf] = do_set(o, item, 'clear', [], ''); diff --git a/lib/marsbar-0.44/@marmoire/default_item.m b/lib/marsbar-0.44/@marmoire/default_item.m deleted file mode 100644 index 6bb2f35..0000000 --- a/lib/marsbar-0.44/@marmoire/default_item.m +++ /dev/null @@ -1,19 +0,0 @@ -function I = default_item(o) -% returns default item -% -% $Id$ - -I = struct('data', [],... - 'file_name', '',... - 'default_file_name','',... - 'has_changed', 0,... - 'leave_as_file', 0,... - 'save_if_changed', 1,... - 'file_type', 'mat',... - 'char_is_filename',1,... - 'set_action_if_update', 0 ,... - 'set_action_if_clear', 0 ,... - 'verbose', 1,... - 'title', 'file',... - 'filter_spec', '',... - 'set_action', ''); diff --git a/lib/marsbar-0.44/@marmoire/do_save.m b/lib/marsbar-0.44/@marmoire/do_save.m deleted file mode 100644 index 0408690..0000000 --- a/lib/marsbar-0.44/@marmoire/do_save.m +++ /dev/null @@ -1,93 +0,0 @@ -function [res, o] = do_save(o, item, flags, filename) -% method to save data for item -% FORMAT [res, o] = do_save(o, item, flags, filename) -% -% o - object -% item - item name -% flags - flags for save (see save_item_data.m for details) -% filename - (maybe) filename for save -% -% Returns -% saved_f - flag set to 1 if save done, 0 not done, -1 if cancel -% o - possibly modified object -% -% The function is written like this so that, in the future, we can use -% callbacks in this code to manipulate all the objects in the armoire -% -% $Id$ - -if nargin < 2 - error('Need item'); -end -if nargin < 3 - flags = NaN; -end -if nargin < 4 - filename = NaN; -end - -% Get item -item_struct = get_item_struct(o, item); - -% process flags -if ~isstruct(flags), flags = []; end -if pr_is_nix(filename), filename = item_struct.file_name; end -if pr_is_nix(filename), filename = item_struct.default_file_name; end - -if pr_needs_save(item_struct) || isfield(flags, 'force') % force flag - % prompt for filename if UI - if isfield(flags, 'ui') - % warn if empty, and warn_empty flag (we must be forcing to get here) - if pr_isempty(item_struct) - if isfield(flags, 'warn_empty') - msgbox('Nothing to save', ... - [item_struct.title ' is not set'], 'warn'); - end - res = 0; - return - end - % Work out prompt - if isfield(flags, 'prompt') - prompt = flags.prompt; - else - prompt = item_struct.title; - end - if isfield(flags, 'prompt_prefix') - prompt = [flags.prompt_prefix prompt]; - end - if isfield(flags, 'prompt_suffix') - prompt = [prompt flags.prompt_suffix]; - end - if isfield(flags, 'ync') - save_yn = questdlg(['Save ' prompt '?'],... - 'Save', 'Yes', 'No', 'Cancel', 'Yes'); - if strcmp(save_yn, 'Cancel'), res = -1; return, end - if strcmp(save_yn, 'No') - if isfield(flags, 'no_no_save') - o = set_item_param(o, item, 'has_changed', 0); - end - res = 0; - return - end - end - pr = ['Filename to save ' prompt]; - [f p] = mars_uifile('put', item_struct.filter_spec, pr, filename); - if all(f==0), res = -1; return, end - filename = fullfile(p, f); - end - savestruct(item_struct.data, filename); - if item_struct.verbose - fprintf('%s saved to %s\n', item_struct.title, filename); - end - item_struct.file_name = filename; - item_struct.has_changed = 0; - if item_struct.leave_as_file - % maintain only on file, as it has beed saved - item_struct.data = []; - end - o = set_item_struct(o, item, item_struct); - res = 1; -else - res = 0; -end -return diff --git a/lib/marsbar-0.44/@marmoire/do_set.m b/lib/marsbar-0.44/@marmoire/do_set.m deleted file mode 100644 index a3d31b5..0000000 --- a/lib/marsbar-0.44/@marmoire/do_set.m +++ /dev/null @@ -1,145 +0,0 @@ -function [o, errf] = do_set(o, item, flags, data, filename) -% private function to set data into item -% FORMAT [o, errf] = do_set(o, item, flags, data, filename) -% -% o - object -% item - name of item to set to -% flags - containing fields: -% action: one of: 'set' 'set_ui' 'get' 'clear' 'update' -% data - the data to set into this item -% filename - (possibly) filename for these data -% -% Returns -% o - returned object, probably modified -% errf - flag set to 1 if error, meaning object was not modified -% -% The flags argument at the moment is a bit redundant, as it only -% contains one field, but allows for future expansion, and is more -% compatible with the do_save method. -% -% $Id$ - -if nargin < 2 - error('Need item'); -end -if nargin < 3 - error('Need calling flags'); -end -if nargin < 4 - data = NaN; -end -if nargin < 5 - filename = NaN; -end - -% Errf for return -errf = 0; - -% process flags -if ischar(flags) % can be string, with action - if ~isempty(flags) - flags = struct('action', flags); - end -end -if ~isstruct(flags), flags = []; end -if ~isfield(flags, 'action'), flags.action = 'set'; end -action = flags.action; - -% get item to work on -item_struct = get_item_struct(o, item); - -% get filename for data if set_ui -if strcmp(action, 'set_ui') - [fn pn] = mars_uifile('get', ... - item_struct.filter_spec, ... - ['Select ' item_struct.title '...']); - if isequal(fn,0) | isequal(pn,0), errf = 1;, return, end - filename = fullfile(pn, fn); - data = []; -end - -% Keep copy of passed filename for set_action call -passed_filename = filename; - -% optionally, treat char data as filename -% but passed filename overrides char data -if item_struct.char_is_filename & ischar(data) - if ~pr_is_nix(filename) - warning(sprintf(... - 'Passed filename %s overrides data filename %s\n',... - filename, data)); - else - filename = data; - end - data = []; -end - -if pr_is_nix(filename) % may need to save if no associated filename - item_struct.has_changed = 1; -else % don't need to save, but may need to load from file - item_struct.has_changed = 0; - if isempty(data) - data = load(filename, ['-' item_struct.file_type]); - end -end -item_struct.data = data; - -% If no filename passed: -% if new set, filename is empty -% if an update, filename stays -is_update = strcmp(action, 'update'); -if pr_is_nan(filename) - if ~is_update - filename = ''; - end -end -item_struct.file_name = filename; - -% If this was a clear, don't flag for save -if pr_isempty(item_struct), item_struct.has_changed = 0; end - -% Put processed stuff into object, and copy old object -% This so we can pass the candidate new object to the set_action routines -% for checking and/or changing, but still roll back if we need to. -old_o = o; -o = set_item_struct(o, item, item_struct); - -% and here is where we do the rules stuff -is_clear = strcmp(action, 'clear'); -if ~isempty(item_struct.set_action) & ... - (ismember(action, {'get','set','set_ui'}) | ... - (is_update & item_struct.set_action_if_update) | ... - (is_clear & item_struct.set_action_if_clear)) - [tmp errf msg] = eval(item_struct.set_action); - if errf - o = old_o; - warning(['Data not set: ' msg]); - return - end - % work out what has been returned. It can be: - % object, item_struct, or data; we much prefer the object, to be - % consistent - if isa(tmp, 'marmoire') % object - o = tmp; - item_struct = get_item_struct(o, item); - elseif isstruct(tmp) & isfield(tmp, 'set_action') % item struct - item_struct = tmp; - else % it's just the data - item_struct.data = tmp; - end -end - -% set has_changed, if update -if strcmp(action, 'update') - item_struct.has_changed = 1; -end - -% possibly remove data from structure -if ~item_struct.has_changed & item_struct.leave_as_file - item_struct.data = []; -end - -% return object with data set -o = set_item_struct(o, item, item_struct); - -return diff --git a/lib/marsbar-0.44/@marmoire/get_item_data.m b/lib/marsbar-0.44/@marmoire/get_item_data.m deleted file mode 100644 index 5574d05..0000000 --- a/lib/marsbar-0.44/@marmoire/get_item_data.m +++ /dev/null @@ -1,29 +0,0 @@ -function [res, o, errf] = get_item_data(o, item) -% get data for item -% FORMAT [res o errf] = get_item_data(o, item); -% -% o - object -% item - name of item to get data for -% -% If the item contains no data, GUI set is assumed -% data is loaded from data filename if empty. -% -% Returns -% res - data for item -% o - object, which may have been modified if has done GUI set -% errf - flag is 1 if data modification was attempted but failed -% -% $Id$ - -if nargin < 2 - error('Need item'); -end -errf = 0; -if isempty_item_data(o, item) - [o errf] = do_set(o, item, 'set_ui'); -end -I = get_item_struct(o, item); -res = I.data; -if isempty(res) & ~isempty(I.file_name) - res = load(I.file_name, ['-' I.file_type]); -end diff --git a/lib/marsbar-0.44/@marmoire/get_item_param.m b/lib/marsbar-0.44/@marmoire/get_item_param.m deleted file mode 100644 index 43317d8..0000000 --- a/lib/marsbar-0.44/@marmoire/get_item_param.m +++ /dev/null @@ -1,31 +0,0 @@ -function value = get_item_param(o, item, param) -% method to get item parameters -% FORMAT value = get_item_param(o, item, param) -% -% o - object -% item - item name -% param - parameter name -% -% Returns -% value - value for parameter -% -% $Id$ - -if nargin < 2 - error('Need item name'); -end -if nargin < 3 - error('Need parameter name'); -end - -I = get_item_struct(o, item); - -fns = fieldnames(I); -tmp = strmatch('data', fns, 'exact'); -fns(tmp) = []; - -if ~ismember(param, fns) - error(['There is no parameter callled: ' param]); -end - -value = getfield(I, param); diff --git a/lib/marsbar-0.44/@marmoire/get_item_struct.m b/lib/marsbar-0.44/@marmoire/get_item_struct.m deleted file mode 100644 index 41b47c4..0000000 --- a/lib/marsbar-0.44/@marmoire/get_item_struct.m +++ /dev/null @@ -1,19 +0,0 @@ -function I = get_item_struct(o, item) -% get whole item structure, including parameters -% FORMAT I = get_item_struct(o, item) -% -% This is used internally, and might be useful for debugging -% -% o - object -% item - item name -% -% Returns -% I - item structure, with data in field 'data' and/or specified in -% field 'filename' -% -% $Id$ - -if ~item_exists(o, item) - error('Item does not exist'); -end -I = getfield(o.items, item); diff --git a/lib/marsbar-0.44/@marmoire/isempty_item_data.m b/lib/marsbar-0.44/@marmoire/isempty_item_data.m deleted file mode 100644 index bdf0523..0000000 --- a/lib/marsbar-0.44/@marmoire/isempty_item_data.m +++ /dev/null @@ -1,16 +0,0 @@ -function tf = isempty_item_data(o, item) -% returns 1 if no data for this item -% FORMAT tf = sjjs(o, item) -% -% o - object -% item - item name -% -% tf - flag, 1 if not empty -% -% $Id$ - -if nargin < 2 - error('Need item') -end -I = get_item_struct(o, item); -tf = pr_isempty(I); diff --git a/lib/marsbar-0.44/@marmoire/item_exists.m b/lib/marsbar-0.44/@marmoire/item_exists.m deleted file mode 100644 index c793f6b..0000000 --- a/lib/marsbar-0.44/@marmoire/item_exists.m +++ /dev/null @@ -1,9 +0,0 @@ -function tf = item_exists(o, item) -% returns true if there is an item of this name -% -% $Id$ - -tf = 0; -if ~isempty(o.items) - tf = ismember(item, fieldnames(o.items)); -end diff --git a/lib/marsbar-0.44/@marmoire/item_needs_save.m b/lib/marsbar-0.44/@marmoire/item_needs_save.m deleted file mode 100644 index 4f7430b..0000000 --- a/lib/marsbar-0.44/@marmoire/item_needs_save.m +++ /dev/null @@ -1,10 +0,0 @@ -function tf = item_needs_save(o, item) -% return 1 if item requires a save -% FORMAT tf = item_needs_save(o, item) -% -% $Id$ - -if nargin < 2 - error('Need item') -end -tf = pr_needs_save(get_item_struct(o, item)); diff --git a/lib/marsbar-0.44/@marmoire/marmoire.m b/lib/marsbar-0.44/@marmoire/marmoire.m deleted file mode 100644 index 61036d6..0000000 --- a/lib/marsbar-0.44/@marmoire/marmoire.m +++ /dev/null @@ -1,130 +0,0 @@ -function [o, others] = marmoire(params, varargin) -% marmoire - class constructor for marmoire container type -% FORMAT [o, others] = marmoire(params, varargin) -% -% the marmoire object is to store various bits of stuff -% (armoire is the French for cupboard). -% This cupboard is to put items which I will want to fish out -% from time to time. -% -% The items may well be associated with a filename -% If they are associated with a filename when set, they -% are assumed to have been saved already. -% If not, they are flagged as awaiting a save -% -% If the data changes, you can indicate this with the -% update method, which changes the data, and flags for a save -% -% The permissable actions are: -% -% add_item - add an item to the armoire -% item_exists - ask if there an exists an item of given name -% add_if_absent - adds item if it does not yet exist -% set_item_data - sets data for item -% get_item_data - gets data from item -% set_item_data_ui - sets data, getting via UI -% save_item_data - save data for item, if required -% save_item_data_ui - saves, using GUI to ask for filename -% update_item_data - updates data, sets flag to show change -% clear_item_data - clears data for item -% isempty_item_data - returns 1 if no data for item -% item_needs_save - returns 1 if this item needs a save -% -% Each item is stored in a field 'items' in the object -% -% The name of item is the same as the name of the field in the items field -% of the object, and this is the 'item' argument to the various methods. -% -% Each item field cotains a structure, widh the data contained in a field -% 'data'. The rest of the fields in the structure are parameters telling -% the object how to deal with the various manipulations of the data. So, -% each item requires the following fields: -% -% data - the data -% (or a filename which loads as the data - see the -% char_is_filename field) -% has_changed - flag, if set, means data has changed since first set -% save_if_changed - flag, if set, will try to save changed data when a -% save is requested. Saves can also be forced. -% leave_as_file - flag, if set, will attempt to leave the data, defined -% by the filename, on the disk, not in memory, and only -% load the data for a 'get'. -% Otherwise, if a set occurs, and the data field is -% empty, will load data into the global variable when -% 'set'ing field and leave it there. -% If the data changes, and requires a save, this field -% has no function, until the next save. -% file_name - file name of .mat file containing data -% If data is empty, and file_name is not, -% an attempt to 'get' data will load contents of -% file_name -% default_file_name - default filename offered for save -% file_type - type of file to load ('mat' or 'ascii') -% char_is_filename - flag, if set, char data is assumed to be a filename -% filter_spec - filter spec for uigetfile (see help uigetfile) -% prompt - prompt for uigetfile -% verbose - flag, if set, displays more information during -% processing -% set_action - actions to perform when item is set -% in form of callback string. This is executed -% in the 'i_set' subfunction, and can use all -% variables functions defined therein. See programmers -% notes in the function for callback format -% set_action_if_update - flag, if set, applied set_action for 'update' as -% well as 'set' -% set_action_if_clear - flag, if set, applied set_action for 'clear' as -% well as 'set' -% -% $Id$ - -% Programmers' notes -% ------------------ -% set_action callbacks -% callbacks should in the following formats; -% -% [o errf msg] = my_function(args) -% -% The return argument 'o' is the modified whole object. If -% 'errf' is set, the routine warns, and aborts the set action with the -% 'msg'. -% -% The preferred args will give a format of are: -% [o errf msg] = my_function(o, item, old_o) -% -% where o is the object after the data has been set, item is the name of -% the item which has just been set, and old_o is the object before the -% data was set. -% -% The available args are: -% o - the whole object with new data set -% item - the name of the item which has been set -% old_o - the object before the data was set. -% -% as well as: -% -% item_struct - proposed whole item field contents -% data - proposed data to be inserted -% passed_filename - filename passed to function -% -% and anything else you can see in context, for the line containing the -% 'eval' statement in the do_set method - -myclass = 'marmoire'; -defstruct = struct('items', []); - -if nargin < 1 - params = []; -end -if isa(params, myclass) - o = params; - return -end - -% fill with defaults, parse into fields for this object, children -[pparams, others] = mars_struct('ffillsplit', defstruct, params); - -% add version tag (was CVS; now marsbar version) -pparams.cvs_version = marsbar('ver'); - -% Set as object -o = class(pparams, myclass); diff --git a/lib/marsbar-0.44/@marmoire/private/pr_is_nan.m b/lib/marsbar-0.44/@marmoire/private/pr_is_nan.m deleted file mode 100644 index fedeebd..0000000 --- a/lib/marsbar-0.44/@marmoire/private/pr_is_nan.m +++ /dev/null @@ -1,6 +0,0 @@ -function res = pr_is_nan(v) -res = 0; -if isnumeric(v) && ~isempty(v) - res = isnan(v); -end -return diff --git a/lib/marsbar-0.44/@marmoire/private/pr_is_nix.m b/lib/marsbar-0.44/@marmoire/private/pr_is_nix.m deleted file mode 100644 index e035262..0000000 --- a/lib/marsbar-0.44/@marmoire/private/pr_is_nix.m +++ /dev/null @@ -1,3 +0,0 @@ -function res = pr_is_nix(v) -res = isempty(v) | pr_is_nan(v); -return diff --git a/lib/marsbar-0.44/@marmoire/private/pr_isempty.m b/lib/marsbar-0.44/@marmoire/private/pr_isempty.m deleted file mode 100644 index d227bf0..0000000 --- a/lib/marsbar-0.44/@marmoire/private/pr_isempty.m +++ /dev/null @@ -1,6 +0,0 @@ -function res = pr_isempty(I) -% private function returns 1 if there is no data, or filename -% -% $Id$ - -res = isempty(I.data) & isempty(I.file_name); diff --git a/lib/marsbar-0.44/@marmoire/private/pr_needs_save.m b/lib/marsbar-0.44/@marmoire/private/pr_needs_save.m deleted file mode 100644 index 0a1159a..0000000 --- a/lib/marsbar-0.44/@marmoire/private/pr_needs_save.m +++ /dev/null @@ -1,6 +0,0 @@ -function res = pr_needs_save(I) -% private function returning 1 if item data needs save -% -% $Id$ - -res = ~pr_isempty(I) & I.has_changed & I.save_if_changed; diff --git a/lib/marsbar-0.44/@marmoire/save_item_data.m b/lib/marsbar-0.44/@marmoire/save_item_data.m deleted file mode 100644 index 6da0cae..0000000 --- a/lib/marsbar-0.44/@marmoire/save_item_data.m +++ /dev/null @@ -1,70 +0,0 @@ -function [saved_f, o] = save_item_data(o, item, flags, filename) -% save data for item to file -% FORMAT [saved_f o] = save_item_data(o, item, flags, filename) -% -% o - object -% item - name of item -% flags - flags for save; fields in flag structure can be -% 'force' - force save even if not flagged as needed -% 'warn_empty' - GUI warn if no data to save -% 'ync' - start save with save y/n/cancel dialog -% 'prompt' - prompt for save; -% 'prompt_suffix - suffix for prompt -% 'prompt_prefix - prefix for prompt -% 'ui' - use UI prompts for save - forced if save_ui -% 'no_no_save' - if 'no' is chosen in the save dialog, -% contents are flagged as not needing a save in -% the future (has_changed flag set to 0) -% filename - filename for save -% -% Returns -% saved_f - flag set to 1 if save done, 0 not done, -1 if cancel -% Note that, if saving with more than one item, then the value -% is from the last value saved/not saved. Cancel aborts the -% attempt to save. -% o - possibly modified object (changed filename, maybe data is -% left as a file, and data field made empty) -% -% $Id$ - -if nargin < 2 - error('Need item'); -end -if nargin < 3 - flags = NaN; -end -if nargin < 4 - filename = NaN; -end - -if ~isstruct(flags), flags = []; end - -if strcmp(item, 'all') - item_list = fieldnames(o.items); - if ~pr_is_nix(filename) - warning('Ignoring passed filename for multiple save'); - filename = NaN; - end -else - item_list = {item}; -end - -n_items = length(item_list); -saved_f = 0; -for i_no = 1:n_items - item = item_list{i_no}; - I = get_item_struct(o, item); - tmp_flags = flags; - - % If there is no valid filename, do UI save - if pr_is_nix(filename) && ... - isempty(I.file_name) - tmp_flags.ui = 1; - end - - % Try save - [saved_f o] = do_save(o, item, tmp_flags, filename); - - % Stop if cancel - if saved_f == -1, return, end -end diff --git a/lib/marsbar-0.44/@marmoire/save_item_data_ui.m b/lib/marsbar-0.44/@marmoire/save_item_data_ui.m deleted file mode 100644 index 322d6b1..0000000 --- a/lib/marsbar-0.44/@marmoire/save_item_data_ui.m +++ /dev/null @@ -1,33 +0,0 @@ -function [saved_f, o] = save_item_data_ui(o, item, flags, filename) -% save data for item to file using GUI -% FORMAT [saved_f o] = save_item_data_ui(o, item, flags, filename) -% -% o - object -% item - name of item -% flags - flags for save; see save_item_data.m for details -% filename - filename for save -% -% Returns -% saved_f - flag set to 1 if save done, 0 not done, -1 if cancel -% Note that, if saving with more than one item, then the value -% is from the last value saved/not saved. Cancel aborts the -% attempt to save. -% o - possibly modified object (changed filename, maybe data is -% left as a file, and data field made empty) -% -% $Id$ - -if nargin < 2 - error('Need item'); -end -if nargin < 3 - flags = NaN; -end -if nargin < 4 - filename = NaN; -end - -if ~isstruct(flags), flags = []; end -flags.ui = 1; - -[saved_f o] = save_item_data(o, item, flags, filename); diff --git a/lib/marsbar-0.44/@marmoire/set_item_data.m b/lib/marsbar-0.44/@marmoire/set_item_data.m deleted file mode 100644 index 1c39d10..0000000 --- a/lib/marsbar-0.44/@marmoire/set_item_data.m +++ /dev/null @@ -1,33 +0,0 @@ -function [o, errf] = set_item_data(o, item, data, filename) -% sets data for item -% FORMAT [o errf] = set_item_data(o, item, data, filename) -% -% o - object -% item - name of item to set for -% data - data to set -% filename - filename for data -% -% If neither data nor filename are set, then GUI set is assumed -% -% Returns -% o - object with data set -% errf - flag is 1 if data was not set -% -% $Id$ - -if nargin < 2 - error('Need item to set to'); -end -if nargin < 3 - data = NaN; -end -if nargin < 4 - filename = NaN; -end - -if pr_is_nan(data) & pr_is_nan(filename) - action = 'set_ui'; -else - action = 'set'; -end -[o errf] = do_set(o, item, action, data, filename); diff --git a/lib/marsbar-0.44/@marmoire/set_item_data_ui.m b/lib/marsbar-0.44/@marmoire/set_item_data_ui.m deleted file mode 100644 index d39c145..0000000 --- a/lib/marsbar-0.44/@marmoire/set_item_data_ui.m +++ /dev/null @@ -1,18 +0,0 @@ -function [o, errf] = set_item_data_ui(o, item) -% sets data for item using GUI -% FORMAT [o, errf] = set_item_data_ui(o, item) -% -% o - object -% item - name of item to set for -% -% Returns -% o - object with data set (probably) -% errf - flag is 1 if data was not set -% -% $Id$ - -if nargin < 2 - error('Need item to set to'); -end - -[o errf] = do_set(o, item, 'set_ui'); diff --git a/lib/marsbar-0.44/@marmoire/set_item_param.m b/lib/marsbar-0.44/@marmoire/set_item_param.m deleted file mode 100644 index f9f1986..0000000 --- a/lib/marsbar-0.44/@marmoire/set_item_param.m +++ /dev/null @@ -1,36 +0,0 @@ -function o = set_item_param(o, item, param, value) -% method to set item parameters -% FORMAT o = set_item_param(o, item, param, value) -% -% o - object -% item - item name -% param - parameter name -% value - value to set -% -% Returns -% o - object -% -% $Id$ - -if nargin < 2 - error('Need item name'); -end -if nargin < 3 - error('Need parameter name'); -end -if nargin < 4 - error('Need value to set') -end - -I = get_item_struct(o, item); - -fns = fieldnames(I); -tmp = strmatch('data', fns, 'exact'); -fns(tmp) = []; - -if ~ismember(param, fns) - error(['There is no parameter callled: ' param]); -end - -I = setfield(I, param, value); -o = set_item_struct(o, item, I); diff --git a/lib/marsbar-0.44/@marmoire/set_item_struct.m b/lib/marsbar-0.44/@marmoire/set_item_struct.m deleted file mode 100644 index 95039d7..0000000 --- a/lib/marsbar-0.44/@marmoire/set_item_struct.m +++ /dev/null @@ -1,15 +0,0 @@ -function o = set_item_struct(o, item, item_struct) -% set whole item structure, including parameters -% FORMAT I = get_item_struct(o, item, item_struct) -% -% o - object -% item - item name -% item_struct - item structure -% -% Returns -% o - object with item structure set -% -% $Id$ - -% We might consider error checking here. But hey. -o.items = setfield(o.items, item, item_struct); diff --git a/lib/marsbar-0.44/@marmoire/update_item_data.m b/lib/marsbar-0.44/@marmoire/update_item_data.m deleted file mode 100644 index 79f4ebf..0000000 --- a/lib/marsbar-0.44/@marmoire/update_item_data.m +++ /dev/null @@ -1,26 +0,0 @@ -function [o, errf] = update_item_data(o, item, data, filename) -% updates data for item (sets data, flags change) -% FORMAT [o, errf] = update_item_data(o, item, data, filename) -% -% o - object -% item - name of item to update for -% data - data to set -% filename - filename for data -% -% Returns -% o - object with data (probably) updated -% errf - flag is 1 if data was not updated for some reason -% -% $Id$ - -if nargin < 2 - error('Need item to set to'); -end -if nargin < 3 - data = NaN; -end -if nargin < 4 - filename = NaN; -end - -[o errf] = do_set(o, item, 'update', data, filename); diff --git a/lib/marsbar-0.44/@maroi/and.m b/lib/marsbar-0.44/@maroi/and.m deleted file mode 100644 index c871576..0000000 --- a/lib/marsbar-0.44/@maroi/and.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = and(o1, o2) -% overloaded add function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -if isa(o2, 'maroi'),o2 = back2base(o2);end -o = domaths('and', o1, o2); diff --git a/lib/marsbar-0.44/@maroi/are_same.m b/lib/marsbar-0.44/@maroi/are_same.m deleted file mode 100644 index a7d8167..0000000 --- a/lib/marsbar-0.44/@maroi/are_same.m +++ /dev/null @@ -1,23 +0,0 @@ -function tf = are_same(roi1, roi2, sp) -% returns 1 if rois are the same -% FORMAT tf = are_same(roi1, roi2) -% -% $Id$ - -if nargin < 2 - error('Need two ROIs'); -end -if nargin < 3 - sp = native_space(roi1); - if isempty(sp) - sp = native_space(roi2); - end - if isempty(sp) - error('Need space for comparison'); - end -end - -mat1 = matrixdata(maroi_matrix(roi1, sp)); -mat2 = matrixdata(maroi_matrix(roi2, sp)); - -tf = all(mat1(:)==mat2(:)); diff --git a/lib/marsbar-0.44/@maroi/back2base.m b/lib/marsbar-0.44/@maroi/back2base.m deleted file mode 100644 index eb5ed69..0000000 --- a/lib/marsbar-0.44/@maroi/back2base.m +++ /dev/null @@ -1,10 +0,0 @@ -function o = back2base(o) -% back2base method - check for spacebase, transform thereto -% -% $Id$ - -spb = my_classdata('spacebase'); -if isempty(spb) - error('Cannot do arithmetic without defined base space'); -end -o = maroi_matrix(o, spb); diff --git a/lib/marsbar-0.44/@maroi/binarize.m b/lib/marsbar-0.44/@maroi/binarize.m deleted file mode 100644 index 3582ac6..0000000 --- a/lib/marsbar-0.44/@maroi/binarize.m +++ /dev/null @@ -1,14 +0,0 @@ -function h = binarize(obj, val) -% binarize - returns / sets binarize value for object -% -% $Id$ - -if nargin > 1 - if ~(val == 0 | val == 1) - error('binarize is 0 or 1 flag'); - end - obj.binarize = val; - h = obj; -else - h = obj.binarize; -end diff --git a/lib/marsbar-0.44/@maroi/c_o_m.m b/lib/marsbar-0.44/@maroi/c_o_m.m deleted file mode 100644 index 904aa60..0000000 --- a/lib/marsbar-0.44/@maroi/c_o_m.m +++ /dev/null @@ -1,21 +0,0 @@ -function pt = c_o_m(o, sp, pt_type) -% c_o_m method - calculates unweighted centre of mass -% -% $Id$ - -if nargin < 2 - sp = native_space(o); -end -if nargin < 3 - pt_type = 'real'; -end -coords = voxpts(o, sp); -switch pt_type - case {'real','mm'} - coords = realpts(o, sp); - case 'vox' - coords = voxpts(o, sp); - otherwise - error(['Do not recognize point type' pt_type]); -end -pt = mean(coords, 2); diff --git a/lib/marsbar-0.44/@maroi/classdata.m b/lib/marsbar-0.44/@maroi/classdata.m deleted file mode 100644 index 8144923..0000000 --- a/lib/marsbar-0.44/@maroi/classdata.m +++ /dev/null @@ -1,7 +0,0 @@ -function cdata = classdata(obj, varargin) -% classdata method - sets/gets class data -% See help for private/my_classdata for more details -% -% $Id$ - -cdata = my_classdata(varargin{:}); diff --git a/lib/marsbar-0.44/@maroi/descrip.m b/lib/marsbar-0.44/@maroi/descrip.m deleted file mode 100644 index a43c31c..0000000 --- a/lib/marsbar-0.44/@maroi/descrip.m +++ /dev/null @@ -1,11 +0,0 @@ -function h = descrip(obj, val) -% name - returns / sets name value for object -% -% $Id$ - -if nargin > 1 - obj.descrip = val; - h = obj; -else - h = obj.descrip; -end diff --git a/lib/marsbar-0.44/@maroi/display.m b/lib/marsbar-0.44/@maroi/display.m deleted file mode 100644 index df70a94..0000000 --- a/lib/marsbar-0.44/@maroi/display.m +++ /dev/null @@ -1,53 +0,0 @@ -function display(obj) -% display - method -% -% $Id$ - -inp_str = [inputname(1) ' =']; - -sz = size(obj); -if prod(sz)>1 - arr_str = num2str(sz(1)); - for d = 2:length(sz) - arr_str = [arr_str 'x' num2str(sz(d))]; - end - arr_str = [arr_str ' maroi array with first element:']; - - if isequal(get(0,'FormatSpacing'),'compact') - disp(inp_str); - disp(arr_str); - else - disp(' ') - disp(inp_str); - disp(' '); - disp(arr_str); - end - inp_str = [inputname(1) '(1) =']; - obj = obj(1); -end - -X = struct(obj); -bO.label = label(obj); -bO.source = source(obj); -bO.binarize = binarize(obj); -bO.roithresh = roithresh(obj); -bO.spm_hold = spm_hold(obj); - -n = descrip(obj); -if isempty(n), n = '(no descrip)';end -src = ['[' class(obj) ' - ' n ']']; -if isequal(get(0,'FormatSpacing'),'compact') - disp(inp_str); - disp(src); - disp(bO) - disp(X) -else - disp(' ') - disp(inp_str); - disp(' '); - disp(src); - disp(' '); - disp(bO) - disp(' '); - disp(X) -end diff --git a/lib/marsbar-0.44/@maroi/eq.m b/lib/marsbar-0.44/@maroi/eq.m deleted file mode 100644 index 1ce6edb..0000000 --- a/lib/marsbar-0.44/@maroi/eq.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = eq(o1, o2) -% overloaded eq function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -if isa(o2, 'maroi'),o2 = back2base(o2);end -o = domaths('eq', o1, o2); diff --git a/lib/marsbar-0.44/@maroi/flip_lr.m b/lib/marsbar-0.44/@maroi/flip_lr.m deleted file mode 100644 index eca2a31..0000000 --- a/lib/marsbar-0.44/@maroi/flip_lr.m +++ /dev/null @@ -1,6 +0,0 @@ -function o = flip_lr(o) -% flips ROI left / right -% -% $Id$ - -error('Not defined for this ROI type'); diff --git a/lib/marsbar-0.44/@maroi/ge.m b/lib/marsbar-0.44/@maroi/ge.m deleted file mode 100644 index b90d4c8..0000000 --- a/lib/marsbar-0.44/@maroi/ge.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = ge(o1, o2) -% overloaded ge function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -if isa(o2, 'maroi'),o2 = back2base(o2);end -o = domaths('ge', o1, o2); diff --git a/lib/marsbar-0.44/@maroi/get_marsy.m b/lib/marsbar-0.44/@maroi/get_marsy.m deleted file mode 100644 index 55ab1b6..0000000 --- a/lib/marsbar-0.44/@maroi/get_marsy.m +++ /dev/null @@ -1,118 +0,0 @@ -function marsY = get_marsy(varargin) -% gets data in ROIs from images -% FORMAT marsY = get_marsy(roi1 [, roi2 [, roi3...]], VY, sumfunc, flags) -% -% roi1, roi2... - ROI objects -% This rather arcane call is needed because matlab -% does not allow different object types in an array -% VY - array of SPM vol structs, or image names, or SPM design -% sumfunc - one of 'mean', 'median', 'eigen1', 'wtmean' to summarize -% data in the ROIs -% flags - none or more of -% 'v' - selects verbose output to matlab console -% -% Returns -% marsY - MarsBaR data object -% -% $Id$ - -for r = 1:nargin - if ~isa(varargin{r}, 'maroi') - break - end -end -rlen = r - 1; -roi_array = varargin(1:rlen); - -narg_left = nargin - rlen; -if narg_left < 1 - VY = []; -else - VY = varargin{r}; -end -if isempty(VY), error('Need images to extract from'); end -if narg_left < 2 - sumfunc = ''; -else - sumfunc = varargin{r+1}; -end -if isempty(sumfunc), error('Need summary function'); end -if narg_left < 3 - flags = ''; -else - flags = varargin{r+2}; -end -if isempty(flags), flags = ' '; end -vf = any(flags == 'v'); - -% images can come from a design -des_summary = 'None'; -if isa(VY, 'mardo') - if ~has_images(VY) - error('This design does not contain images'); - end - D = VY; - VY = get_images(VY); -else - D = []; -end -% or be filenames -if ischar(VY) - if vf, fprintf('%-40s: ','Mapping files'); end - VY = spm_vol(VY); - if vf, fprintf('%30s\n','...done'); end -end - -if vf, fprintf('%-40s: %30s','Fetching data',' '); end -rlen = length(roi_array); -rno = 0; -for r = 1:rlen - if vf - fprintf('%s%30s',... - repmat(sprintf('\b'),1,30),... - sprintf('%4d/%-4d',r, rlen)); - end - o = roi_array{r}; - [y vals vXYZ mat] = getdata(o, VY); - [ny nvals] = size(y); - if isempty(y) - if vf, fprintf('\n'); end - warning(sprintf('No valid data for roi %d (%s)', r, label(o))); - if vf & (r < rlen), fprintf('%-40s: %30s','Fetching data',' '); end - else - rno = rno + 1; - % get data for regions - if all(vals == 1) - vals = []; - end - r_data{rno} = y; - r_info{rno} = struct(... - 'name', label(o),... - 'descrip', descrip(o),... - 'weights', vals,... - 'info', struct('file', source(o)),... - 'vXYZ', vXYZ,... - 'mat', mat); - if rno < 2, lbl = label(o); else lbl = [lbl ' & ' label(o)]; end - end -end -if vf, fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done'); end - -if rno == 0 - marsY = []; - return; -end - -s_info = struct(... - 'sumfunc', sumfunc, ... - 'descrip', ['Data from ' lbl],... - 'info', struct('VY', VY)); - -% Fill any available information from design if passed -if ~isempty(D) - s_info.info.des_summary = summary(D); - s_info.info.TR = tr(D); - s_info.block_rows = block_rows(D); -end - -marsY = marsy(r_data, r_info, s_info); diff --git a/lib/marsbar-0.44/@maroi/getdata.m b/lib/marsbar-0.44/@maroi/getdata.m deleted file mode 100644 index bf85573..0000000 --- a/lib/marsbar-0.44/@maroi/getdata.m +++ /dev/null @@ -1,122 +0,0 @@ -function [Y, multv, vXYZ, mat] = getdata(roiobj, data_imgs, flags) -% getdata method - fetches time series data for ROI from images -% FORMAT [Y multv vXYZ mat] = getdata(roiobj, data_imgs, flags) -% -% roiobj - an object of type maroi -% data_imgs - images to fetch data from. These can be in the form of -% a character array, or an array of type spm_vol (see -% spm_vol.m) -% -% flags can can be none or more of -% z - use zero masking for images without NaN represenation -% n - nearest neighbour resampling of images -% s - sinc resampling of images (why?) -% (trilinear resampling is the default) -% m - remap images -% l - Leave in columns with missing data -% -% If the resampling is not set with the flags input, then we use the resampling -% value from the ROI ``spm_hold`` value. -% -% default flags is empty -% -% Returns -% Y - no of images x no of voxels in ROI data matrix -% multv - weighting values from ROI (which have not been applied) -% vXYZ - voxel coordinates of ROI from first image in series -% mat - voxels -> mm mat file, again from first in series -% -% Matthew Brett 8/11/99, 2/8/01 (JBCP) -% -% $Id$ - -if nargin < 2 - error('Need ROI and data images'); -end -if nargin < 3 - flags = ''; -end -if isempty(flags) - flags = ' '; -end - -if ischar(data_imgs) - data_imgs = spm_vol(data_imgs); -elseif ~isstruct(data_imgs) - error('Input data files must be strings or structs') -elseif any(flags == 'm') - for i = 1:length(data_imgs) - data_imgs(i) = spm_vol(data_imgs(i).fname); - end -end - -% resampling = set by ROI hold value by default -if any(flags == 's') - holdval = -11; -elseif any(flags == 'n') - holdval = 0; -else % Not specified, use ROI default resampling value - holdval = spm_hold(roiobj); -end - -% NaN replacement -if any(flags == 'z') - zmask = 1; -else - zmask = 0; -end - -% get real points corresponding to first image in series -[XYZ multv] = realpts(roiobj, mars_space(data_imgs(1))); -dlen = length(multv); -if dlen == 0 % no points in space - Y = []; - return -end -XYZ = [XYZ; ones(size(multv))]; - -% check for same dims etc - which could save a bag of time -% Code a bit tricksy here to allow comparison of vector and 4x4 matrices -% without doing loops -%--------------------------------------------------------- -nimgs = length(data_imgs); -dims = cat(3,data_imgs(:).dim); -dims = dims(:, 1:3, :); % to allow for SPM2/SPM99 4 element dims -chgflgs = any(diff(dims,1,3)) | any(any(diff(cat(3,data_imgs(:).mat),1,3))); -chgflgs = [1; chgflgs(:)]; - -% create return matrix -Y = zeros(nimgs, dlen); - -for i = 1:nimgs - % nan replacement - i_type = mars_vol_utils('type', data_imgs(i)); - nanrep = spm_type(i_type, 'nanrep'); - - if chgflgs(i) % images not the same, (re)get resample points - ixyz = data_imgs(i).mat \ XYZ; - end - if i == 1; % record voxel XYZ for return - vXYZ = ixyz(1:3,:); - mat = data_imgs(1).mat; - end - % resample data at voxel centres of ROI - data = spm_sample_vol(data_imgs(i), ixyz(1,:),ixyz(2,:),ixyz(3,:),holdval); - % clear out missing values - if ~nanrep & zmask - data(data == 0) = NaN; - end - % return all the values - Y(i, :) = data; -end - -% strip missing data -if ~any(flags == 'l') - % Mask out columns with NaNs - msk = ~any(isnan(Y),1); - if ~all(msk) - Y = Y(:, msk); - multv = multv(msk); - end -end -return diff --git a/lib/marsbar-0.44/@maroi/gt.m b/lib/marsbar-0.44/@maroi/gt.m deleted file mode 100644 index f62e078..0000000 --- a/lib/marsbar-0.44/@maroi/gt.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = gt(o1, o2) -% overloaded gt (greater than) function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -if isa(o2, 'maroi'),o2 = back2base(o2);end -o = domaths('gt', o1, o2); diff --git a/lib/marsbar-0.44/@maroi/has_space.m b/lib/marsbar-0.44/@maroi/has_space.m deleted file mode 100644 index 0d2b6d0..0000000 --- a/lib/marsbar-0.44/@maroi/has_space.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = has_space(obj) -% has_space method - returns true if object has a native space -% -% $Id$ - -tf = 1; % default is true diff --git a/lib/marsbar-0.44/@maroi/history.m b/lib/marsbar-0.44/@maroi/history.m deleted file mode 100644 index 595d4b8..0000000 --- a/lib/marsbar-0.44/@maroi/history.m +++ /dev/null @@ -1,11 +0,0 @@ -function h = history(obj, val) -% history - returns / sets history value for object -% -% $Id$ - -if nargin > 1 - obj.history = val; - h = obj; -else - h = obj.history; -end diff --git a/lib/marsbar-0.44/@maroi/label.m b/lib/marsbar-0.44/@maroi/label.m deleted file mode 100644 index 3311491..0000000 --- a/lib/marsbar-0.44/@maroi/label.m +++ /dev/null @@ -1,11 +0,0 @@ -function h = label(obj, val) -% label - returns / sets label value for object -% -% $Id$ - -if nargin > 1 - obj.label = val; - h = obj; -else - h = obj.label; -end diff --git a/lib/marsbar-0.44/@maroi/le.m b/lib/marsbar-0.44/@maroi/le.m deleted file mode 100644 index ae3f954..0000000 --- a/lib/marsbar-0.44/@maroi/le.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = le(o1, o2) -% overloaded le (less than or equal to) function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -if isa(o2, 'maroi'),o2 = back2base(o2);end -o = domaths('le', o1, o2); diff --git a/lib/marsbar-0.44/@maroi/loadobj.m b/lib/marsbar-0.44/@maroi/loadobj.m deleted file mode 100644 index 14df6e9..0000000 --- a/lib/marsbar-0.44/@maroi/loadobj.m +++ /dev/null @@ -1,9 +0,0 @@ -function o = loadobj(o) -% loadobj method - fills fields needed for backwards compatibility -% -% $Id$ - -% add cvs tag -if ~isfield(o, 'cvs_version') - o.cvs_version = ''; -end diff --git a/lib/marsbar-0.44/@maroi/lt.m b/lib/marsbar-0.44/@maroi/lt.m deleted file mode 100644 index e324cd4..0000000 --- a/lib/marsbar-0.44/@maroi/lt.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = lt(o1, o2) -% overloaded lt (less than) function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -if isa(o2, 'maroi'),o2 = back2base(o2);end -o = domaths('lt', o1, o2); diff --git a/lib/marsbar-0.44/@maroi/maroi.m b/lib/marsbar-0.44/@maroi/maroi.m deleted file mode 100644 index 84acf41..0000000 --- a/lib/marsbar-0.44/@maroi/maroi.m +++ /dev/null @@ -1,169 +0,0 @@ -function [o, others] = maroi(params, varargin) -% maroi - class constructor for umbrella ROI object -% Can be called as a simple contructor: -% inputs [defaults] -% params - a structure, containing fields to construct the object -% -% or to load objects of this (or child) type) -% o = maroi('load', fname); -% or -% o = maroi(fname); -% (where fname is a string) -% or -% o_cell_arr = maroi(name_cell_arr); -% (where -% o_cell_arr is a cell array of ROI objects and -% name_cell_arr is a cell array of filenames) -% or -% o_cell_arr = maroi('load_cell', fnames) -% to load strings/cell array of strings into cell array of objects -% -% or to access class data -% res = maroi('classdata', p1, p2); (see classdata method) -% -% or to process a filename to be suitable for saving an ROI -% new_fn = maroi('filename', old_fn); -% -% An ROI is a definition of a region in space. As currently implemented, -% an ROI can be of three types: -% -% a shape - a geometric shape defined independent of any image -% e.g. sphere, box -% a point list - a list of points which are within the region, maybe with -% associated values (see below) -% a volume - a 3D volume, containing values for the ROI at each point -% e.g. matrix, image -% -% Usually, the ROI will be binary; i.e. any point that is within the -% region will have a value of 1, and all points outside have a value of -% 0. Because regions may be resampled into new image spaces, this -% binaryness needs to be enforced in the resampling; this is done if the -% 'binarize' flag is set for the object; the 'roithresh' field determines -% the value above which a point is considered within the region, after -% resampling. -% -% In addition to defining the region in space, the ROI may also define -% values for the points within the region. If an ROI defines values then it -% is a 'weighting' ROI (such as 0->1 probability weighting); those ROIs can -% contain different values across the region. Because of the problem of -% missing values when resampling an ROI (e.g sampling at the edge of a -% volume when using anything other than nearest neighbour resampling), -% weighting ROIs should be zero based, so that a value outside the -% region will be considered to have the value 0 in resampling. Values of -% NaN and 0 will always be assumed to be outside the region after -% resampling -% -% At the moment, each ROI is saved as a separate mat file, with filename -% _roi.mat -% -% $Id$ - -% Programmers' notes -% -% maroi is the parent for all ROI objects. It can contain no useful ROI -% itself, but implements functions for all objects of maroi type. Children -% will generally call this parent constructor with passed arguments. This -% constructor routine then sets fields contained in the parent maroi object, -% and removes the relevant fields from the passed structure, then returns -% the stripped structure to the caller, so that it can use any extra -% arguments to set child properties, etc -% -% Fields are [defaults - which may well be overidden by children]: -% source - filename for roi object [''] -% label - 16 character label for outputting -% descrip - (maybe) prolix description of ROI [''] -% history - string specifying processing done to ROI [''] -% spm_hold - defines resampling method when reslicing ROI into different -% space (see spm_sample_vol.m) [1] -% binarize - flag to indicate this is a binary ROI. -% if == 1, The object will always return binary values; this is -% enforced at object initialization, and during during -% resampling [1] -% -% roithresh - absolute threshold above which a point is considered within -% the ROI. With binarize flad set, this value -% will usually be 0.5 (see defaults set in classdata). With -% binarize flag unset, iw will usually be eps. These defaults -% are set using the classdata variable -% -% Methods that must be defined for a maroi object are -% [pts vals] = voxpts(obj, space) -% [pts vals] = realpts(obj, space) -% timeseries = getdata(obj, images, [flags]); -% mobj = maroi_matrix(obj, [space]) -% -% In constructor calls: -% params passed are fields for current object, and for any parents -% (thus there must be no overlap in field names between child and parent -% objects, which in can in any case be confusing). -% -% Matthew Brett 21/9/01 (AR) - -myclass = 'maroi'; -defstruct = struct(... - 'source','',... - 'label','',... - 'descrip', '',... - 'history','',... - 'spm_hold', my_classdata('def_hold'),... - 'binarize',1,... - 'roithresh', my_classdata('def_binthresh')); - -if nargin < 1 - params = []; -end -if isa(params, myclass) - o = params; - return -end - -% parse out string action calls (class data, helper functions) -if ischar(params) - switch params - case 'classdata' - o = my_classdata(varargin{:}); - case 'load' - o = my_loadroi(varargin{1}); - case 'load_cell' - params = varargin{1}; - if ischar(params), params = cellstr(params); - elseif ~iscell(params), params = {params}; end - o = maroi(params); - case 'filename' - o = my_roifname(varargin{:}); - otherwise % single filename - if size(params, 1) > 1 - error('Use cell form of call to load multiple objects'); - end - o = my_loadroi(params); - end - return -end - -% cell array - array of filenames, or objects, or something -if iscell(params) - sz = size(params); - o = cell(sz); - for r = 1:prod(sz) - o{r} = maroi(params{r}); - end - return -end - -% fill with defaults, parse into fields for this object, children -[pparams, others] = mars_struct('ffillsplit', defstruct, params); - -% Check for default thresholds according to binarize flag -if isfield(params, 'binarize') && ~isempty(params.binarize) && ... - params.binarize == 0 && ( ~isfield(params, 'roithresh') || ... - isempty(params.roithresh)) - pparams.roithresh = my_classdata('def_wtthresh'); -end - -% add version tag (was CVS; now marsbar version) -pparams.cvs_version = marsbar('ver'); - -% Set as object -o = class(pparams, myclass); - -return diff --git a/lib/marsbar-0.44/@maroi/maroi_matrix.m b/lib/marsbar-0.44/@maroi/maroi_matrix.m deleted file mode 100644 index d4436f1..0000000 --- a/lib/marsbar-0.44/@maroi/maroi_matrix.m +++ /dev/null @@ -1,8 +0,0 @@ -function obj2 = maroi_matrix(obj, sp) -% maroi_matrix method - converts roi to maroi matrix type -% In this case, the function only checks why it has been inappropriately -% called (if useful, it should have been overridden) -% -% $Id$ - -error('Unexpected call to maroi_matrix on object with no method'); diff --git a/lib/marsbar-0.44/@maroi/minus.m b/lib/marsbar-0.44/@maroi/minus.m deleted file mode 100644 index 42d8ebd..0000000 --- a/lib/marsbar-0.44/@maroi/minus.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = minus(o1, o2) -% overloaded minus function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -if isa(o2, 'maroi'),o2 = back2base(o2);end -o = domaths('minus', o1, o2); diff --git a/lib/marsbar-0.44/@maroi/mrdivide.m b/lib/marsbar-0.44/@maroi/mrdivide.m deleted file mode 100644 index 10f70ee..0000000 --- a/lib/marsbar-0.44/@maroi/mrdivide.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = mrdivide(o1, o2) -% overloaded mrdivide (matrix right divide) function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -if isa(o2, 'maroi'),o2 = back2base(o2);end -o = domaths('divide', o1, o2); diff --git a/lib/marsbar-0.44/@maroi/mtimes.m b/lib/marsbar-0.44/@maroi/mtimes.m deleted file mode 100644 index ca5421e..0000000 --- a/lib/marsbar-0.44/@maroi/mtimes.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = mtimes(o1, o2) -% overloaded mtimes function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -if isa(o2, 'maroi'),o2 = back2base(o2);end -o = domaths('times', o1, o2); diff --git a/lib/marsbar-0.44/@maroi/native_space.m b/lib/marsbar-0.44/@maroi/native_space.m deleted file mode 100644 index 51e7393..0000000 --- a/lib/marsbar-0.44/@maroi/native_space.m +++ /dev/null @@ -1,6 +0,0 @@ -function sp = native_space(obj) -% native_space method - returns native space of object -% -% $Id$ - -sp = maroi('classdata', 'spacebase'); diff --git a/lib/marsbar-0.44/@maroi/ne.m b/lib/marsbar-0.44/@maroi/ne.m deleted file mode 100644 index 2a983d7..0000000 --- a/lib/marsbar-0.44/@maroi/ne.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = ne(o1, o2) -% overloaded ne function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -if isa(o2, 'maroi'),o2 = back2base(o2);end -o = domaths('ne', o1, o2); diff --git a/lib/marsbar-0.44/@maroi/not.m b/lib/marsbar-0.44/@maroi/not.m deleted file mode 100644 index ad76d68..0000000 --- a/lib/marsbar-0.44/@maroi/not.m +++ /dev/null @@ -1,7 +0,0 @@ -function o = not(o1) -% overloaded not function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -o = domaths('not', o1); diff --git a/lib/marsbar-0.44/@maroi/or.m b/lib/marsbar-0.44/@maroi/or.m deleted file mode 100644 index 407034b..0000000 --- a/lib/marsbar-0.44/@maroi/or.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = or(o1, o2) -% overloaded or function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -if isa(o2, 'maroi'),o2 = back2base(o2);end -o = domaths('or', o1, o2); diff --git a/lib/marsbar-0.44/@maroi/paramfields.m b/lib/marsbar-0.44/@maroi/paramfields.m deleted file mode 100644 index ff7c40a..0000000 --- a/lib/marsbar-0.44/@maroi/paramfields.m +++ /dev/null @@ -1,10 +0,0 @@ -function params = paramfields(o) -% returns struct with fields from maroi object useful for copying objects -% -% $Id$ - -params = struct('spm_hold', o.spm_hold,... - 'binarize', o.binarize,... - 'roithresh', o.roithresh,... - 'descrip', o.descrip,... - 'label', o.label); diff --git a/lib/marsbar-0.44/@maroi/plus.m b/lib/marsbar-0.44/@maroi/plus.m deleted file mode 100644 index 8a38cb4..0000000 --- a/lib/marsbar-0.44/@maroi/plus.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = plus(o1, o2) -% overloaded plus function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -if isa(o2, 'maroi'),o2 = back2base(o2);end -o = domaths('plus', o1, o2); diff --git a/lib/marsbar-0.44/@maroi/private/my_classdata.m b/lib/marsbar-0.44/@maroi/private/my_classdata.m deleted file mode 100644 index cb41dec..0000000 --- a/lib/marsbar-0.44/@maroi/private/my_classdata.m +++ /dev/null @@ -1,66 +0,0 @@ -function cdata = my_classdata(fieldname, value) -% my_classdata method - sets/gets class data -% maroi class data is implemented with a persistent variable -% CLASSDATA This is a structure containing fields -% -% spacebase - space in which to do ROI combination -% fileend - filename end with extension for ROI files -% def_binthresh - default roithresh for binarize ROIs -% def_wtthresh - default roithresh for non-binarize ROIs -% -% Field values can be returned with the call -% maroi('classdata') - which returns the whole structure -% or maroi('classdata', fieldname) - which returns field data -% -% Field values can be set with the call -% maroi('classdata', fieldname, value) OR -% maroi('classdata', struct) where struct contains fields matching those -% in CLASSDATA -% -% The same functionality results from -% classdata(maroi_obj, fieldname) etc. -% -% Matthew Brett 1/8/01 (MRD+) -% -% $Id$ - -persistent CLASSDATA -if isempty(CLASSDATA) - % default space is that of the SPM templates - t1mat = [2 0 0 -92; ... - 0 2 0 -128; ... - 0 0 2 -74; ... - 0 0 0 1]; - CLASSDATA = struct(... - 'spacebase', mars_space([91 109 91], t1mat), ... - 'fileend','_roi.mat',... - 'def_hold', 1,... - 'def_binthresh', 0.5,... - 'def_wtthresh', eps); - -end - -if nargin < 1 % simple classdata call - cdata = CLASSDATA; - return -end -if nargin < 2 && ~isstruct(fieldname) % fieldname get call - if isfield(CLASSDATA, fieldname) - cdata = getfield(CLASSDATA,fieldname); - else - cdata = []; - end - return -end - -% some sort of set call -if ~isstruct(fieldname) - fieldname = struct(struct(fieldname, value)); -end -for field = fieldnames(fieldname) - if isfield(CLASSDATA, field{1}) - CLASSDATA = setfield(CLASSDATA, field{1},... - getfield(fieldname, field{1})); - end -end -cdata = CLASSDATA; diff --git a/lib/marsbar-0.44/@maroi/private/my_loadroi.m b/lib/marsbar-0.44/@maroi/private/my_loadroi.m deleted file mode 100644 index 30ccfd5..0000000 --- a/lib/marsbar-0.44/@maroi/private/my_loadroi.m +++ /dev/null @@ -1,22 +0,0 @@ -function o = my_loadroi(fname) -% my_loadroi function - loads ROI from file, sets source field -% -% $Id$ - -if isa(fname, 'maroi') % already loaded - o = fname; - return -end - -o = []; -if iscell(fname), fname = char(fname); end -if size(fname, 1) > 1, error('Can only load one ROI at a time'); end -if isempty(fname), warning('Empty filename'), return, end -fname = deblank(fname); -F = load(fname); -if isfield(F, 'roi') & isa(F.roi, 'maroi') - o = F.roi; - o = source(o, fname); -else - warning(['Loading file ' fname ' did not return an ROI'])' -end diff --git a/lib/marsbar-0.44/@maroi/private/my_roifname.m b/lib/marsbar-0.44/@maroi/private/my_roifname.m deleted file mode 100644 index 198c41a..0000000 --- a/lib/marsbar-0.44/@maroi/private/my_roifname.m +++ /dev/null @@ -1,22 +0,0 @@ -function roifname = my_roifname(fname) -% changes fname to appropriate ROI format -% -% $Id$ - -if nargin < 1 - fname = []; -end -roifname = fname; -if isempty(fname) - return -end -gend = maroi('classdata', 'fileend'); -lg = length(gend); - -[p f e] = fileparts(roifname); -f2 = [f e]; -if length(f2) 1 - if val < 0 | val > 1 - error('Value must be between 0 and 1'); - end - obj.roithresh = val; - h = obj; -else - h = obj.roithresh; -end diff --git a/lib/marsbar-0.44/@maroi/save_as_image.m b/lib/marsbar-0.44/@maroi/save_as_image.m deleted file mode 100644 index 71b0cb4..0000000 --- a/lib/marsbar-0.44/@maroi/save_as_image.m +++ /dev/null @@ -1,13 +0,0 @@ -function v = save_as_image(o, fname, sp) -% method save_as_image - saves ROI as image -% -% $Id$ - -if nargin < 2 - error('Need ROI and filename'); -end -if nargin < 3 - sp = []; -end -o = maroi_matrix(o, sp); -v = do_write_image(o, fname); diff --git a/lib/marsbar-0.44/@maroi/save_mricro.m b/lib/marsbar-0.44/@maroi/save_mricro.m deleted file mode 100644 index f635e98..0000000 --- a/lib/marsbar-0.44/@maroi/save_mricro.m +++ /dev/null @@ -1,18 +0,0 @@ -function save_mricro(o, fname, sp) -% saves in MRIcro format -% -% $Id$ - -if nargin < 2 - error('Need filename for MRIcro save'); -end -if nargin < 3 - sp = native_space(o); -end -rlem = rle(o, sp); -fid = fopen(fname, 'wb'); -if fid == -1 - error(['Could not open file ' fname]); -end -fclose(fid); -error('Come to think of it, I don''t understand the format anyhow'); diff --git a/lib/marsbar-0.44/@maroi/saveroi.m b/lib/marsbar-0.44/@maroi/saveroi.m deleted file mode 100644 index c252199..0000000 --- a/lib/marsbar-0.44/@maroi/saveroi.m +++ /dev/null @@ -1,13 +0,0 @@ -function roi = saveroi(roi, fname) -% saveroi method - checks fname, sets source field, saves object -% -% $Id$ - -if nargin < 2 - fname = source(roi); -end -if isempty(fname) - error('Need filename for save'); -end -roi.source = fname; -save(roi.source, 'roi'); diff --git a/lib/marsbar-0.44/@maroi/source.m b/lib/marsbar-0.44/@maroi/source.m deleted file mode 100644 index b89fd53..0000000 --- a/lib/marsbar-0.44/@maroi/source.m +++ /dev/null @@ -1,11 +0,0 @@ -function h = source(obj, val) -% source - returns / sets source value for object -% -% $Id$ - -if nargin > 1 - obj.source = val; - h = obj; -else - h = obj.source; -end diff --git a/lib/marsbar-0.44/@maroi/spm_hold.m b/lib/marsbar-0.44/@maroi/spm_hold.m deleted file mode 100644 index 6e04687..0000000 --- a/lib/marsbar-0.44/@maroi/spm_hold.m +++ /dev/null @@ -1,11 +0,0 @@ -function h = spm_hold(obj, val) -% hold - returns / sets hold value for object -% -% $Id$ - -if nargin > 1 - obj.spm_hold = val; - h = obj; -else - h = obj.spm_hold; -end diff --git a/lib/marsbar-0.44/@maroi/times.m b/lib/marsbar-0.44/@maroi/times.m deleted file mode 100644 index b52f9fe..0000000 --- a/lib/marsbar-0.44/@maroi/times.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = times(o1, o2) -% overloaded times function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -if isa(o2, 'maroi'),o2 = back2base(o2);end -o = domaths('times', o1, o2); diff --git a/lib/marsbar-0.44/@maroi/volume.m b/lib/marsbar-0.44/@maroi/volume.m deleted file mode 100644 index cc99255..0000000 --- a/lib/marsbar-0.44/@maroi/volume.m +++ /dev/null @@ -1,9 +0,0 @@ -function v = volume(obj) -% volume method - returns volume of ROI in mm -% -% $Id$ - -sp = native_space(obj); -XYZ = voxpts(obj,sp); -vox = sqrt(sum(sp.mat(1:3,1:3)'.^2)); -v = size(XYZ,2) * prod(vox); diff --git a/lib/marsbar-0.44/@maroi/xor.m b/lib/marsbar-0.44/@maroi/xor.m deleted file mode 100644 index b219c54..0000000 --- a/lib/marsbar-0.44/@maroi/xor.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = xor(o1, o2) -% overloaded xor function -% -% $Id$ - -if isa(o1, 'maroi'),o1 = back2base(o1);end -if isa(o2, 'maroi'),o2 = back2base(o2);end -o = domaths('xor', o1, o2); diff --git a/lib/marsbar-0.44/@maroi_box/centre.m b/lib/marsbar-0.44/@maroi_box/centre.m deleted file mode 100644 index a5d21e1..0000000 --- a/lib/marsbar-0.44/@maroi_box/centre.m +++ /dev/null @@ -1,9 +0,0 @@ -function c = centre(obj, val) -% centre method - sets / returns centre of ROI in mm -% -% $Id$ - -if nargin > 1 - obj.centre = val; -end -c = obj.centre; diff --git a/lib/marsbar-0.44/@maroi_box/flip_lr.m b/lib/marsbar-0.44/@maroi_box/flip_lr.m deleted file mode 100644 index e86c9c3..0000000 --- a/lib/marsbar-0.44/@maroi_box/flip_lr.m +++ /dev/null @@ -1,6 +0,0 @@ -function o = flip_lr(o) -% flips ROI left / right -% -% $Id$ - -o.centre(1) = o.centre(1)*-1; diff --git a/lib/marsbar-0.44/@maroi_box/is_empty_roi.m b/lib/marsbar-0.44/@maroi_box/is_empty_roi.m deleted file mode 100644 index c244e1e..0000000 --- a/lib/marsbar-0.44/@maroi_box/is_empty_roi.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = is_empty_roi(o) -% returns 1 if ROI contains no volume -% -% $Id$ - -tf = isempty(o.centre); diff --git a/lib/marsbar-0.44/@maroi_box/maroi_box.m b/lib/marsbar-0.44/@maroi_box/maroi_box.m deleted file mode 100644 index f205333..0000000 --- a/lib/marsbar-0.44/@maroi_box/maroi_box.m +++ /dev/null @@ -1,42 +0,0 @@ -function o = maroi_box(params) -% maroi_box - class constructor -% inputs [defaults] -% params - a structure containing any fields for a maroi parent and -% .centre - a 1x3 coordinate in mm -% .widths - 1x3 widths in X Y Z in mm -% -% $Id$ - -myclass = 'maroi_box'; -defstruct = struct('centre', [0 0 0], 'widths', [0 0 0]); - -if nargin < 1 - params = []; -end -if isa(params, myclass) - o = params; - return -end - -% fill with defaults -pparams = mars_struct('ffillmerge', defstruct, params); - -% umbrella object, parse out fields for (this object and children) -[uo, pparams] = maroi_shape(pparams); - -% reparse parameters into those for this object, children -[pparams, others] = mars_struct('split', pparams, defstruct); - -% check resulting input -if size(pparams.centre, 2) == 1 - pparams.centre = pparams.centre'; -end -if size(pparams.widths, 2) == 1 - pparams.widths = pparams.widths'; -end -if size(pparams.widths, 2) == 1 - pparams.widths = ones(1,3) * pparams.widths; -end - -o = class(pparams, myclass, uo); -return diff --git a/lib/marsbar-0.44/@maroi_box/volume.m b/lib/marsbar-0.44/@maroi_box/volume.m deleted file mode 100644 index f0ed306..0000000 --- a/lib/marsbar-0.44/@maroi_box/volume.m +++ /dev/null @@ -1,6 +0,0 @@ -function v = volume(obj) -% volume method - returns volume of ROI in mm -% -% $Id$ - -v = prod(obj.widths); diff --git a/lib/marsbar-0.44/@maroi_box/voxpts.m b/lib/marsbar-0.44/@maroi_box/voxpts.m deleted file mode 100644 index ce735d1..0000000 --- a/lib/marsbar-0.44/@maroi_box/voxpts.m +++ /dev/null @@ -1,25 +0,0 @@ -function [pts, vals] = voxpts(obj, sp) -% voxpts method - voxels within a box in given space -% -% $Id$ - -if nargin < 2 - error('Need object and space arguments'); -end -sp = mars_space(sp); - -mc = obj.centre; -mw = obj.widths; - -% find voxels that are within box -dim = sp.dim(1:3); dim = dim(:); -vox = sqrt(sum(sp.mat(1:3,1:3)'.^2)); -vd = mw ./ vox / 2; -vc = sp.mat \ [mc(1:3) 1]'; -vc = vc(1:3)'; -blim = [max([1 1 1; ceil(vc-vd)]); min([sp.dim(1:3); floor(vc+vd)])]; -[R,C,P]=ndgrid(... - blim(1,1):blim(2,1),blim(1,2):blim(2,2),blim(1,3):blim(2,3)); -pts = [R(:)';C(:)';P(:)']; - -vals = ones(1, size(pts, 2)); diff --git a/lib/marsbar-0.44/@maroi_image/flip_lr.m b/lib/marsbar-0.44/@maroi_image/flip_lr.m deleted file mode 100644 index acff33c..0000000 --- a/lib/marsbar-0.44/@maroi_image/flip_lr.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = flip_lr(o) -% flips ROI left / right -% -% $Id - -% Requires change to ROI data -> return as maroi_matrix - -o = flip_lr(maroi_matrix(o)); diff --git a/lib/marsbar-0.44/@maroi_image/loadobj.m b/lib/marsbar-0.44/@maroi_image/loadobj.m deleted file mode 100644 index 3239631..0000000 --- a/lib/marsbar-0.44/@maroi_image/loadobj.m +++ /dev/null @@ -1,22 +0,0 @@ -function o = loadobj(o) -% loadobj method - reloads matrix from img file -% -% $Id$ - -% Note that the image needs full processing before -% setting into the matrix. After this, the processed -% natrix data becomes an image snapshot for the memory -% lifetime of the object - -[img errstr] = my_vol_func(o); -if isempty(img) - if strcmp(errstr, 'Cant open image file.') - errstr = sprintf('%s\nHas ROI image %s been moved?\n%s\n', ... - errstr, o.vol.fname,... - 'Try to reattach with marsbar(''attach_image'')'); - end - error(errstr); -end - -% set using maroi_matrix object to avoid object conversion -o.maroi_matrix = matrixdata(o.maroi_matrix,img); diff --git a/lib/marsbar-0.44/@maroi_image/maroi_image.m b/lib/marsbar-0.44/@maroi_image/maroi_image.m deleted file mode 100644 index 593e499..0000000 --- a/lib/marsbar-0.44/@maroi_image/maroi_image.m +++ /dev/null @@ -1,67 +0,0 @@ -function [o, others] = maroi_image(params) -% maroi_image - class constructor -% inputs [defaults] -% params - filename, for image defining ROI -% or spm vol struct (see spm_vol) -% -% This ROI type is a child of the maroi_matrix type. maroi_image ROIs are -% static, in that they are defined by a particular image, and optionally, a -% function to apply to the image. If the image changes, so will the ROI. -% However, the ROI will not change the image, so, if any changes are made to -% the ROI, such as flips, setting of the data directly using the matrixdata -% function of maroi_matrix, etc, then the ROI automatically become a -% maroi_matrix type, and is detached from the image. -% -% Note that the image is referenced by an absolute path, so if the path -% to the image changes, loading the ROI will fail. Reassociate the image -% with an ROI using the vol method. -% -% $Id$ - -myclass = 'maroi_image'; -defstruct = struct('vol', [],'func', ''); - -if nargin < 1 - params = []; -end -if isa(params, myclass) - o = params; - return -end - -% check for filename; -if ischar(params) - params.vol = spm_vol(params); -end -% check for vol struct -if isfield(params, 'fname') - params.vol = params; -end - -% fill with defaults -pparams = mars_struct('ffillmerge', defstruct, params); - -if ~isempty(pparams.vol) % check for attempt at create empty object - - % check and process vol and func - [img errstr] = my_vol_func(pparams.vol, pparams.func); - if isempty(img), error(errstr); end - - % prepare for maroi_matrix creation - pparams.dat = img; - pparams.mat = pparams.vol.mat; - - % fill source information if empty - if ~isfield(pparams, 'source') | isempty(pparams.source) - pparams.source = maroi('filename',pparams.vol.fname); - end -end - -% umbrella object, parse out fields for (this object and children) -[uo, pparams] = maroi_matrix(pparams); - -% reparse parameters into those for this object, children -[pparams, others] = mars_struct('split', pparams, defstruct); - -o = class(pparams, myclass, uo); -return diff --git a/lib/marsbar-0.44/@maroi_image/maroi_matrix.m b/lib/marsbar-0.44/@maroi_image/maroi_matrix.m deleted file mode 100644 index cf60b5d..0000000 --- a/lib/marsbar-0.44/@maroi_image/maroi_matrix.m +++ /dev/null @@ -1,9 +0,0 @@ -function o = maroi_matrix(o, sp) -% maroi_matrix method - converts maroi_image to maroi_matrix -% -% $Id$ - -o = o.maroi_matrix; -if nargin > 1 - o = maroi_matrix(o, sp); -end diff --git a/lib/marsbar-0.44/@maroi_image/private/my_vol_func.m b/lib/marsbar-0.44/@maroi_image/private/my_vol_func.m deleted file mode 100644 index 32fbf1f..0000000 --- a/lib/marsbar-0.44/@maroi_image/private/my_vol_func.m +++ /dev/null @@ -1,70 +0,0 @@ -function [img, errstr] = my_vol_func(vol, func) -% checks vol and func, returns processed image matrix or error -% -% $Id$ - -if nargin < 1 - error('Need object or vol struct'); -end -if isa(vol, 'maroi_image') - [vol def_func] = deal(vol.vol, vol.func); -else - def_func = ''; -end -if nargin < 2 - func = ''; -end -if isempty(func), func = def_func; end - -img = []; -errstr = ''; - -if ischar(vol) % filename passed? - try - vol = spm_vol(vol); - catch - errstr = lasterr; - return - end -end - -if isempty(vol) - errstr = 'vol is empty'; - return -end -if ~isstruct(vol) - errstr = 'vol is not struct'; - return -end -if ~isfield(vol, 'fname') - errstr = 'vol does not contain fname field'; - return -end - -try - % load image into matrix - img = spm_read_vols(vol); -catch - errstr = lasterr; - return -end - -% apply and check function if passed -if ~isempty(func) - sz = size(img); - try - img = double(eval(func)); - catch - errstr = lasterr; - img = []; - return - end - - % check that the image has not changed size - sz2 = size(img); - if length(sz) ~= length(sz2) | any(sz ~= sz2) - img = []; - errstr = sprintf('Bad function "%s" - the image has changed size',... - func); - end -end diff --git a/lib/marsbar-0.44/@maroi_image/saveobj.m b/lib/marsbar-0.44/@maroi_image/saveobj.m deleted file mode 100644 index fcaa9ca..0000000 --- a/lib/marsbar-0.44/@maroi_image/saveobj.m +++ /dev/null @@ -1,7 +0,0 @@ -function o = saveobj(o) -% saveobj method - removes matrix information from parent to save space -% -% $Id$ - -% set using maroi_matrix object to avoid object conversion -o.maroi_matrix = matrixdata(o.maroi_matrix, []); diff --git a/lib/marsbar-0.44/@maroi_image/vol.m b/lib/marsbar-0.44/@maroi_image/vol.m deleted file mode 100644 index 3ad5288..0000000 --- a/lib/marsbar-0.44/@maroi_image/vol.m +++ /dev/null @@ -1,13 +0,0 @@ -function h = vol(obj, val) -% vol - returns / sets image vol for object -% -% $Id$ - -if nargin > 1 - img = my_vol_func(val, obj.func); - obj.vol = val; - obj = matrixdata(obj, img); - h = obj; -else - h = obj.vol; -end diff --git a/lib/marsbar-0.44/@maroi_matrix/do_write_image.m b/lib/marsbar-0.44/@maroi_matrix/do_write_image.m deleted file mode 100644 index 5ebdc9b..0000000 --- a/lib/marsbar-0.44/@maroi_matrix/do_write_image.m +++ /dev/null @@ -1,18 +0,0 @@ -function v = do_write_image(o, fname) -% method saves matrix as image and returns spm_vol -% -% $Id$ - -v = mars_vol_utils('def_vol'); -v.fname = fname; -v.mat = o.mat; -v.dim = size(o.dat); - -if binarize(o) - v = mars_vol_utils('set_type', v, 'uint8'); -else - v = mars_vol_utils('set_type', v, 'float'); -end - -v = spm_create_vol(v); -v = spm_write_vol(v, o.dat); diff --git a/lib/marsbar-0.44/@maroi_matrix/domaths.m b/lib/marsbar-0.44/@maroi_matrix/domaths.m deleted file mode 100644 index 3081729..0000000 --- a/lib/marsbar-0.44/@maroi_matrix/domaths.m +++ /dev/null @@ -1,101 +0,0 @@ -function o = domaths(func, dat1, dat2) -% helper function to do maths on matrix object -% Binary operations (& | ~ xor etc) return binarize type objects -% Other operations return not-binarize type objects -% ROI reslicing thresholds are set from defaults -% -% $Id$ - -if nargin < 2 - error('Need function and object'); -end -if nargin < 3 - dat2 = []; -end -d1 = describething(dat1); -d2 = describething(dat2); - -if isa(dat1, 'maroi') - o = dat1; dat1 = dat1.dat; -else % second must be an object - o = dat2; -end -if isa(dat2, 'maroi') - dat2 = dat2.dat; -end - -if nargin < 3 % no second object - d = sprintf('%s(%s)', func, d1); -else % there is a second object / thing - d = sprintf('%s(%s, %s)', func, d1, d2); -end - -switch func - case 'and' - o.dat = dat1 & dat2; - case 'or' - o.dat = dat1 | dat2; - case 'not' - o.dat = ~dat1; - case 'xor' - o.dat = xor(dat1, dat2); - case 'plus' - o.dat = dat1 + dat2; - case 'minus' - o.dat = dat1 - dat2; - case 'times' - o.dat = dat1 .* dat2; - case 'divide' - o.dat = dat1 ./ dat2; - case 'lt' - o.dat = dat1 < dat2; - case 'gt' - o.dat = dat1 > dat2; - case 'le' - o.dat = dat1 <= dat2; - case 'ge' - o.dat = dat1 >= dat2; - case 'eq' - o.dat = dat1 == dat2; - case 'ne' - o.dat = dat1 ~= dat2; - otherwise - error(['Function ' func ' not yet defined']); -end - -% convert from logical to double if necessary -o.dat = double(o.dat); - -binf = ismember(func, {... - 'and',... - 'or',... - 'not',... - 'xor',... - 'lt',... - 'gt',... - 'le',... - 'ge',... - 'eq',... - 'ne'}); - -o = binarize(o, binf); -if binf - o = roithresh(o, maroi('classdata', 'def_binthresh')); -else - o = roithresh(o, maroi('classdata', 'def_wtthresh')); -end -o = descrip(o, d); -o = source(o, ''); - -function d = describething(o) -if isa(o, 'maroi') - d = descrip(o); -elseif isnumeric(o) - if prod(size(o)) == 1 % scalar - d = num2str(o); - else - d = '[matrix]'; - end -else - d = '[non numeric input]'; -end diff --git a/lib/marsbar-0.44/@maroi_matrix/flip_lr.m b/lib/marsbar-0.44/@maroi_matrix/flip_lr.m deleted file mode 100644 index 8eca561..0000000 --- a/lib/marsbar-0.44/@maroi_matrix/flip_lr.m +++ /dev/null @@ -1,7 +0,0 @@ -function o = flip_lr(o) -% flips ROI left / right -% -% $Id$ - -M = eye(4); M(1) = -1; -o.mat = M * o.mat; diff --git a/lib/marsbar-0.44/@maroi_matrix/is_empty_roi.m b/lib/marsbar-0.44/@maroi_matrix/is_empty_roi.m deleted file mode 100644 index a1bf08c..0000000 --- a/lib/marsbar-0.44/@maroi_matrix/is_empty_roi.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = is_empty_roi(o) -% is_empty_roi - returns true if ROI contains no volume -% -% $Id$ - -tf = ~any(o.dat(:)); diff --git a/lib/marsbar-0.44/@maroi_matrix/loadobj.m b/lib/marsbar-0.44/@maroi_matrix/loadobj.m deleted file mode 100644 index f438aef..0000000 --- a/lib/marsbar-0.44/@maroi_matrix/loadobj.m +++ /dev/null @@ -1,10 +0,0 @@ -function o = loadobj(o) -% loadobj function - undoes run length encoding if appropriate -% -% $Id$ - -m = o.dat; -if isfield(m, 'rlem') - dat = my_rld(m.rlem); - o.dat = reshape(dat, m.dim); -end diff --git a/lib/marsbar-0.44/@maroi_matrix/maroi_matrix.m b/lib/marsbar-0.44/@maroi_matrix/maroi_matrix.m deleted file mode 100644 index 47c9d17..0000000 --- a/lib/marsbar-0.44/@maroi_matrix/maroi_matrix.m +++ /dev/null @@ -1,72 +0,0 @@ -function [o, others] = maroi_matrix(params, space) -% maroi_matrix - class constructor -% There are two usual forms of the call: -% 1) Constructor call: obj = maroi_matrix(params); -% where input is [defaults] -% params - a structure containing any fields for a maroi parent and -% .dat - a matrix -% .mat - mapping of matrix indices to mm -% -% 2) Rebase call: obj = maroi_matrix(obj, space) -% where input is [defaults] -% obj - a maroi_matrix object -% space - mars_space object defining space to reslice to -% -% This maroi_matrix object is used for conversion between -% different types of rois, and for combining rois -% Much of the work is in the converter routines for other roi objects, to -% return objects of this type -% -% $Id$ - -myclass = 'maroi_matrix'; -defstruct = struct('dat', [],'mat', eye(4)); - -if nargin < 1 - params = []; -end -if isa(params, myclass) - o = params; - if nargin < 2 % simple object return call - return - end - % Rebase call - if isempty(space) - space = native_space(o); - if isempty(space) - error('Cannot define default space for object'); - end - else - space = mars_space(space); - end - - % check if this in fact the same as object native space - if space == native_space(o), return, end - % if not, then rebase - params = paramfields(o); - params.label = [params.label '_rebased']; - params.descrip = [params.descrip ': rebased']; - params.dat = rebase(o,space,'i'); - params.mat = space.mat; - o = maroi_matrix(params); - return -end - -% Constructor call - -% fill with defaults -pparams = mars_struct('ffillmerge', defstruct, params); - -% umbrella object, parse out fields for (this object and children) -[uo, pparams] = maroi(pparams); - -% reparse parameters into those for this object, children -[pparams, others] = mars_struct('split', pparams, defstruct); - -% bless into object -o = class(pparams, myclass, uo); - -% apply implied thresholding -o = matrixdata(o, o.dat); - -return diff --git a/lib/marsbar-0.44/@maroi_matrix/matrixdata.m b/lib/marsbar-0.44/@maroi_matrix/matrixdata.m deleted file mode 100644 index 3cc66ba..0000000 --- a/lib/marsbar-0.44/@maroi_matrix/matrixdata.m +++ /dev/null @@ -1,21 +0,0 @@ -function dat = matrixdata(o, dat) -% matrixdata method - gets matrix from ROI object -% -% $Id$ - -% a warning here about empty matrices -if nargin > 1 % call to set matrix data - % change to maroi_matrix type before setting data - o = maroi_matrix(o); - - % apply implied thresholding - tmp = find(isnan(dat) | abs(dat) < roithresh(o)); - if binarize(o), dat(:) = 1; end - dat(tmp) = 0; - - o.dat = dat; - dat = o; - -else - dat = o.dat; -end diff --git a/lib/marsbar-0.44/@maroi_matrix/native_space.m b/lib/marsbar-0.44/@maroi_matrix/native_space.m deleted file mode 100644 index 7065477..0000000 --- a/lib/marsbar-0.44/@maroi_matrix/native_space.m +++ /dev/null @@ -1,6 +0,0 @@ -function sp = native_space(obj) -% native_space method - returns native space of object -% -% $Id$ - -sp = mars_space(size(obj.dat), obj.mat); diff --git a/lib/marsbar-0.44/@maroi_matrix/private/my_rld.m b/lib/marsbar-0.44/@maroi_matrix/private/my_rld.m deleted file mode 100644 index 1ae2b32..0000000 --- a/lib/marsbar-0.44/@maroi_matrix/private/my_rld.m +++ /dev/null @@ -1,14 +0,0 @@ -function mat = my_rld(rlem, dim) -% function to do run length decoding -% -% $Id$ - -sz = sum(rlem(:,1)); -mat = zeros(sz, 1); -st = 1; -for i = 1:size(rlem, 1) - tm = zeros(rlem(i,1),1) + rlem(i,2); - st2 = st + rlem(i,1); - mat(st:st2-1) = tm; - st = st2; -end diff --git a/lib/marsbar-0.44/@maroi_matrix/private/my_rle.m b/lib/marsbar-0.44/@maroi_matrix/private/my_rle.m deleted file mode 100644 index c7d925c..0000000 --- a/lib/marsbar-0.44/@maroi_matrix/private/my_rle.m +++ /dev/null @@ -1,8 +0,0 @@ -function rlem = my_rle(m) -% method to do run length encoding on matrix -% -% $Id$ - -m = m(:); -dps = [1; find(diff(m))+1]; -rlem = [diff([dps; length(m)+1]), m(dps)]; diff --git a/lib/marsbar-0.44/@maroi_matrix/rebase.m b/lib/marsbar-0.44/@maroi_matrix/rebase.m deleted file mode 100644 index f32b863..0000000 --- a/lib/marsbar-0.44/@maroi_matrix/rebase.m +++ /dev/null @@ -1,54 +0,0 @@ -function [pts, vals] = rebase(obj, sp, flags) -% rebase method - returns data from maroi_matrix in new space -% Unless flags contains 'i', returns [pts, vals] -% otherwise returns matrix in new space -% -% $Id$ - -if nargin < 2 - error('Need space to give voxel points'); -end -if nargin < 3 - flags = ''; -end -if isempty(flags), flags = ' ';end - -sp = mars_space(sp); -vol = obj.dat; -mat = spm_mat(obj); -Hold = spm_hold(obj); -th = roithresh(obj); -binf = binarize(obj); - -if any(flags == 'i') - pts = zeros(sp.dim(1:3)); - vals = []; -else % points call - pts = cell(1, sp.dim(3)); - multvc = cell(1, sp.dim(3)); -end - -for z=1:sp.dim(3), - M = inv(mat) * sp.mat * spm_matrix([0 0 z]); - img = spm_slice_vol(vol,M,sp.dim(1:2),Hold); - tmp = abs(img) >= th; - img(~tmp) = 0; - if any(tmp(:)) - if binf, img(tmp) = 1; end - if any(flags == 'i') % image to return - pts(:,:,z) = img; - else % point list - tmp = find(tmp); - multvc(z) = {img(tmp)'}; - tmp = tmp-1; - y = floor(tmp/sp.dim(1)); - x = tmp - (y*sp.dim(1)); - o = ones(1, length(x)); - pts(z) = {[[x y]'+1; o*z]}; - end - end -end -if ~any(flags == 'i') - pts = [pts{:}]; - vals = [multvc{:}]; -end diff --git a/lib/marsbar-0.44/@maroi_matrix/saveobj.m b/lib/marsbar-0.44/@maroi_matrix/saveobj.m deleted file mode 100644 index c6c0706..0000000 --- a/lib/marsbar-0.44/@maroi_matrix/saveobj.m +++ /dev/null @@ -1,12 +0,0 @@ -function o = saveobj(o) -% saveobj function - does run length encoding if helpful -% -% $Id$ - -m = o.dat; -if isnumeric(m) - rlem = my_rle(m); - if prod(size(rlem)) < prod(size(m)) - o.dat = struct('rlem', rlem, 'dim', size(m)); - end -end diff --git a/lib/marsbar-0.44/@maroi_matrix/spm_mat.m b/lib/marsbar-0.44/@maroi_matrix/spm_mat.m deleted file mode 100644 index 52a48aa..0000000 --- a/lib/marsbar-0.44/@maroi_matrix/spm_mat.m +++ /dev/null @@ -1,6 +0,0 @@ -function M = spm_mat(obj) -% spm_mat method - returns mat file defining orientation etc -% -% $Id$ - -M = obj.mat; diff --git a/lib/marsbar-0.44/@maroi_matrix/voxpts.m b/lib/marsbar-0.44/@maroi_matrix/voxpts.m deleted file mode 100644 index 34be5a1..0000000 --- a/lib/marsbar-0.44/@maroi_matrix/voxpts.m +++ /dev/null @@ -1,9 +0,0 @@ -function [pts, vals] = voxpts(obj, sp) -% voxpts method - returns 3xN ijk matrix in voxels -% -% $Id$ - -if nargin < 2 - error('Need space to give voxel points'); -end -[pts, vals] = rebase(obj, sp, ''); diff --git a/lib/marsbar-0.44/@maroi_pointlist/flip_lr.m b/lib/marsbar-0.44/@maroi_pointlist/flip_lr.m deleted file mode 100644 index 68e9c90..0000000 --- a/lib/marsbar-0.44/@maroi_pointlist/flip_lr.m +++ /dev/null @@ -1,8 +0,0 @@ -function o = flip_lr(o) -% flips ROI left / right -% -% $Id$ - -M = eye(4); M(1) = -1; -o.mat = M * o.mat; -o.voxblock = my_voxblock(o.XYZ, o.mat, o.vals); diff --git a/lib/marsbar-0.44/@maroi_pointlist/getvals.m b/lib/marsbar-0.44/@maroi_pointlist/getvals.m deleted file mode 100644 index e50812d..0000000 --- a/lib/marsbar-0.44/@maroi_pointlist/getvals.m +++ /dev/null @@ -1,10 +0,0 @@ -function v = getvals(o) -% returns vals for pointlist object -% -% $Id$ - -if ~isempty(o.vals) - v = o.vals; -else - v = ones(1, size(o.XYZ,2)); -end diff --git a/lib/marsbar-0.44/@maroi_pointlist/is_empty_roi.m b/lib/marsbar-0.44/@maroi_pointlist/is_empty_roi.m deleted file mode 100644 index 21e437d..0000000 --- a/lib/marsbar-0.44/@maroi_pointlist/is_empty_roi.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = is_empty_roi(o) -% is_empty_roi - returns true if ROI contains no volume -% -% $Id$ - -tf = isempty(o.XYZ); diff --git a/lib/marsbar-0.44/@maroi_pointlist/loadobj.m b/lib/marsbar-0.44/@maroi_pointlist/loadobj.m deleted file mode 100644 index ef35798..0000000 --- a/lib/marsbar-0.44/@maroi_pointlist/loadobj.m +++ /dev/null @@ -1,6 +0,0 @@ -function o = loadobj(o) -% loadobj method - creates temporary voxel block -% -% $Id$ - -o.voxblock = my_voxblock(o.XYZ, o.mat, o.vals); diff --git a/lib/marsbar-0.44/@maroi_pointlist/maroi_matrix.m b/lib/marsbar-0.44/@maroi_pointlist/maroi_matrix.m deleted file mode 100644 index 84bc50f..0000000 --- a/lib/marsbar-0.44/@maroi_pointlist/maroi_matrix.m +++ /dev/null @@ -1,18 +0,0 @@ -function obj2 = maroi_matrix(obj, space) -% maroi_matrix method - converts roi to maroi matrix type -% -% Without space arg, returns object in native space -% -% $Id$ - -params = paramfields(obj); -params.dat = obj.voxblock.dat; -params.mat = obj.voxblock.mat; - -% put into maroi_matrix object -obj2 = maroi_matrix(params); - -% rebase using maroi_matrix method if space argument passed -if nargin > 1 - obj2 = maroi_matrix(obj2, space); -end diff --git a/lib/marsbar-0.44/@maroi_pointlist/maroi_pointlist.m b/lib/marsbar-0.44/@maroi_pointlist/maroi_pointlist.m deleted file mode 100644 index 6daed84..0000000 --- a/lib/marsbar-0.44/@maroi_pointlist/maroi_pointlist.m +++ /dev/null @@ -1,83 +0,0 @@ -function [o, others] = maroi_pointlist(params, type) -% maroi_pointlist - class constructor -% FORMAT [o, others] = maroi_pointlist(params, type) -% Inputs [defaults] -% params - one of -% structure containing fields XYZ, mat -% -% type - one of 'vox', 'real' or 'mm' ['real'] -% ('mm' is the same as 'real') -% specifies if XYZ matrix is in real (mm) or voxel space -% -% $Id$ - -myclass = 'maroi_pointlist'; -defstruct = struct('XYZ', [],... - 'mat', eye(4),... - 'vals',[],... - 'voxblock',[]); - -if nargin < 1 - params = []; -end -if nargin < 2 - type = 'real'; -end -if isa(params, myclass) - o = params; - return -end - -% fill with defaults -pparams = mars_struct('ffillmerge', defstruct, params); - -% umbrella object, parse out fields for (this object and children) -[uo, pparams] = maroi(pparams); - -% reparse parameters into those for this object, children -[pparams, others] = mars_struct('split', pparams, defstruct); - -% return if no points passed -if isempty(pparams.XYZ) - o = class(pparams, myclass, uo); - return -end - -% reset points vector if wrong size -if size(pparams.XYZ, 1) == 1 - pparams.XYZ = pparams.XYZ'; -end - -if strcmp(type, 'real') | strcmp(type, 'mm') - % point list is in real space -> convert - pparams.XYZ = inv(pparams.mat) * ... - [pparams.XYZ; ones(1, size(pparams.XYZ,2))]; - pparams.XYZ = pparams.XYZ(1:3,:); -end - -% check that the points are in a sensible voxel space -tiny = 0.001; % tolerance for non-integer voxel values -if any(any((abs(pparams.XYZ - round(pparams.XYZ))) > tiny)) - error(['Non integer points in voxel space - ' ... - 'are points really of type ''' type '''?']); -end -pparams.XYZ = round(pparams.XYZ); - -% make temporary voxel block for further resampling etc -pparams.voxblock = my_voxblock(pparams.XYZ, pparams.mat, pparams.vals); - -% apply implied thresholding -if ~isempty(pparams.vals) - tmp = find(~isnan(pparams.vals) & ... - abs(pparams.vals) >= roithresh(uo)); - pparams.XYZ = pparams.XYZ(:, tmp); - if binarize(uo) - pparams.vals = []; - else - pparams.vals = pparams.vals(tmp); - end -end - -% make object -o = class(pparams, myclass, uo); -return diff --git a/lib/marsbar-0.44/@maroi_pointlist/native_space.m b/lib/marsbar-0.44/@maroi_pointlist/native_space.m deleted file mode 100644 index de00457..0000000 --- a/lib/marsbar-0.44/@maroi_pointlist/native_space.m +++ /dev/null @@ -1,6 +0,0 @@ -function sp = native_space(obj) -% native_space method - returns native space of object -% -% $Id$ - -sp = mars_space(size(obj.voxblock.dat), obj.voxblock.mat); diff --git a/lib/marsbar-0.44/@maroi_pointlist/private/my_voxblock.m b/lib/marsbar-0.44/@maroi_pointlist/private/my_voxblock.m deleted file mode 100644 index 78ea637..0000000 --- a/lib/marsbar-0.44/@maroi_pointlist/private/my_voxblock.m +++ /dev/null @@ -1,31 +0,0 @@ -function vblock = my_voxblock(pts, mat, vals) -% returns voxel block and modified mat file for pointlist -% -% $Id$ - -if isempty(vals) - vals = ones(1, size(pts,2)); -end - -% dimensions of containing block -st = min(pts, [], 2)'; -fn = max(pts, [], 2)'; -dsz = fn-st+1; - -% reset mat according to voxel block -newM = mat * spm_matrix(st-1); - -% set voxels in block -dat1 = zeros(dsz); -dpts = pts - (st'-1) * ones(1, size(pts,2)); -dinds = dpts(1,:) + ... - (dpts(2,:)-1) * dsz(1) + ... - (dpts(3,:)-1) * dsz(1)*dsz(2); -dat1(dinds) = vals; - -% add a shell of one voxel to isolate from interpolation 0s -dat = zeros(dsz+2); -dat(2:end-1,2:end-1,2:end-1) = dat1; -mat = newM * spm_matrix([-1 -1 -1]); - -vblock = struct('dat', dat, 'mat', mat); diff --git a/lib/marsbar-0.44/@maroi_pointlist/saveobj.m b/lib/marsbar-0.44/@maroi_pointlist/saveobj.m deleted file mode 100644 index 0960854..0000000 --- a/lib/marsbar-0.44/@maroi_pointlist/saveobj.m +++ /dev/null @@ -1,6 +0,0 @@ -function o = saveobj(o) -% saveobj method - removes temporary voxblock structure -% -% $Id$ - -o.voxblock = []; diff --git a/lib/marsbar-0.44/@maroi_pointlist/voxpts.m b/lib/marsbar-0.44/@maroi_pointlist/voxpts.m deleted file mode 100644 index c5b37be..0000000 --- a/lib/marsbar-0.44/@maroi_pointlist/voxpts.m +++ /dev/null @@ -1,16 +0,0 @@ -function [pts, vals] = voxpts(o, sp) -% voxpts method - returns 3xN ijk matrix in voxels -% -% $Id$ - -if nargin < 2 - error('Need space for voxpts call') -end - -sp = mars_space(sp); - -% to maroi_matrix object -mo = maroi_matrix(o); - -% and return values -[pts, vals] = voxpts(mo, sp); diff --git a/lib/marsbar-0.44/@maroi_shape/c_o_m.m b/lib/marsbar-0.44/@maroi_shape/c_o_m.m deleted file mode 100644 index d4486cb..0000000 --- a/lib/marsbar-0.44/@maroi_shape/c_o_m.m +++ /dev/null @@ -1,23 +0,0 @@ -function pt = c_o_m(o, sp, pt_type) -% c_o_m method - calculates centre of mass -% -% $Id$ - -if nargin < 2 - sp = ''; -end -if nargin < 3 - pt_type = 'real'; -end -pt = centre(o); -switch pt_type - case {'real','mm'} - case 'vox' - if isempty(sp) - error('Need space to define voxel centre of mass'); - end - pt = sp.mat * [pt; 1]; - pt = pt(1:3)'; - otherwise - error(['Do not recognize point type' pt_type]); -end diff --git a/lib/marsbar-0.44/@maroi_shape/has_space.m b/lib/marsbar-0.44/@maroi_shape/has_space.m deleted file mode 100644 index 24dc41b..0000000 --- a/lib/marsbar-0.44/@maroi_shape/has_space.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = has_space(obj) -% has_space method - returns true if object has a native space -% -% $Id$ - -tf = 0; % not true of shape object diff --git a/lib/marsbar-0.44/@maroi_shape/maroi_matrix.m b/lib/marsbar-0.44/@maroi_shape/maroi_matrix.m deleted file mode 100644 index da33d5c..0000000 --- a/lib/marsbar-0.44/@maroi_shape/maroi_matrix.m +++ /dev/null @@ -1,27 +0,0 @@ -function o2 = maroi_matrix(o, space) -% method to convert shape objects to maroi_matrix objects -% -% $Id$ - -if nargin < 2 - space = []; -end -if isempty(space) - space = native_space(o); -end -if isempty(space) - error('Need space to create maroi_matrix'); -end - -params = paramfields(o); -params.mat = space.mat; -dim = space.dim(1:3); -params.dat = zeros(dim); - -[pts vals] = voxpts(o, space); -dinds = pts(1,:) + ... - (pts(2,:)-1) * dim(1) + ... - (pts(3,:)-1) * dim(1)*dim(2); - -params.dat(dinds) = vals; -o2 = maroi_matrix(params); diff --git a/lib/marsbar-0.44/@maroi_shape/maroi_shape.m b/lib/marsbar-0.44/@maroi_shape/maroi_shape.m deleted file mode 100644 index 8e12ba4..0000000 --- a/lib/marsbar-0.44/@maroi_shape/maroi_shape.m +++ /dev/null @@ -1,33 +0,0 @@ -function [o, others] = maroi_shape(params) -% maroi_shape - (virtual) shape roi class constructor -% FORMAT [o, others] = maroi_shape(params) -% Inputs [defaults] -% params - a structure containing any fields for a maroi parent -% -% Only used by inheriting objects -% -% $Id$ - -myclass = 'maroi_shape'; -defstruct = struct('shape', []); - -if nargin < 1 - params = []; -end -if isa(params, myclass) - o = params; - return -end - -% fill with defaults -pparams = mars_struct('ffillmerge', defstruct, params); - -% umbrella object, parse out fields for (this object and children) -[uo, pparams] = maroi(pparams); - -% reparse parameters into those for this object, children -[pparams, others] = mars_struct('split', pparams, defstruct); - -o = class(pparams, myclass, uo); - -return diff --git a/lib/marsbar-0.44/@maroi_sphere/centre.m b/lib/marsbar-0.44/@maroi_sphere/centre.m deleted file mode 100644 index a5d21e1..0000000 --- a/lib/marsbar-0.44/@maroi_sphere/centre.m +++ /dev/null @@ -1,9 +0,0 @@ -function c = centre(obj, val) -% centre method - sets / returns centre of ROI in mm -% -% $Id$ - -if nargin > 1 - obj.centre = val; -end -c = obj.centre; diff --git a/lib/marsbar-0.44/@maroi_sphere/flip_lr.m b/lib/marsbar-0.44/@maroi_sphere/flip_lr.m deleted file mode 100644 index e86c9c3..0000000 --- a/lib/marsbar-0.44/@maroi_sphere/flip_lr.m +++ /dev/null @@ -1,6 +0,0 @@ -function o = flip_lr(o) -% flips ROI left / right -% -% $Id$ - -o.centre(1) = o.centre(1)*-1; diff --git a/lib/marsbar-0.44/@maroi_sphere/is_empty_roi.m b/lib/marsbar-0.44/@maroi_sphere/is_empty_roi.m deleted file mode 100644 index 520a0a4..0000000 --- a/lib/marsbar-0.44/@maroi_sphere/is_empty_roi.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = is_empty_roi(o) -% is_empty_roi - returns true if ROI contains no volume -% -% $Id$ - -tf = isempty(o.centre); diff --git a/lib/marsbar-0.44/@maroi_sphere/maroi_sphere.m b/lib/marsbar-0.44/@maroi_sphere/maroi_sphere.m deleted file mode 100644 index d742c9d..0000000 --- a/lib/marsbar-0.44/@maroi_sphere/maroi_sphere.m +++ /dev/null @@ -1,40 +0,0 @@ -function [o, others] = maroi_sphere(params) -% maroi_sphere - class constructor -% FORMAT [o, others] = maroi_sphere(params) -% Inputs [defaults] -% params - a structure containing any fields for a maroi parent and -% .centre - a 1x3 coordinate in mm -% .radius - a 1x1 radius in mm -% -% -% $Id$ - -myclass = 'maroi_sphere'; -defstruct = struct('centre', [0 0 0],'radius', 0); - -if nargin < 1 - params = []; -end -if isa(params, myclass) - o = params; - return -end - -% fill with defaults -pparams = mars_struct('ffillmerge', defstruct, params); - -% umbrella object, parse out fields for (this object and children) -[uo, pparams] = maroi_shape(pparams); - -% reparse parameters into those for this object, children -[pparams, others] = mars_struct('split', pparams, defstruct); - -% check resulting input -if size(pparams.centre, 2) == 1 - pparams.centre = pparams.centre'; -end -% enforce radius as double for vox->mm conversions -pparams.radius = double(pparams.radius) - -o = class(pparams, myclass, uo); -return diff --git a/lib/marsbar-0.44/@maroi_sphere/volume.m b/lib/marsbar-0.44/@maroi_sphere/volume.m deleted file mode 100644 index 42c44f6..0000000 --- a/lib/marsbar-0.44/@maroi_sphere/volume.m +++ /dev/null @@ -1,6 +0,0 @@ -function v = volume(obj) -% volume method - returns volume of ROI in mm -% -% $Id$ - -v = (4/3*pi)*obj.radius^3; diff --git a/lib/marsbar-0.44/@maroi_sphere/voxpts.m b/lib/marsbar-0.44/@maroi_sphere/voxpts.m deleted file mode 100644 index c75b0fb..0000000 --- a/lib/marsbar-0.44/@maroi_sphere/voxpts.m +++ /dev/null @@ -1,26 +0,0 @@ -function [pts, vals] = voxpts(obj, sp) -% voxpts method - voxels within a sphere in given space -% -% $Id$ - -if nargin < 2 - error('Need object and space arguments'); -end -sp = mars_space(sp); - -mc = obj.centre; -mr = obj.radius; - -% find voxels that are within sphere -vox = sqrt(sum(sp.mat(1:3,1:3)'.^2)); -vr = mr ./ vox; -vc = sp.mat \ [mc(1:3) 1]'; -vc = vc(1:3)'; -blim = [max([1 1 1; ceil(vc-vr)]); min([sp.dim(1:3); floor(vc+vr)])]; -[R,C,P]=ndgrid(... - blim(1,1):blim(2,1),blim(1,2):blim(2,2),blim(1,3):blim(2,3)); -vXYZ = [R(:)';C(:)';P(:)']; -o = ones(1, size(vXYZ, 2)); -pts = find(sqrt(sum(((vXYZ-(vc'*o)) .* (vox'*o)).^2)) <= mr); -pts = vXYZ(:,pts); -vals = ones(1, size(pts, 2)); diff --git a/lib/marsbar-0.44/@mars_space/display.m b/lib/marsbar-0.44/@mars_space/display.m deleted file mode 100644 index 7c3e845..0000000 --- a/lib/marsbar-0.44/@mars_space/display.m +++ /dev/null @@ -1,19 +0,0 @@ -function display(obj) -% display method for mars_space object -% -% $Id$ - -X = struct(obj); -src = ['[mars_space object]']; -if isequal(get(0,'FormatSpacing'),'compact') - disp([inputname(1) ' =']); - disp(src); - disp(X) -else - disp(' ') - disp([inputname(1) ' =']); - disp(' '); - disp(src); - disp(' '); - disp(X) -end diff --git a/lib/marsbar-0.44/@mars_space/eq.m b/lib/marsbar-0.44/@mars_space/eq.m deleted file mode 100644 index ac6e905..0000000 --- a/lib/marsbar-0.44/@mars_space/eq.m +++ /dev/null @@ -1,10 +0,0 @@ -function tf = eq(sp1, sp2) -% overloaded eq method for mars_space objects -% -% $Id$ - -if all(sp1.dim == sp2.dim) & all((abs(sp1.mat(:) - sp2.mat(:)))< eps) - tf = 1; -else - tf = 0; -end diff --git a/lib/marsbar-0.44/@mars_space/mars_space.m b/lib/marsbar-0.44/@mars_space/mars_space.m deleted file mode 100644 index c463299..0000000 --- a/lib/marsbar-0.44/@mars_space/mars_space.m +++ /dev/null @@ -1,61 +0,0 @@ -function [o, others] = mars_space(params, params2) -% mars_space - class constructor for space defining object -% FORMAT [o, others] = mars_space(params, params2) -% Inputs [defaults] -% params - either -% a structure, containing fields to construct the object -% an spm vol struct (see spm_vol) -% a string, giving and image name (see spm_vol) -% a matrix (for which, only the dimensions are used) -% a 3x1 or 1x3 dimension vector -% params2 in the latter 2 cases, might contain a 4x4 transformation matrix -% [eye(4)] -% -% $Id$ - -myclass = 'mars_space'; -defstruct = struct('dim', [1 1 1],... - 'mat', eye(4)); - -if nargin < 1 - params = []; -end -if nargin < 2 - params2 = []; -end -if isa(params, myclass) - o = params; - return -end - -% check inputs -if ~isstruct(params) - % Matlab 7 does not like assigment of struct to non empty var - inp1 = params; - clear params; - if ischar(inp1) % maybe it is an image filename - params = spm_vol(inp1); - params.dim = params.dim(1:3); - elseif prod(size(inp1)) == 3 - % could be the dimensions of a space - params.dim = inp1(:)'; - if ~isempty(params2), params.mat = params2; end - else - % lets hope it's a useful matrix, but with a mat parameter, quoi - if isempty(params2) - error(['Need to pass a ''mat'' definition with a'... - ' matrix']) - end - params.mat = params2; - m = inp1; - sz = size(m); - params.dim = [1 1 1]; - params.dim(1:length(sz)) = sz; - end -end - -% fill with defaults, parse into fields for this object, children -[pparams, others] = mars_struct('ffillsplit', defstruct, params); - -o = class(pparams, myclass); -return diff --git a/lib/marsbar-0.44/@mars_space/subsasgn.m b/lib/marsbar-0.44/@mars_space/subsasgn.m deleted file mode 100644 index b795ded..0000000 --- a/lib/marsbar-0.44/@mars_space/subsasgn.m +++ /dev/null @@ -1,7 +0,0 @@ -function result = subsasgn(this, Struct, rhs) -% method to over load . notation in assignments. -% Publicize subscripted assignments to private fields of object. -% -% $Id$ - -result = builtin('subsasgn', this, Struct, rhs ); diff --git a/lib/marsbar-0.44/@mars_space/subsref.m b/lib/marsbar-0.44/@mars_space/subsref.m deleted file mode 100644 index f668346..0000000 --- a/lib/marsbar-0.44/@mars_space/subsref.m +++ /dev/null @@ -1,7 +0,0 @@ -function result = subsref(this, Struct) -% method to overload the . notation. -% Publicize subscripted reference to private fields of object. -% -% $Id$ - -result = builtin('subsref', this, Struct ); diff --git a/lib/marsbar-0.44/@marsy/as_summary_only.m b/lib/marsbar-0.44/@marsy/as_summary_only.m deleted file mode 100644 index 1ec76aa..0000000 --- a/lib/marsbar-0.44/@marsy/as_summary_only.m +++ /dev/null @@ -1,19 +0,0 @@ -function out_o = as_summary_only(o) -% returns object with region data removed -% -% Useful to save memory -if ~is_summarized(o) - out_o = resummarize(o); -else - out_o = o; -end -st = y_struct(o); -if ~isfield(st, 'regions') - return -end -for rno = 1:length(st.regions) - st.regions{rno} = mars_struct('strip', st.regions{rno}, ... - {'Y', 'weights','vXYZ'}); -end -out_o = y_struct(out_o, st); -return diff --git a/lib/marsbar-0.44/@marsy/block_rows.m b/lib/marsbar-0.44/@marsy/block_rows.m deleted file mode 100644 index b6d6267..0000000 --- a/lib/marsbar-0.44/@marsy/block_rows.m +++ /dev/null @@ -1,26 +0,0 @@ -function r = block_rows(Y, rows) -% gets/sets cell array of rows for each (subject/session) block -% -% $Id$ - -ys = y_struct(Y); -n = n_time_points(Y); -if nargin < 2 % get - if ~isfield(ys, 'block_rows') - r = {[1:n]'}; - else - r = ys.block_rows; - end -else % set - if ~iscell(rows) - error('Need cell array of matrices for blocks'); - end - for i = 1:prod(size(rows)) - rows{i} = rows{i}(:); - if any(rows{i} < 1 | rows{i} > n) - error(sprintf('Row %d: values out of range', i)); - end - end - ys.block_rows = rows; - r = y_struct(Y, ys); -end diff --git a/lib/marsbar-0.44/@marsy/can_summarize.m b/lib/marsbar-0.44/@marsy/can_summarize.m deleted file mode 100644 index 567d300..0000000 --- a/lib/marsbar-0.44/@marsy/can_summarize.m +++ /dev/null @@ -1,17 +0,0 @@ -function tf = can_summarize(o) -% returns 1 if object contains enough information to be summarized -% or is already summarized -% -% $Id$ - -tf = 1; -if is_summarized(o), return, end -for i = 1:n_regions(o); - r_samp = region_size(o, i, 2); - if r_samp > 1 % at least one region needs summarizing - % check for summary function - s = sumfunc(o); - tf = ~isempty(s) & ~strcmp(s, 'unknown'); - break - end -end diff --git a/lib/marsbar-0.44/@marsy/display.m b/lib/marsbar-0.44/@marsy/display.m deleted file mode 100644 index 38929c6..0000000 --- a/lib/marsbar-0.44/@marsy/display.m +++ /dev/null @@ -1,35 +0,0 @@ -function display(obj) -% display method for marsy objects -% -% $Id$ - -src = '[MarsBaR data object]'; -if length(obj) > 1 % array of objects - sz = size(obj); - src = sprintf('%d by %d array of %s', sz(1), sz(2), src); - if isequal(get(0,'FormatSpacing'),'compact') - disp([inputname(1) ' =']); - disp(src); - else - disp(' ') - disp([inputname(1) ' =']); - disp(' '); - disp(src); - disp(' '); - end -else % single object - X = char(summary(obj)); - if isequal(get(0,'FormatSpacing'),'compact') - disp([inputname(1) ' =']); - disp(src); - disp(X) - else - disp(' ') - disp([inputname(1) ' =']); - disp(' '); - disp(src); - disp(' '); - disp(X) - disp(' '); - end -end diff --git a/lib/marsbar-0.44/@marsy/eq.m b/lib/marsbar-0.44/@marsy/eq.m deleted file mode 100644 index 084fe8b..0000000 --- a/lib/marsbar-0.44/@marsy/eq.m +++ /dev/null @@ -1,19 +0,0 @@ -function tf = eq(Y1, Y2) -% method overrides == operator -% -% $Id$ - -tf = 0; -if ~isa(Y1, 'marsy') | ~isa(Y2, 'marsy'), return, end -if ~all(summary_size(Y1) == summary_size(Y2)), return, end -if is_summarized(Y1) ~= is_summarized(Y2), return, end -if is_summarized(Y1) - y1 = summary_data(Y1); - y2 = summary_data(Y2); -else - y1 = region_data(Y1); - y1 = [y1{:}]; - y2 = region_data(Y2); - y2 = [y2{:}]; -end -tf = all(all(y1 == y2)); diff --git a/lib/marsbar-0.44/@marsy/is_summarized.m b/lib/marsbar-0.44/@marsy/is_summarized.m deleted file mode 100644 index 3b9f370..0000000 --- a/lib/marsbar-0.44/@marsy/is_summarized.m +++ /dev/null @@ -1,7 +0,0 @@ -function tf = is_summarized(o) -% returns 1 if object contains calculated summary data -% -% $Id$ - -st = y_struct(o); -tf = isfield(st, 'Y') & isfield(st, 'Yvar'); diff --git a/lib/marsbar-0.44/@marsy/is_summary_only.m b/lib/marsbar-0.44/@marsy/is_summary_only.m deleted file mode 100644 index c84c977..0000000 --- a/lib/marsbar-0.44/@marsy/is_summary_only.m +++ /dev/null @@ -1,16 +0,0 @@ -function tf = is_summary_only(o) -% method returns 1 if object only contains summary data -% -% $Id$ - -tf = 0; -st = y_struct(o); -if isfield(st, 'Y') - if ~isfield(st, 'regions') - tf = 1; - else - Y = region_data(o); - Y = [Y{:}]; - tf = size(Y, 2) == size(st.Y, 2); - end -end diff --git a/lib/marsbar-0.44/@marsy/is_valid.m b/lib/marsbar-0.44/@marsy/is_valid.m deleted file mode 100644 index f1ec099..0000000 --- a/lib/marsbar-0.44/@marsy/is_valid.m +++ /dev/null @@ -1,7 +0,0 @@ -function tf = is_valid(o) -% method returns 1 if object contains valid data -% -% $Id$ - -st = y_struct(o); -tf = isfield(st, 'Y') | isfield(st, 'regions'); diff --git a/lib/marsbar-0.44/@marsy/join.m b/lib/marsbar-0.44/@marsy/join.m deleted file mode 100644 index 9601b0f..0000000 --- a/lib/marsbar-0.44/@marsy/join.m +++ /dev/null @@ -1,66 +0,0 @@ -function o = join(varargin) -% joins marsy objects into one object -% -% $Id$ - -% assemble all input object into a cell array -% (deals with arrays of objects) -o_c_a = {}; -ctr = 0; -n_n = []; -for v = 1:nargin - o_arr = varargin{v}; - for i = 1:prod(size(o_arr)) - ctr = ctr + 1; - - % Check number of time points - n = n_time_points(o_arr(i)); - if isempty(n_n), n_n = n; - else - if n ~= n_n - error(sprintf(... - 'Regions %d and %d have different numbers of time points',... - ctr, ctr-1)); - end - end - - o_c_a{ctr} = o_arr(i); - end -end - -o = o_c_a{1}; -want_sum_f = 1; -sum_func = sumfunc(o); -regions = {}; -Y = []; -Yvar = []; -for i = 1:ctr - o_a = o_c_a{i}; - if want_sum_f - % if summary function differs from other - % objects, abort collecting summary data - if ~strcmp(sum_func,sumfunc(o_a)) | ... - ~can_summarize(o_a) - want_sum_f = 0; - else - if ~is_summarized(o_a) - o_a = resummarize(o_a); - end - [t1 t2] = summary_data(o_a); - Y = [Y t1]; - Yvar = [Yvar t2]; - end - end - regions = [regions region(o_a)]; -end - -st = y_struct(o); -if want_sum_f - st.Y = Y; - st.Yvar = Yvar; - st.sumfunc = sum_func; -else - st = mars_struct('strip', st, {'Y','Yvar','sumfunc'}); -end -st.regions = regions; -o = y_struct(o, st); diff --git a/lib/marsbar-0.44/@marsy/marsy.m b/lib/marsbar-0.44/@marsy/marsy.m deleted file mode 100644 index 05c1905..0000000 --- a/lib/marsbar-0.44/@marsy/marsy.m +++ /dev/null @@ -1,358 +0,0 @@ -function [o,others] = marsy(params, region_stuff, summary_stuff) -% Class constructor for marsy: the MarsBaR data object -% FORMAT [o,others] = marsy(params, region_stuff, summary_stuff) -% -% Synopsis: -% % Some example data -% Y = rand(100, 10); -% -% % Use data as time courese from 10 regions -% m_Y = marsy(Y); -% -% % Use data as 10 samples (voxels from one region) -% m_Y = marsy({Y}, 'region_1', 'mean'); -% -% % Extract data for ROI 'my_roi', from list (string array) of images P -% m_Y = get_marsy(my_roi, P, 'mean'); % method for maroi (region) object -% -% Inputs -% params - can be: structure, either: -% containing MarsBaR data structure or -% containing fields for marsy object, which should include -% 'y_struct', containing data structure -% OR: filename, which loads to give structure as above -% OR: 2D matrix, containing summary data (Y) only (see below) -% OR: cell array of 2D matrices, one per region -% -% region_stuff - (optional) cell array of names for regions -% or array of structures containing information for -% regions -% or cell array of structures with information -% Structure can have fields; -% name - string identifying region -% descrip - longer description of region -% Y - matrix of samples (voxel data) for this -% region, size N by S1 for region 1, N by S2 for -% region 2 etc. -% weights - weighting vector, one value for each sample -% 1..S1 (for region 1) etc. -% Can be empty, so each sample has weight 1. -% info - structure containing any other fields of -% interest -% vXYZ - any voxel coordinates in X Y Z dimension -% (3 by S1 for region 1 etc). -% mat - a 4x4 transformation matrix giving coordinates -% in mm from voxel coordinates in vXYZ -% -% summary_stuff - (optional) summary function to summarize data (string) -% or structure containing information for summary data -% Structure can have fields; -% sumfunc - the summary function used to summarize the -% samples (voxels) per time point; a string, -% which is usually one of 'mean', 'median', -% 'wtmean', 'eigen1', or 'unknown' -% descrip - text field describing the origin of the data -% info - a structure with fields defining any other -% interesting information about the region -% block_rows - optional cell array, specifying the rows in -% the data that correspond to a particular -% session or subject (see below). If absent, the -% data is assumed to come from a single session -% or subject. -% -% Any data in region_stuff, summary info will overwrite region or summary -% information passed in the first argument -% -% Outputs -% o - marsy object -% others - any unrecognized fields from params, for processing by -% (as yet non-existent) children -% -% marsy is an object to contain MarsBaR data structures. -% -% The marsy object contains data for one or more ROIs. It offers two -% possible views of the data; the SUMMARY view, which gives one summary time -% course for each ROI, and the REGION view, which gives all the timecourses -% available from the ROI. For example, most ROIs contain more than one -% voxel, and, in the REGION view, there will be one time course for each -% voxel. In the SUMMARY view, all the data for a single region, for each -% timepoint, are combined with a summary function, to give one -% representative value per time point, and therefore a single time course -% for the whole ROI. The most common summary function would be the mean of -% all the samples (voxels) at each time point, but there are others (see -% below). -% -% At its simplest, the marsy object can just contain a single time-course -% for a single ROI. In this case the summary and region view will be -% the same. -% -% It can also contain data for more than one ROI, and more than one -% time course per region. In this case the object needs to know how to -% summarize the timecourses for the ROIs to give the summary view. -% -% Let's call the number of regions R -% All regions in the structure have data with the same number of time points -% Let's call the number of time points N -% For each region there may be many samples at each time point. -% For example, there is usually one sample from each voxel in the ROI. -% Let's call the number of samples (voxels) per time point S1..SR for -% regions 1..R. -% -% Thus, the summary view will give an N by R matrix, with one row for -% each ROI. The region view, for (say) region 2, will return all the -% samples for ROI 2, an N by S2 matrix. -% -% The regions may also be associated with names, for interpreting output and -% to help remember where the data has come from. They may also (optionally) -% be associated with a longer text description ('descrip'), and any fields -% you the user think may be useful (contained in 'info'). -% -% You can also (optionally) set text description and info data for the -% whole object, for examnple specifying where (all) the data was -% extraxcted from. -% -% The data can come from several sessions or subjects. Optionally, this -% can be specified with the summary data field 'block_rows', specifying -% which rows in the data correspond to which session or subject -% -% The object contains a data structure of a particular format, listed in -% the programmer's help for this function. Please avoid using this -% structure directly, as this format may change at any time. Instead, -% please use the public methods listed below -% -% Methods -% verbose - get/set whether reporting is verbose or not (1 or 0) -% summary_data - gets (N by R) summary matrix Y -% summary_descrip - gets/sets description of object -% summary_stuff - gets/sets information field of object -% resummarize - recalculates summary data if possible -% is_summarized - returns 1 if data has been summarized already -% can_summarize - returns 1 if data can be suumarized without error -% sumfunc - gets/sets summary function to summarize data -% block_rows - gets/sets information on rows corresponding to -% sessions/subjects -% n_regions - gets number of regions (R above) -% n_time_points - gets number of time points (N above) -% ui_plot - a variety of plots of the data to SPM interface -% save_struct - saves y_struct to disk as structure -% -% region - returns region structure, filled with defaults as necessary -% region_data - gets region sample (voxel) data as cell array; returns -% all regions if no region number specificed, or one cell -% per region if region numbers are specified -% region_weights - as above, but for region weighting vector (see above) -% region_name - gets cell array of region names as 1 by R cell array -% (if no region number is specified) or single cell string -% if a single region is specified -% region_descrip - gets cell array of descriptions of specified region -% region_stuff - gets cell array of info field of specified region -% xyz - gets voxel or mm XYZ coordinates of given region -% join - accepts several marsy objects, and merges into one (if -% possible) -% split - splits object into array of objects, with one element -% for each region -% -% Other methods (to avoid) -% y_struct - sets or gets data structure -% -% $Id$ - -% Programmer's help -% -% Please see the caveats in the main help about using the object -% structure to access the object data. -% -% Fields -% ------ -% -% y_struct - structure containing MarsBaR data structure -% verbose - flag for verbose messages while working -% -% The MarsBaR data structure -% -------------------------- -% -% The data structure contains fields: -% Y - matrix of summary time courses, N by R -% Yvar - matrix of summary time course variance, over samples for -% each time point (usually voxels) - N by R -% (the marsbar code does not currently use Yvar) -% sumfunc - the summary function used to summarize the samples (voxels) -% per time point; a string, which is usually one of -% 'mean', 'median', 'wtmean', 'eigen1', or 'unknown' -% descrip - text field describing the origin of the data (optional) -% info - a structure defining any other interesting information -% about where the data came from -% -% regions - cell array of structures, with one element per region (and -% therefore one element per column in the Y field). -% Regions is a cell array to allow different fields to be -% filled for each region -% Each structure in the cell array has fields -% name - string identifying region -% descrip - longer description of region -% Y - matrix of samples (voxel data) for this region, size -% N by S1 for region 1, N by S2 for region 2 etc. -% weights - weighting vector, one value for each sample 1..S1 -% can be empty, so each sample has weight 1. -% info - structure containing any other fields of interest -% vXYZ - any voxel coordinates in X Y Z dimension -% (3 by S1 for region 1 etc). -% mat - a 4x4 transformation matrix giving coordinates in -% mm from voxel coordinates in vXYZ - -myclass = 'marsy'; -defstruct = struct('y_struct', [],... - 'verbose', 1); - -if nargin < 1 - params = []; -end -if isa(params, myclass) - o = params; - return -end -if nargin < 2 - region_stuff = []; -end -if nargin < 3 - summary_stuff = []; -end - -% check first input -if ischar(params) % maybe filename - params = load(params); -end -switch class(params) - case 'marsy' - % pass quietly through - o = params; - return - case 'struct' - if ~isfield(params, 'y_struct') - % Appears to be an MarsBaR data structure - params = struct('y_struct',params); - end - - % need to process old data structure format here - if isfield(params.y_struct, 'cols') - params.y_struct = sf_convert_0p23(params.y_struct); - end - case {'double','float'} - % direct set of summary data call - params = struct('y_struct', ... - struct('Y', ... - params, 'Yvar', ... - params * Inf, ... - 'sumfunc', 'unknown')); - case 'cell' - % specifying region data - n = size(params{1}, 1); - for i = 1:length(params) - n2 = size(params{i}, 1); - if any(n - n2) - error('All regions must have the same number of time points'); - end - if isstruct(params{i}) - regions{i} = params{i}; - else - regions{i} = struct('Y', params{i}); - end - end - params = struct('y_struct', struct('regions', {regions})); - otherwise - error('Unexpected data type for first input'); -end - -% get number of regions -R = NaN; -st = params.y_struct; -if isfield(st, 'Y') - R = size(st.Y); -elseif isfield(st, 'regions') - R = length(st.regions); -end - -% process further inputs -if ~isempty(region_stuff) - % region_stuff has been specified - if ischar(region_stuff) - region_stuff = {region_stuff}; - end - if ~isnan(R) - if length(region_stuff) ~= R - error('region_stuff should have one entry per region'); - end - end - if iscell(region_stuff) & ischar(region_stuff{1}) % names only - tmp = region_stuff; region_stuff = cell(size(region_stuff)); - for i = 1:length(tmp) - region_stuff{i}.name = tmp{i}; - end - end - if isstruct(region_stuff) % need a cell array - tmp = region_stuff; region_stuff = cell(size(region_stuff)); - for i = 1:length(tmp) - region_stuff{i} = tmp(i); - end - end - - % set - if ~isfield(params.y_struct, 'regions') - params.y_struct.regions = cell(1, length(region_stuff)); - end - for i = 1:length(region_stuff) - params.y_struct.regions{i} = mars_struct('ffillmerge', ... - params.y_struct.regions{i},... - region_stuff{i}); - end -end - -if ~isempty(summary_stuff) - % summary_stuff has been specified - if ischar(summary_stuff) % sumfunc only - summary_stuff = struct('sumfunc', summary_stuff); - end - params.y_struct = mars_struct('ffillmerge', ... - params.y_struct, ... - summary_stuff); -end - -% fill with defaults, parse into fields for this object, children -[pparams, others] = mars_struct('ffillsplit', defstruct, params); - -% add version tag (was CVS; now marsbar version) -pparams.cvs_version = marsbar('ver'); - -% set the marsy object -o = class(pparams, myclass); - -% calculate summary data if possible -o = resummarize(o); - -return - -% Subfunctions - -% convert structure from MarsBaR <= 0.23 -function o_st = sf_convert_0p23(i_st) -if ~isfield(i_st, 'cols') - o_st = i_st; - return -end -for r = 1:length(i_st.cols) - col = i_st.cols{r}; - regions{r} = struct('name', col.name,... - 'descrip', col.descrip,... - 'Y', col.y,... - 'weights', [],... - 'info', struct('file', col.file),... - 'vXYZ', [], ... - 'mat', []); -end -o_st = struct('Y', i_st.Y,... - 'Yvar', i_st.Yvar,... - 'regions', {regions},... - 'sumfunc', i_st.sumfunc,... - 'descrip', 'Data from MarsBaR <= 0.23',... - 'info', []); -return diff --git a/lib/marsbar-0.44/@marsy/n_blocks.m b/lib/marsbar-0.44/@marsy/n_blocks.m deleted file mode 100644 index f99fb74..0000000 --- a/lib/marsbar-0.44/@marsy/n_blocks.m +++ /dev/null @@ -1,6 +0,0 @@ -function n = n_blocks(Y) -% method returns number of subjects/sessions in data -% -% $Id$ - -n = length(block_rows(Y)); diff --git a/lib/marsbar-0.44/@marsy/n_regions.m b/lib/marsbar-0.44/@marsy/n_regions.m deleted file mode 100644 index 3166f28..0000000 --- a/lib/marsbar-0.44/@marsy/n_regions.m +++ /dev/null @@ -1,6 +0,0 @@ -function n = n_regions(o) -% get number of regions -% -% $Id$ - -n = summary_size(o, 2); diff --git a/lib/marsbar-0.44/@marsy/n_time_points.m b/lib/marsbar-0.44/@marsy/n_time_points.m deleted file mode 100644 index a974f70..0000000 --- a/lib/marsbar-0.44/@marsy/n_time_points.m +++ /dev/null @@ -1,6 +0,0 @@ -function n = n_time_points(o) -% get number of time_points -% -% $Id$ - -n = summary_size(o, 1); diff --git a/lib/marsbar-0.44/@marsy/ne.m b/lib/marsbar-0.44/@marsy/ne.m deleted file mode 100644 index 5b7483d..0000000 --- a/lib/marsbar-0.44/@marsy/ne.m +++ /dev/null @@ -1,6 +0,0 @@ -function tf = ne(Y1, Y2) -% method overrides ~= operator -% -% $Id$ - -tf = ~eq(Y1, Y2); diff --git a/lib/marsbar-0.44/@marsy/private/pr_sum_func.m b/lib/marsbar-0.44/@marsy/private/pr_sum_func.m deleted file mode 100644 index 967e398..0000000 --- a/lib/marsbar-0.44/@marsy/private/pr_sum_func.m +++ /dev/null @@ -1,74 +0,0 @@ -function [sumY, varY] = pr_sum_func(y, sumfunc, wt) -% creates summary stats for region data -% FORMAT [sumY, varY] = pr_sum_func(y, sumfunc, wt) -% -% $Id$ - -if nargin < 2 - error('Need data matrix and summary function'); -end -[m n] = size(y); -if any([m n] == 0) - error('Data vector is empty'); -end -if nargin < 3 - wt = []; -end -if isempty(wt) - wt = ones(n,1); -end -if size(wt,1)==1 - wt = wt'; -end -if n == 1 % only 1 sample in ROI - sumY = y; varY = y*Inf; - return -end - -varY = ones(m,1) * Inf; -switch sumfunc - case 'mean' - sumY = mean(y, 2); - ssy = sum(y.^2, 2); - varY = (ssy - n*sumY.^2)/(n-1); - case 'wtmean' - % Formulae from GNU scientific library - % $\hat\mu = (\sum w_i x_i) / (\sum w_i)$ - % \hat\sigma^2 = ((\sum w_i)/((\sum w_i)^2 - \sum (w_i^2))) - % \sum w_i (x_i - \hat\mu)^2$ - swt = sum(wt); - sumY = y*wt/swt; - varY = (swt/(swt.^2 - wt'*wt)) * ((y - (sumY * ones(1,n))).^2 * wt); - - % original formula - %nwt = sum(wt ~= 0); - %varY = (y - (sumY * ones(1,n))).^2 * wt / ((nwt-1) * swt / nwt); - case 'median' - sumY = median(y, 2); - case 'eigen1' - % code taken from spm_regions.m l 230-247, with thanks - % @(#)spm_regions.m 2.7 Karl Friston 00/10/04 - -% compute regional response in terms of first eigenvariate -%----------------------------------------------------------------------- -if m > n - [v s v] = svd(spm_atranspa(y)); - s = diag(s); - v = v(:,1); - u = y*v/sqrt(s(1)); -else - [u s u] = svd(spm_atranspa(y')); - s = diag(s); - u = u(:,1); - v = y'*u/sqrt(s(1)); -end -d = sign(sum(v)); -u = u*d; -v = v*d; -sumY = u*sqrt(s(1)/n); - -% end of paste from spm_regions - - otherwise - error(['Do not recognize summary function ' sumfunc]); -end diff --git a/lib/marsbar-0.44/@marsy/region.m b/lib/marsbar-0.44/@marsy/region.m deleted file mode 100644 index c2ff1e3..0000000 --- a/lib/marsbar-0.44/@marsy/region.m +++ /dev/null @@ -1,123 +0,0 @@ -function [rs,r_nos] = region(o, r_nos, new_data, fieldname) -% gets / sets data for region or regions -% FORMAT [rs r_nos] = region(o, r_nos) (set) OR -% FORMAT [rs r_nos]= region(o, r_nos, new_data, fieldname) (get) -% -% Inputs -% o - marsy object -% r_nos - region number -% or array of region numbers -% or empty - giving all regions -% new_data - cell array containing new data to set for region -% fieldname - optional string, to identify field to be set -% using data in new_data -% -% Returns -% (get call) -% rs - cell array of region structures -% (set_call) -% rs - new marsy object with fields set -% -% r_nos - region nos (empty now -> all region nos) -% -% $Id$ - -r = n_regions(o); -if nargin < 2 - r_nos = []; -end -if isempty(r_nos) - r_nos = 1:r; -end -if any(r_nos > r) - error('Region numbers too large'); -end - -st = y_struct(o); -r_f = isfield(st, 'regions'); -y_f = isfield(st, 'Y'); -def_r_st = struct('name', '',... - 'descrip', '',... - 'Y', [],... - 'weights', [],... - 'info', [],... - 'vXYZ', [],... - 'mat', []); -sum_func = sumfunc(o); -r_len = length(r_nos); - -if nargin < 3 - % get call - if ~r_len, rs = {}; return, end - for i = 1:r_len - r_st = []; - if r_f - r_st = st.regions{r_nos(i)}; - end - r_st = mars_struct('fillafromb', def_r_st, r_st); - if isempty(r_st.Y) - if y_f - r_st.Y = st.Y(:,r_nos(i)); - end - end - rs{i} = r_st; - end - return -end - -% set call -if nargin > 3 - % field name specified - if ~ismember(fieldname, fieldnames(def_r_st)) - error(['Funny data field passed: ' fieldname]); - end -end - -if ~iscell(new_data), new_data = {new_data}; end -if length(new_data) ~= r_len - error('Different numbers of new data cells and regions'); -end -if ~r_len, rs = o; return, end - -N = n_time_points(o); - -% we need to fill regions if they are not already there -st.regions = region(o); - -% flag to tell if we need to resummarize -re_sum_f = 0; - -for i = 1:r_len - r = r_nos(i); - r_st = st.regions{r}; - if nargin > 3 % fieldname call - n_st = setfield([], fieldname, new_data{i}); - else % structure call - n_st = new_data{i}; - end - - % check if Y or weights are being set - % if so, we will have to resummarize - if isfield(n_st, 'Y') - re_sum_f = 1; - if size(n_st.Y, 1) ~= N - error('Incorrect number of time points in data set call'); - end - end - if isfield(n_st, 'weights') - if strcmp(sum_func, 'wtmean') - re_sum_f = 1; - end - if ~isempty(n_st.weights) & size(n_st.weights, 1) ~= N - error('Incorrect number of time points in weight set call'); - end - end - st.regions{r} = mars_struct('ffillmerge', st.regions{r}, n_st); -end - -if re_sum_f - st = mars_struct('strip', st, {'Y','Yvar'}); - rs = resummarize(y_struct(o, st)); -else - rs = y_struct(o, st); -end diff --git a/lib/marsbar-0.44/@marsy/region_data.m b/lib/marsbar-0.44/@marsy/region_data.m deleted file mode 100644 index 7268003..0000000 --- a/lib/marsbar-0.44/@marsy/region_data.m +++ /dev/null @@ -1,10 +0,0 @@ -function res = region_data(varargin) -% method gets or sets data for region(s) as cell array -% FORMAT res = region_data(o, r_nos) (get) OR -% FORMAT res = region_data(o, r_nos, new_data) (set) -% -% See region_field for details -% -% $Id$ - -res = region_field('Y', varargin{:}); diff --git a/lib/marsbar-0.44/@marsy/region_descrip.m b/lib/marsbar-0.44/@marsy/region_descrip.m deleted file mode 100644 index 17c28e7..0000000 --- a/lib/marsbar-0.44/@marsy/region_descrip.m +++ /dev/null @@ -1,10 +0,0 @@ -function res = region_descrip(varargin) -% method gets or sets descrip for region(s) as cell array -% FORMAT res = region_descrip(o, r_nos) (get) OR -% FORMAT res = region_descrip(o, r_nos, new_data) (set) -% -% See region_field for details -% -% $Id$ - -res = region_field('descrip', varargin{:}); diff --git a/lib/marsbar-0.44/@marsy/region_field.m b/lib/marsbar-0.44/@marsy/region_field.m deleted file mode 100644 index ba2ac55..0000000 --- a/lib/marsbar-0.44/@marsy/region_field.m +++ /dev/null @@ -1,35 +0,0 @@ -function res = region_field(fieldname, o, r_nos, new_data) -% method gets or sets data for region field -% FORMAT res = region_field(fieldname, o, r_nos) (get) OR -% FORMAT res = region_field(fieldname, o, r_nos, new_data) (set) -% -% Inputs -% fieldname - name of field to get / set -% o - marsy object -% r_nos - region number -% or array of region numbers -% or empty - giving all regions -% new_data - cell array, containing new data to set -% -% Returns -% (get call) -% res - cell array of region field values OR -% (set call) -% res - object with new field data set -% -% $Id$ - -if nargin < 2 - error('Need fieldname'); -end -if nargin < 3 - r_nos = []; -end -if nargin < 4 % get call - [rs r_nos] = region(o, r_nos); - for i = 1:length(r_nos) - res{i} = getfield(rs{i}, fieldname); - end -else % set call - res = region(o, r_nos, new_data, fieldname); -end diff --git a/lib/marsbar-0.44/@marsy/region_info.m b/lib/marsbar-0.44/@marsy/region_info.m deleted file mode 100644 index 6aac8d5..0000000 --- a/lib/marsbar-0.44/@marsy/region_info.m +++ /dev/null @@ -1,10 +0,0 @@ -function res = region_info(varargin) -% method gets or sets info for region(s) as cell array -% FORMAT res = region_info(o, r_nos) (get) OR -% FORMAT res = region_info(o, r_nos, new_data) (set) -% -% See region_field for details -% -% $Id$ - -res = region_field('info', varargin{:}); diff --git a/lib/marsbar-0.44/@marsy/region_name.m b/lib/marsbar-0.44/@marsy/region_name.m deleted file mode 100644 index 7cc5bce..0000000 --- a/lib/marsbar-0.44/@marsy/region_name.m +++ /dev/null @@ -1,53 +0,0 @@ -function res = region_name(o, r_nos, new_data, default_prefix) -% method gets or sets data for region name -% FORMAT res = region_name(o, r_nos) (get) OR -% FORMAT res = region_name(o, r_nos, [], default_prefix) (get) OR -% FORMAT res = region_name(o, r_nos, new_data) (set) -% -% Inputs -% o - marsy object -% r_nos - region number -% or array of region numbers -% or empty - giving all regions -% new_data - cell array, containing new names to set -% default_prefix - default prefix to make default name for -% regions with undefined names -% if empty, undefined region names are empty -% if not empty, undefined region names returned -% as prefix followed by region number -% defaults to 'region_', giving region names -% 'region_1', 'region_2' etc -% -% Returns -% (get call) -% res - cell array of region names OR -% (set call) -% res - object with new field names set -% -% $Id$ - -if nargin < 2 - r_nos = []; -end -if nargin < 3 - new_data = []; -end -if nargin < 4 - default_prefix = 'region_'; -end - -if ~isempty(new_data) % set call - res = region(o, r_nos, new_data, 'name'); -else % get call - [rs r_nos] = region(o, r_nos); - if isempty(rs), res = rs; return, end - for i = 1:length(rs) - if mars_struct('isthere', rs{i}, 'name') - res{i} = rs{i}.name; - elseif ~isempty(default_prefix) - res{i} = sprintf('%s%d', default_prefix, r_nos(i)); - else - res{i} = ''; - end - end -end diff --git a/lib/marsbar-0.44/@marsy/region_size.m b/lib/marsbar-0.44/@marsy/region_size.m deleted file mode 100644 index 666b264..0000000 --- a/lib/marsbar-0.44/@marsy/region_size.m +++ /dev/null @@ -1,75 +0,0 @@ -function [m,n] = region_size(o, r_no, dim) -% method to get size of specified region data -% FORMAT [m,n] = region_size(o, r_no, dim) -% -% Input -% o - marsy object -% r_no - region number OR vector of region numbers -% OR 'all' ['all' is default] -% dim - [optional] dimension size to return -% -% Output -% m - as for matlab SIZE call -% n - -% -% e.g -% % returns total number of timepoints (sz(1) and samples (sz(2) -% % in all regions -% sz = region_size(o); -% % same thing -% sz = region_size(o, 'all'); -% % number of samples in region 2 -% n = region_size(o, 2, 2); -% -% $Id$ - -r = n_regions(o); -if nargin < 2 - r_no = 'all'; -end -if ischar(r_no) - if strcmp(lower(r_no), 'all') - r_no = 1:r; - else - error(['Surprise request of ' r_no]); - end -else - if any(r_no > r | r_no < 1) - error('Region number(s) out of range'); - end -end - -st = y_struct(o); -r_f = isfield(st, 'regions'); -y_f = isfield(st, 'Y'); - -if ~r_f & ~y_f - error('No information for region data size'); -end - -n = 0; -for r = r_no - r_st = []; - if r_f, r_st = st.regions{r}; end - if isfield(r_st, 'Y') - [m n_r] = size(r_st.Y); - n = n + n_r; - elseif y_f - m = size(st.Y, 1); - n = n + 1; - else - error('No data to get size for region'); - end -end - -if nargin < 3 - if nargout < 2 - m = [m n]; - end -else - if dim == 2 - m = n; - elseif dim > 2 - m = ((m+n) > 0); - end -end diff --git a/lib/marsbar-0.44/@marsy/region_weights.m b/lib/marsbar-0.44/@marsy/region_weights.m deleted file mode 100644 index 147de88..0000000 --- a/lib/marsbar-0.44/@marsy/region_weights.m +++ /dev/null @@ -1,10 +0,0 @@ -function res = region_weights(varargin) -% method gets or sets weights for region(s) as cell array -% FORMAT res = region_weights(o, r_nos) (get) OR -% FORMAT res = region_weights(o, r_nos, new_data) (set) -% -% See region_field for details -% -% $Id$ - -res = region_field('weights', varargin{:}); diff --git a/lib/marsbar-0.44/@marsy/resummarize.m b/lib/marsbar-0.44/@marsy/resummarize.m deleted file mode 100644 index 040b815..0000000 --- a/lib/marsbar-0.44/@marsy/resummarize.m +++ /dev/null @@ -1,9 +0,0 @@ -function o = resummarize(o) -% recalculate summary data if possible -% -% $Id$ - -s_f = sumfunc(o); -if ~isempty(s_f) & ~strcmp(s_f, 'unknown') - [t1 t2 o] = summary_data(o, s_f); -end diff --git a/lib/marsbar-0.44/@marsy/savestruct.m b/lib/marsbar-0.44/@marsy/savestruct.m deleted file mode 100644 index 99817f7..0000000 --- a/lib/marsbar-0.44/@marsy/savestruct.m +++ /dev/null @@ -1,11 +0,0 @@ -function savestruct(obj, filename) -% saves data in y_struct as variables in .mat file -% FORMAT savestruct(object, matname) -% -% $Id$ - -if nargin ~= 2 - error('Need matfile name'); -end -savestruct(y_struct(obj), filename) -return diff --git a/lib/marsbar-0.44/@marsy/split.m b/lib/marsbar-0.44/@marsy/split.m deleted file mode 100644 index d9fa31c..0000000 --- a/lib/marsbar-0.44/@marsy/split.m +++ /dev/null @@ -1,24 +0,0 @@ -function o_arr = split(o) -% method splits regions in object into separate objects -% -% $Id$ - -r = region(o); -st = y_struct(o); -is_s = isfield(st, 'Y') & isfield(st, 'Yvar'); -if is_s - Y = st.Y; - Yvar = st.Yvar; -else - % remove any rogue Y or Yvar fields - st = mars_struct('strip', st, {'Y','Yvar'}); -end -for i = 1:length(r) - r_st = st; - r_st.regions = r(i); - if is_s - r_st.Y = Y(:, i); - r_st.Yvar = Yvar(:, i); - end - o_arr(i) = y_struct(o, r_st); -end diff --git a/lib/marsbar-0.44/@marsy/sumfunc.m b/lib/marsbar-0.44/@marsy/sumfunc.m deleted file mode 100644 index 3425d2e..0000000 --- a/lib/marsbar-0.44/@marsy/sumfunc.m +++ /dev/null @@ -1,17 +0,0 @@ -function o = sumfunc(o, sumfunc) -% method to get or set sumfunc -% -% $Id$ - -if nargin < 2 - % get - st = y_struct(o); - if isfield(st, 'sumfunc') - o = st.sumfunc; - else - o = ''; - end -else - % set - o.y_struct.sumfunc = sumfunc; -end diff --git a/lib/marsbar-0.44/@marsy/summary.m b/lib/marsbar-0.44/@marsy/summary.m deleted file mode 100644 index e9c59dd..0000000 --- a/lib/marsbar-0.44/@marsy/summary.m +++ /dev/null @@ -1,32 +0,0 @@ -function strs = summary(M) -% method returns cell array of strings describing marsy object -% -% $Id$ - -strs{1} = sprintf('Description: \t%s', summary_descrip(M)); -strs{2} = sprintf('Number of time points: \t%d', n_time_points(M)); -strs{3} = sprintf('Number of regions: \t%d', n_regions(M)); -s_f = is_summarized(M); -strs{4} = sprintf('Is summarized?: \t%s', sf_recode(s_f)); -strs{5} = sprintf('Summary function: \t%s', sumfunc(M)); -if ~s_f - strs{end+1} = sprintf('Can be summarized?: \t%s', ... - sf_recode(can_summarize(M))); -end -ns = region_name(M, [], [], ''); -if isempty(strvcat(ns)) - strs{end+1} = sprintf('Region names: \t%s', ... - 'not specified'); -else - strs{end+1} = 'Region names:'; - for i = 1:length(ns) - strs{end+1} = sprintf('Region %d: %s', i, ns{i}); - end -end -return - -function str = sf_recode(tf) -if isnan(tf), str = 'unknown'; -elseif tf, str = 'yes'; -else str = 'no'; -end diff --git a/lib/marsbar-0.44/@marsy/summary_block_means.m b/lib/marsbar-0.44/@marsy/summary_block_means.m deleted file mode 100644 index cca81d2..0000000 --- a/lib/marsbar-0.44/@marsy/summary_block_means.m +++ /dev/null @@ -1,23 +0,0 @@ -function mus = summary_block_means(Y) -% return raw means over blocks in summary data -% -% Input -% Y - marsy object -% -% mus - means over block. Returns B x N matrix -% where B is number of blocks, and N is number -% of ROIs -% -% $Id$ - -y = summary_data(Y); -r = block_rows(Y); - -B = length(r); -N = size(y, 2); - -mus = zeros(B, N); - -for b = 1:B - mus(b, :) = mean(y(r{b},:),1); -end diff --git a/lib/marsbar-0.44/@marsy/summary_data.m b/lib/marsbar-0.44/@marsy/summary_data.m deleted file mode 100644 index 89d35b3..0000000 --- a/lib/marsbar-0.44/@marsy/summary_data.m +++ /dev/null @@ -1,76 +0,0 @@ -function [Y,Yvar,o] = summary_data(o, sumfunc_str) -% method to get summary data, maybe set sumfunc -% -% Inputs -% o - marsy data object -% sumfunc_str - [optional] summary function string; one of -% 'mean', 'median', 'eig1', 'wtmean' -% If not specified, defaults to previous summary -% function for this object -% -% Output -% Y - (re)calculated summary time course -% Yvar - [optional] variance time course -% o - possibly changed marsy data object -% -% e.g. -% Y = summary_data(o); -% [Y Yvar o] = summary_data(o, 'median'); -% -% $Id$ - -if nargin > 1 - o = sumfunc(o, sumfunc_str); -end -s_f = sumfunc(o); -if isempty(s_f) - error('No summary function specified'); -end - -% Get a copy of object structure -st = y_struct(o); - -% refresh summary data if necessary -% (if sumfunc passed, OR if data is not yet available) -if nargin > 1 | ... % sumfunc passed - ~isfield(st, 'Y') | ... % Y not yet calculated - (nargout > 2 & ~isfield(st, 'Yvar')) % Yvar needed - - % If we only have one (or zero) columns per ROI, job is simple - Ys = region_data(o); - sz = summary_size(o); - if isempty(Ys) - error('No region data to summarize'); - elseif region_size(o, 'all', 2) == sz(2) % One column per ROI - Y = [Ys{:}]; - Yvar = ones(sz) * Inf; - else % More than one column per ROI - if strcmp(s_f, 'unknown') - error('Cannot recalculate from unknown sumfunc'); - end - Ws = region_weights(o); - Y = zeros(sz); - Yvar = zeros(sz); - for i = 1:sz(2); - if isempty(Ys{i}) % set to NaN if no data to summarize - Y(:,i) = NaN; - Yvar(:,i) = NaN; - else - [Y(:,i) Yvar(:,i)] = pr_sum_func(Ys{i}, s_f, Ws{i}); - end - end - if verbose(o) - fprintf('Summarizing data with summary function: %s\n', s_f); - end - end - if nargout > 2 - st.Y = Y; - st.Yvar = Yvar; - o = y_struct(o, st); - end -else % not recalculated - Y = st.Y; - if nargout > 1 - Yvar = st.Yvar; - end -end diff --git a/lib/marsbar-0.44/@marsy/summary_descrip.m b/lib/marsbar-0.44/@marsy/summary_descrip.m deleted file mode 100644 index f95dd35..0000000 --- a/lib/marsbar-0.44/@marsy/summary_descrip.m +++ /dev/null @@ -1,16 +0,0 @@ -function res = summary_descrip(o, descrip) -% get/set method for summary data description -% -% $Id$ - -st = y_struct(o); -if nargin < 2 % get - res = ''; - if isfield(st, 'descrip') - res = st.descrip; - end -else % set - st.descrip = descrip; - o = y_struct(o, st); - res = o; -end diff --git a/lib/marsbar-0.44/@marsy/summary_info.m b/lib/marsbar-0.44/@marsy/summary_info.m deleted file mode 100644 index 07455c8..0000000 --- a/lib/marsbar-0.44/@marsy/summary_info.m +++ /dev/null @@ -1,16 +0,0 @@ -function res = summary_info(o, descrip) -% get/set method for summary data info -% -% $Id$ - -st = y_struct(o); -if nargin < 2 % get - res = []; - if isfield(st, 'info') - res = st.info; - end -else % set - st.info = info; - o = y_struct(o, st); - res = o; -end diff --git a/lib/marsbar-0.44/@marsy/summary_size.m b/lib/marsbar-0.44/@marsy/summary_size.m deleted file mode 100644 index f3205a2..0000000 --- a/lib/marsbar-0.44/@marsy/summary_size.m +++ /dev/null @@ -1,31 +0,0 @@ -function [m,n] = summary_size(o, dim) -% method returns number of time points x number of regions -% -% $Id$ - -st = o.y_struct; -sz = [0 0]; -if isfield(st, 'Y') - sz = size(st.Y); -elseif isfield(st, 'regions') - if iscell(st.regions) - if isfield(st.regions{1}, 'Y') - sz(1) = size(st.regions{1}.Y, 1); - end - end - sz(2) = length(st.regions); -end - -if nargin < 2 - if nargout > 1 - m = sz(1); n = sz(2); - else - m = sz; - end -else - if dim > 2 - m = (m+n > 0) - else - m = sz(dim); - end -end diff --git a/lib/marsbar-0.44/@marsy/ui_plot.m b/lib/marsbar-0.44/@marsy/ui_plot.m deleted file mode 100644 index 621b9c4..0000000 --- a/lib/marsbar-0.44/@marsy/ui_plot.m +++ /dev/null @@ -1,270 +0,0 @@ -function r = ui_plot(o, plot_spec, plot_params) -% method plots data in various formats -% FORMAT r = ui_plot(o, plot_spec, plot_params) -% -% Input -% o - marsy object -% -% plot_spec - can be a -% string, in which case it has the same meaning as -% the structure version below, with only field 'types' -% set to this value, OR -% structure, with none ore more of fields -% (in all cases, field missing is the same as the field -% being empty) -% r_nos - region number(s) -% (if empty, -> all regions) -% b_nos - session/subject numbers -% (if empty, -> all blocks) -% types - string, or cell arrays of strings -% specifying plot type(s). Plot types can be -% one or more of: -% 'raw' - plots raw time series -% 'acf - plots autocorrelation function -% 'fft' - plots fourier analysis of time series -% 'all' - all of the above -% (defaults to 'raw') -% graphics_obj - graphics object(s) for plot. -% If empty, becomes handle SPM graphics -% window, otherwise, can be a handle to -% figure, or enough handles to axes for all -% requested plots. This is useful for putting -% the plot on a convenient figure or axis -% -% plot_params - (optional) Parameters to pass to plots -% Can be empty (giving defaults) or structure, or -% cell array of structures, one per requested plot -% Relevant fields of structure differ for different plot -% types; -% Plot 'fft': fields 'bin_length' distance between time -% points in seconds -% 'acf': fields 'lags' no of lags to plot [10] -% -% Returns -% r - results that were plotted; all the data for 'raw', all -% the acf values for 'acf', all the fft coefficients for -% 'fft'. Cell array, one cell per plot. -% -% Examples -% ui_plot(Y, 'all') plots all plot types for all regions and sessions -% ui_plot(Y, 'acf') just plots ACF, for all regions -% ui_plot(Y, struct('types', 'fft', 'r_nos', 1)) -% will plot fft for region 1 only -% f = figure; ui_plot(Y, struct('graphics_obj', f)) -% will plot all plot types to the new figure -% ui_plot(Y, 'acf', struct('lags', 8)) -% plots ACF for all regions, with lag of 8 rather than -% the default of 10 -% -% $Id$ - -% Get, check data from object -[n_rows n_cols] = summary_size(o); -if ~prod([n_rows n_cols]), warning('No data to plot'), return, end -rows = block_rows(o); -Y = summary_data(o); -N = region_name(o); -S = sumfunc(o); -info = summary_info(o); -if strcmp(S, 'unknown'), S = ''; end -if ~isempty(S), S = [' - ' S]; end - -def_spec = struct('types', {{'raw'}}, ... - 'r_nos', 1:n_cols, ... - 'b_nos', 1:length(rows),... - 'graphics_obj', []); - -% Process plot type arguments -if nargin < 2 - plot_spec = []; -end -if ischar(plot_spec), plot_spec = struct('types', plot_spec); end -plot_spec = mars_struct('fillafromb', plot_spec, def_spec); - -plot_types = plot_spec.types; -if ~iscell(plot_types) - plot_types = {plot_types}; -end -if strcmp('all', plot_types{1}) - plot_types = {'raw','acf','fft'}; -end -n_p_t = length(plot_types); -n_plots = n_p_t * length(plot_spec.r_nos); - -% Check passed graphics object(s) -gr_ob = plot_spec.graphics_obj; -if isempty(gr_ob) - gr_ob = spm_figure('GetWin','Graphics'); - spm_results_ui('Clear', gr_ob, 0); -end -if ~all(ishandle(gr_ob)) - error('One or more graphics objects are not valid'); -end -o_t = get(gr_ob, 'type'); -if iscell(o_t) - if any(diff(strvcat(o_t{:}),[],1)) - error('All graphics objects must be of the same type'); - end - o_t = o_t{1}; -end -switch o_t - case 'figure' - figure(gr_ob); - case 'axes' - if n_plots > length(gr_ob) - error('Not enough axes for planned number of plots'); - end - otherwise - error(['Completely confused by graphics object type: ' o_t]); -end - -rows = rows(plot_spec.b_nos); -n_blocks = length(rows); - -% Process plot_param arguments -if nargin < 3 - plot_params = cell(1,n_p_t); -end -if ~iscell(plot_params) - plot_params = {plot_params}; -end -if length(plot_params) == 1 - plot_params = repmat(plot_params, 1, n_p_t); -elseif length(plot_params) < n_p_t - error(sprintf('You need %d plot_param entries', n_p_t)); -end - -% Default string, bin_length for fft plots -if mars_struct('isthere', info, 'TR') - bin_length = info.TR; - bin_str = 'Hz'; -else - bin_length = 1; - bin_str = 'cycles per time point'; -end - -p_ctr = 1; -for c = plot_spec.r_nos - for p = 1:n_p_t - switch o_t - case 'figure' - subplot(n_plots, 1, p_ctr); - case 'axes' - axes(gr_ob(p_ctr)); - end - - y = Y(:,c); - - switch lower(plot_types{p}) - case 'raw' - a_r = []; - for s = 1:n_blocks - a_r = [a_r; rows{s}(:)]; - end - plot(y(a_r)); - axis tight - hold on - % add session indicators - yrg = [min(y) max(y)]; - for s = 1:n_blocks - rw = rows{s}; - if s > 1 % session divider - plot([rw(1) rw(1)]-0.5, yrg, 'k:'); - end - end - ylabel(['Signal intensity' S]) - xlabel('Time point'); - r{p_ctr} = y; - - case 'acf' - if isfield(plot_params{p}, 'lags') - lags = plot_params{p}.lags; - else lags = 10; - end - mn_len = Inf; - for s = 1:n_blocks - if length(rows{s}) < mn_len, mn_len = length(rows{s}); end - end - lags = max([1 min([mn_len-4 lags])]); - - C = []; - for s = 1:n_blocks - by = y(rows{s}); - nb_rows = length(by); - ty = toeplitz(by, [by(1) zeros(1, lags)]); - ty([1:lags n_rows+1:end], :) = []; - Cs = corrcoef(ty); - C = [C Cs(1,:)]; - n = nb_rows - 2; % df for correlation - t_th = spm_invTcdf(1-0.025, n); % t for two tailed p=0.05 - r_th(s) = sqrt(1/(n/t_th.^2+1)); % r equivalent - end - stem(C); - axis tight - hold on - % add confidence intervals, labels, session indicators - Crg = [min(C) max(C)]; - for s = 1:n_blocks - s_vals = [0 lags] + (s-1)*(lags+1) + 1; - plot(s_vals, [r_th(s) r_th(s)], 'r:'); - plot(s_vals, -[r_th(s) r_th(s)], 'r:'); - if s > 1 % session divider line - plot([s_vals(1) s_vals(1)]-0.5, Crg, 'k:'); - end - end - xtl = get(gca,'xticklabel'); - xtl = num2str(mod(str2num(xtl)-1, lags+1)); - set(gca, 'xticklabel', xtl); - - ylabel('Correlation coefficient') - xlabel('Lag'); - r{p_ctr} = C; - case 'fft' - if isfield(plot_params{p}, 'bin_length') - b_len = plot_params{p}.bin_length; - b_str = 'Hz'; - else - b_len = bin_length; - b_str = bin_str; - end - P = []; H = []; St = []; - for s = 1:n_blocks - by = y(rows{s}); - gX = abs(fft(by)).^2; - gX = gX*diag(1./sum(gX)); - q = size(gX,1); - Hz = [0:(q - 1)]/(q * b_len); - q = 2:fix(q/2); - P = [P gX(q)']; - St(s) = length(H)+1; - H = [H; Hz(q)']; - end - plot(P) - hold on - Prg = [min(P) max(P)]; - for s = 2:n_blocks - plot([St(s) St(s)]-0.5, Prg, 'k-'); - end - axis tight - % Rename tick labels - xt = get(gca, 'xtick'); - xt = xt(xt==fix(xt)); - set(gca, 'xtick', xt); - for t = 1:length(xt) - xtl_fft{t} = sprintf('%5.3f', H(xt(t))); - end - set(gca, 'xticklabel', xtl_fft); - xlabel(sprintf('Frequency (%s)', b_str)) - ylabel('Relative spectral density') - axis tight - r{p_ctr} = P; - otherwise - error(['What is this plot type: ' plot_types{p} '?']); - end - title(N{c}, 'interpreter', 'none'); - - p_ctr = p_ctr + 1; - end -end - -return diff --git a/lib/marsbar-0.44/@marsy/verbose.m b/lib/marsbar-0.44/@marsy/verbose.m deleted file mode 100644 index 9438539..0000000 --- a/lib/marsbar-0.44/@marsy/verbose.m +++ /dev/null @@ -1,11 +0,0 @@ -function res = verbose(obj, data) -% get/set method for verbose field -% -% $Id$ - -if nargin > 1 - obj.verbose = data; - res = obj; -else - res = obj.verbose; -end diff --git a/lib/marsbar-0.44/@marsy/xyz.m b/lib/marsbar-0.44/@marsy/xyz.m deleted file mode 100644 index 4878630..0000000 --- a/lib/marsbar-0.44/@marsy/xyz.m +++ /dev/null @@ -1,53 +0,0 @@ -function [XYZ, M]= xyz(o, r_no, xyz_type) -% gets XYZ coordinates for region -% FORMAT [XYZ M]= xyz(o, r_no, xyz_type) -% -% Inputs -% o - marsy object -% r_no - region number -% xyz_type - string, one of 'mm','real','vox' -% where 'real' is a synonym for 'mm' -% and 'mm' is the default (if not passed) -% 'mm' results in coordinates in mm -% 'vox' gives coordinates in voxels -% -% Outputs -% XYZ - coordinates in specified reference -% M - 4x4 transformation mapping voxels to mm -% -% $Id$ - -r = n_regions(o); -if nargin < 2 - error('Need region number to get XYZ coordinates') -end -if r_no > r - error('Region number too large'); -end -if nargin < 3 - xyz_type = 'mm'; -end - -XYZ = []; -M = eye(4); -st = y_struct(o); -if ~isfield(st, 'regions') - return -end -r_st = st.regions{r_no}; -if ~isfield(r_st, 'vXYZ') | ~isfield(r_st, 'mat') - return -end -XYZ = r_st.vXYZ; -if isempty(XYZ), return, end -switch xyz_type - case 'vox' - case {'mm', 'real'} - [m n] = size(XYZ); - if m == 3, XYZ = [XYZ; ones(1, n)]; end - M = r_st.mat; - XYZ = M * XYZ; - otherwise - error(['Unknown coordinate type: ' xyz_type]); -end -XYZ = XYZ(1:3,:); diff --git a/lib/marsbar-0.44/@marsy/y_struct.m b/lib/marsbar-0.44/@marsy/y_struct.m deleted file mode 100644 index 96a0bf7..0000000 --- a/lib/marsbar-0.44/@marsy/y_struct.m +++ /dev/null @@ -1,11 +0,0 @@ -function res = y_struct(obj, Struct) -% get/set method for y_struct field -% -% $Id$ - -if nargin > 1 - obj.y_struct = Struct; - res = obj; -else - res = obj.y_struct; -end diff --git a/lib/marsbar-0.44/contents.m b/lib/marsbar-0.44/contents.m deleted file mode 100644 index 758fdf1..0000000 --- a/lib/marsbar-0.44/contents.m +++ /dev/null @@ -1,443 +0,0 @@ -% Contents of MarsBaR ROI toolbox version 0.44 -% -% mars_arm - wrapper function for MarsBaR marmoire object -% mars_arm_call - services callbacks from marmoire object set functions -% mars_armoire - multifunction function to get/set various stores of stuff -% mars_blob2roi - saves ROI for cluster in xSPM structure, containing point pt -% mars_blob_menu - puts up ROI menu to add to SPM results interface -% mars_blobs2rois - creates ROIs from spm_results_ui SPM -% mars_build_roi - builds ROIs via the SPM GUI -% mars_display_roi - utility routines for display of ROIs in graphic window -% mars_get_option - Get option subfield as named by ``varargin``. -% mars_image_scaling - get image scaling data for images, maybe via SPM design -% mars_img2rois - creates ROIs from cluster image or image containing ROIs defined by unique nos -% mars_new_space - make a new image space to contain image with rotations etc -% mars_options - options utility routines -% mars_orthviews - Display Orthogonal Views of a Normalized Image -% mars_rois2img - creates cluster or number labelled ROI image from ROIs -% mars_struct - multifunction function for manipulating structures -% mars_uifile - wrapper for matlab uiputfile/getfile; to resolve version differences -% mars_utils - collection of useful utility functions for MarsBaR etc -% mars_vol_check - FORMAT [samef, msg, chgf] = mars_vol_check(V1, V2, ...) -% mars_vol_utils - collection of useful utility functions for vol structs -% marsbar - Startup, callback and utility routine for Marsbar -% savestruct - saves data in structure as variables in .mat file -% -% @mardo/add_contrasts - method to add contrast definitions to design -% @mardo/adjusted_data - Return adjusted data for estimated design and contrast no -% @mardo/betas - method to get estimated betas -% @mardo/block_mean_cols - method returns rows for means for blocks in design -% @mardo/block_means - method returns means for blocks in design -% @mardo/cd_images - method for changing path to image files in design -% @mardo/contrasts - method to get or set contrasts -% @mardo/data - method to get or set data object -% @mardo/des_struct - get/set method for des_struct field -% @mardo/descrip - method gets cell string description of design -% @mardo/design_matrix - method returns design matrix from design -% @mardo/design_structure - method to get or set SPM design structure -% @mardo/display - display method for mardo objects -% @mardo/error_df - method returns error df from design -% @mardo/event_fitted - method to compute fitted event time course -% @mardo/event_fitted_fir - method to compute fitted event time courses using FIR -% @mardo/event_signal - method to compute % signal change from fMRI events -% @mardo/event_types - method to get / set event types for design -% @mardo/event_types_named - method returns event types structures for events with same names -% @mardo/flip_images - flips images in design -% @mardo/flip_option - get/set flag for flipping images in design -% @mardo/full_vol - returns vol with full path, from vols, or image names -% @mardo/get_contrast_by_name - get named contrast(s) from design contrast structure -% @mardo/get_contrasts - method to get contrasts from design object -% @mardo/get_data - method to get data from design object -% @mardo/get_vol_field - method to get named field, containing or referring to vol structs -% @mardo/has_contrasts - method returns 1 if design has contrasts -% @mardo/has_filter - returns 1 if object contains filter -% @mardo/has_images - returns 1 if design contains images, NaN if not known -% @mardo/has_whitener - returns 1 if design has whitening filter -% @mardo/image_names - method returning image file names for design -% @mardo/images - method to get or set images -% @mardo/is_fmri - method returns 1 if this is an fmri design -% @mardo/is_mars_estimated - method returns 1 if design has been estimated in MarsBaR -% @mardo/is_marsed - returns 1 if design has been processed with MarsBaR -% @mardo/is_spm_estimated - returns 1 if design has been estimated in SPM -% @mardo/is_valid - returns 1 if object contains valid SPM/MarsBaR design -% @mardo/isempty - overloaded isempty method for mardo object -% @mardo/isfield - method to overload isfield for mardo objects -% @mardo/mardo - mardo - class constructor for MarsBaR design object -% @mardo/mars_tag - returns, or sets, Mars tagging structure in design -% @mardo/marsy_data - method to get or set marsy data -% @mardo/masking_struct - method to get or set SPM masking structure -% @mardo/modality - method returns modality of design -% @mardo/n_effects - get number of effects (columns) in design -% @mardo/n_time_points - get number of time_points in design -% @mardo/native_vol_ver - return string specifying native vol type -% @mardo/paramfields - returns struct with fields from maroi object useful for copying objects -% @mardo/prefix_images - method for adding or removing prefix from file names in design -% @mardo/refresh_contrasts - method to refresh contrasts to match design -% @mardo/residuals - method returns residuals from model -% @mardo/savestruct - saves data in def_struct as variables in .mat file -% @mardo/set_contrasts - method to set contrasts into design object -% @mardo/set_data - method to set data for design object -% @mardo/set_vol_field - method to set named field, containing or referring to vol structs -% @mardo/stat_table - gets Mars statistics and creates statistic table as cell array -% @mardo/subsasgn - method to overload . notation in assignments. -% @mardo/subsref - method to overload the . notation. -% @mardo/summary - method returns cell array of strings describing design -% @mardo/swd - method to get/set design directory -% @mardo/swd_writable - returns true if swd directory can be written to -% @mardo/type - returns SPM version string corresponding to design type -% @mardo/ui_et_edit - method to edit invidual event types in design -% @mardo/ui_et_edit_cb - method to handle callbacks from ui_et_edit -% @mardo/ui_event_types - ui method for selection / editing of event types -% @mardo/ui_event_types_cb - method to handle callbacks from ui_event_types -% @mardo/ui_ft_design_data - method plots FT of design and data to graphics window -% @mardo/ui_get_contrasts - SPM contrast UI, wrapped for MarsBaR -% @mardo/unfiltered_efficiency - Calculate unfiltered efficiency for given SPM design and contrast -% @mardo/verbose - get/set method for verbose field -% -% @mardo/private/pr_ev_diff - method to calculate event height for % signal change -% @mardo/private/pr_refresh_et - Refreshes data and display of event type window after edit -% @mardo/private/pr_sort_evs - function to sort event according to sort type -% -% @mardo_2/add_trial_f - method to add trial-specific F contrasts -% @mardo_2/apply_filter - applies filter in design to data -% @mardo_2/autocorr - method to set autocorrelation types for design -% @mardo_2/bf_dt - method returns length of time bin for basis functions -% @mardo_2/block_cols - method gets design columns for block (session / subject) -% @mardo_2/block_rows - returns cell array of rows for each (subject/session) block -% @mardo_2/can_mars_estimate - method returns 1 if design can be estimated in MarsBaR -% @mardo_2/compute_contrasts - compute and return results of contrast statistics -% @mardo_2/convert_vols - method that converts vol structs in design and converts to format 'ver' -% @mardo_2/design_vol - returns vols in appropriate format for saving in design -% @mardo_2/estimate - estimate method - estimates GLM for SPM2 model -% @mardo_2/event_cols - method gets design columns for single event -% @mardo_2/event_onsets - method gets onsets and durations for event/session -% @mardo_2/event_regressor - method gets estimated regressor for single event -% @mardo_2/event_specs - method to return event specifications for all event in model -% @mardo_2/event_x_fir - method to return FIR design matrix columns for session -% @mardo_2/fill - fills missing entries from SPM FMRI design matrix -% @mardo_2/fwhm - method returns FWHM, or empty if not available -% @mardo_2/get_images - method to get image vols from design -% @mardo_2/has_autocorr - returns 1 if object contains autocorrelation specification -% @mardo_2/has_filter - returns 1 if object contains filter -% @mardo_2/has_images - returns 1 if design contains images -% @mardo_2/has_whitener - returns 1 if design has whitening filter -% @mardo_2/mardo_2 - class constructor for SPM2 MarsBaR design object -% @mardo_2/mardo_99 - method to convert SPM2 design to SPM99 design -% @mardo_2/mars_spm_graph - Graphical display of adjusted data -% @mardo_2/modality - method returns modality of design -% @mardo_2/save_spm - method to save design as SPM format design structure -% @mardo_2/savestruct - saves data in def_struct into .mat file with variable name SPM -% @mardo_2/set_images - method to set image vols to design -% @mardo_2/tr - method returns TR in seconds, or empty if not available -% @mardo_2/type - returns SPM version string corresponding to design type -% @mardo_2/ui_build - method to create / fill design via GUI -% @mardo_2/ui_get_event - method to select an event -% @mardo_2/ui_get_filter - method to get filter via GUI -% @mardo_2/ui_report - method for SPM2 design reporting -% @mardo_2/ui_report_fmri - Interactive review of fMRI design matrix -% -% @mardo_2/private/my_design - returns 1 if design looks like it is of SPM99 type -% @mardo_2/private/pr_estimate - Estimation of a General Linear Model -% @mardo_2/private/pr_fmri_design - MarsBaR version of spm_fMRI design - asssembles a design for fMRI studies -% @mardo_2/private/pr_fmristat_ar - function returns estimated AR coefficients using fmristat algorithm -% @mardo_2/private/pr_get_filter - gets filter using spm_fmri_spm_ui routines -% @mardo_2/private/pr_spm_ce - return error covariance constraints for serially correlated data -% @mardo_2/private/pr_spm_diff - matrix differential -% @mardo_2/private/pr_spm_filter - Removes low frequency confounds X0 -% @mardo_2/private/pr_spm_get_bf - fills in basis function structure -% @mardo_2/private/pr_spm_get_ons - returns input [designed effects] structures -% @mardo_2/private/pr_spm_gpdf - Probability Density Function (PDF) of Gamma distribution -% @mardo_2/private/pr_spm_hrf - returns a hemodynamic response function -% @mardo_2/private/pr_spm_orth - recursive orthogonalization of basis functions -% @mardo_2/private/pr_spm_q - returns an (n x n) autocorrelation matrix for an AR(p) process -% @mardo_2/private/pr_spm_reml - REML estimation of covariance components from Cov{y} -% @mardo_2/private/pr_spm_svd - computationally efficient SVD (that can handle sparse arguments) -% @mardo_2/private/pr_spm_ui - MarsBaR: setting up the general linear model for independent data -% @mardo_2/private/pr_spm_volterra - generalized convolution of inputs (U) with basis set (bf) -% @mardo_2/private/pr_stat_compute - private function to compute statistics for SPM2 design -% @mardo_2/private/pr_stat_compute_mv - private function to compute mutlivariate statistics across ROIs -% -% @mardo_5/autocorr - method to set autocorrelation types for design -% @mardo_5/convert_vols - method that converts vol structs in design and converts to format 'ver' -% @mardo_5/estimate - estimate method - estimates GLM for SPM2 model -% @mardo_5/fill - fills missing entries from SPM FMRI design matrix -% @mardo_5/mardo_5 - class constructor for SPM5 MarsBaR design object -% @mardo_5/native_vol_ver - return string specifying native vol type -% @mardo_5/type - returns SPM version string corresponding to design type -% @mardo_5/ui_build - method to create / fill design via GUI -% -% @mardo_5/private/my_design - returns 1 if design looks like it is of SPM5 / 8 type -% @mardo_5/private/pr_estimate - Estimation of a General Linear Model -% @mardo_5/private/pr_fmri_design - MarsBaR version of spm_fMRI design - asssembles a design for fMRI studies -% @mardo_5/private/pr_fmristat_ar - function returns estimated AR coefficients using fmristat algorithm -% @mardo_5/private/pr_get_filter - gets filter using spm_fmri_spm_ui routines -% @mardo_5/private/pr_spm_cat - converts a cell array into a matrix -% @mardo_5/private/pr_spm_ce - return error covariance constraints for serially correlated data -% @mardo_5/private/pr_spm_diff - matrix high-order differentials -% @mardo_5/private/pr_spm_en - Euclidean normalization -% @mardo_5/private/pr_spm_fileparts - Like fileparts, but separates off a comma separated list at the end -% @mardo_5/private/pr_spm_filter - Removes low frequency confounds X0 -% @mardo_5/private/pr_spm_get_bf - fills in basis function structure -% @mardo_5/private/pr_spm_get_ons - returns input [designed effects] structures -% @mardo_5/private/pr_spm_gpdf - Probability Density Function (PDF) of Gamma distribution -% @mardo_5/private/pr_spm_hrf - returns a hemodynamic response function -% @mardo_5/private/pr_spm_justify - Justify text -% @mardo_5/private/pr_spm_logdet - returns the log of the determinant of positive semi-definite matrix C -% @mardo_5/private/pr_spm_non_sphericity - return error covariance constraints for basic ANOVA designs -% @mardo_5/private/pr_spm_orth - recursive orthogonalization of basis functions -% @mardo_5/private/pr_spm_q - returns an (n x n) autocorrelation matrix for an AR(p) process -% @mardo_5/private/pr_spm_reml - ReML estimation of covariance components from y*y' -% @mardo_5/private/pr_spm_select - File selector -% @mardo_5/private/pr_spm_svd - computationally efficient SVD (that can handle sparse arguments) -% @mardo_5/private/pr_spm_ui - MarsBaR: Setting up the general linear model for independent data -% @mardo_5/private/pr_spm_unvec - unvectorises a vectorised array -% @mardo_5/private/pr_spm_vec - vectorises a numeric, cell or structure array -% @mardo_5/private/pr_spm_volterra - generalized convolution of inputs (U) with basis set (bf) -% @mardo_5/private/pr_stat_compute - private function to compute statistics for SPM2 design -% @mardo_5/private/pr_stat_compute_mv - private function to compute mutlivariate statistics across ROIs -% -% @mardo_99/add_trial_f - method to add trial-specific F contrasts -% @mardo_99/apply_filter - applies filter in design to data -% @mardo_99/autocorr - method to report lack of autocorrelation options for SPM99 -% @mardo_99/bf_dt - method returns length of time bin for basis functions -% @mardo_99/block_cols - method gets design columns for block (session / subject) -% @mardo_99/block_rows - returns cell array of rows for each (subject/session) block -% @mardo_99/can_mars_estimate - method returns 1 if design can be estimated in MarsBaR -% @mardo_99/compute_contrasts - compute and return stats -% @mardo_99/convert_vols - method that converts vol structs in design and converts to format 'ver' -% @mardo_99/design_vol - returns vols in appropriate format for saving in design -% @mardo_99/estimate - estimate method - estimates GLM for SPM99 model -% @mardo_99/event_cols - method gets design columns for single event -% @mardo_99/event_onsets - method gets (estimated) onsets and durations for event/session -% @mardo_99/event_regressor - method gets estimated regressor for single event -% @mardo_99/event_specs - method to return event specifications for all event in model -% @mardo_99/event_x_fir - method to return FIR design matrix columns for session -% @mardo_99/fill - fills missing entries from SPM FMRI design matrix -% @mardo_99/fwhm - method returns FWHM, or empty if not available -% @mardo_99/get_images - method to get image vols from design -% @mardo_99/has_autocorr - returns 1 if object contains autocorrelation specification -% @mardo_99/has_filter - returns 1 if object contains filter -% @mardo_99/has_images - returns 1 if design contains images -% @mardo_99/mardo_2 - method to convert SPM2 design to SPM99 design -% @mardo_99/mardo_99 - class constructor for SPM99 MarsBaR design object -% @mardo_99/mars_spm_graph - Graphical display of adjusted data -% @mardo_99/modality - method returns modality of design -% @mardo_99/save_spm - method to save design as SPM format design structure -% @mardo_99/set_images - method to set image vols into design -% @mardo_99/tr - method returns TR in seconds, or empty if not available -% @mardo_99/type - returns SPM version string corresponding to design type -% @mardo_99/ui_build - method to create / fill design via GUI -% @mardo_99/ui_get_event - method to select an event -% @mardo_99/ui_get_filter - method to get filter via GUI -% @mardo_99/ui_report - mathod for SPM99 design reporting -% @mardo_99/ui_report_fmri - Interactive review of fMRI design matrix -% -% @mardo_99/private/my_design - returns 1 if design looks like it is of SPM99 type -% @mardo_99/private/pr_estimate - Estimation of a General Linear Model -% @mardo_99/private/pr_fmri_design - MarsBaR version of spm_fMRI design - asssembles a design for fMRI studies -% @mardo_99/private/pr_get_filter - gets filter using spm_fmri_spm_ui routines -% @mardo_99/private/pr_spm_filter - contruct and/or apply high and/or low pass filter -% @mardo_99/private/pr_spm_get_bf - creates basis functions for each trial type {i} in struct BF{i} -% @mardo_99/private/pr_spm_get_ons - returns onset times for events -% @mardo_99/private/pr_spm_hrf - returns a hemodynamic response function -% @mardo_99/private/pr_spm_orth - recursive orthogonalization of basis functions -% @mardo_99/private/pr_spm_ui - MarsBaR: setting up the general linear model for independent data -% @mardo_99/private/pr_spm_volterra - returns [design] matrix of explanatory variables -% @mardo_99/private/pr_stat_compute - calculates contrast value, stats and p values for contrasts -% @mardo_99/private/pr_stat_compute_mv - compute multivariate statistics across ROIs -% -% @marmoire/add_if_absent - Adds item only if not already present -% @marmoire/add_item - add item to armoire -% @marmoire/clear_item_data - sets data for item to empty -% @marmoire/default_item - returns default item -% @marmoire/do_save - method to save data for item -% @marmoire/do_set - private function to set data into item -% @marmoire/get_item_data - get data for item -% @marmoire/get_item_param - method to get item parameters -% @marmoire/get_item_struct - get whole item structure, including parameters -% @marmoire/isempty_item_data - returns 1 if no data for this item -% @marmoire/item_exists - returns true if there is an item of this name -% @marmoire/item_needs_save - return 1 if item requires a save -% @marmoire/marmoire - marmoire - class constructor for marmoire container type -% @marmoire/save_item_data - save data for item to file -% @marmoire/save_item_data_ui - save data for item to file using GUI -% @marmoire/set_item_data - sets data for item -% @marmoire/set_item_data_ui - sets data for item using GUI -% @marmoire/set_item_param - method to set item parameters -% @marmoire/set_item_struct - set whole item structure, including parameters -% @marmoire/update_item_data - updates data for item (sets data, flags change) -% -% @marmoire/private/pr_is_nan - (No help available) -% @marmoire/private/pr_is_nix - (No help available) -% @marmoire/private/pr_isempty - private function returns 1 if there is no data, or filename -% @marmoire/private/pr_needs_save - private function returning 1 if item data needs save -% -% @maroi/and - overloaded add function -% @maroi/are_same - returns 1 if rois are the same -% @maroi/back2base - back2base method - check for spacebase, transform thereto -% @maroi/binarize - binarize - returns / sets binarize value for object -% @maroi/c_o_m - c_o_m method - calculates unweighted centre of mass -% @maroi/classdata - classdata method - sets/gets class data -% @maroi/descrip - name - returns / sets name value for object -% @maroi/display - display - method -% @maroi/eq - overloaded eq function -% @maroi/flip_lr - flips ROI left / right -% @maroi/ge - overloaded ge function -% @maroi/get_marsy - gets data in ROIs from images -% @maroi/getdata - getdata method - fetches time series data for ROI from images -% @maroi/gt - overloaded gt (greater than) function -% @maroi/has_space - has_space method - returns true if object has a native space -% @maroi/history - history - returns / sets history value for object -% @maroi/label - label - returns / sets label value for object -% @maroi/le - overloaded le (less than or equal to) function -% @maroi/loadobj - loadobj method - fills fields needed for backwards compatibility -% @maroi/lt - overloaded lt (less than) function -% @maroi/maroi - maroi - class constructor for umbrella ROI object -% @maroi/maroi_matrix - maroi_matrix method - converts roi to maroi matrix type -% @maroi/minus - overloaded minus function -% @maroi/mrdivide - overloaded mrdivide (matrix right divide) function -% @maroi/mtimes - overloaded mtimes function -% @maroi/native_space - native_space method - returns native space of object -% @maroi/ne - overloaded ne function -% @maroi/not - overloaded not function -% @maroi/or - overloaded or function -% @maroi/paramfields - returns struct with fields from maroi object useful for copying objects -% @maroi/plus - overloaded plus function -% @maroi/rdivide - overloaded rdivide function -% @maroi/realpts - realpts method - returns 3xN XYZ matrix in mm -% @maroi/rle - run length encoding method -% @maroi/roithresh - roithresh - returns / sets roithresh value for object -% @maroi/save_as_image - method save_as_image - saves ROI as image -% @maroi/save_mricro - saves in MRIcro format -% @maroi/saveroi - saveroi method - checks fname, sets source field, saves object -% @maroi/source - source - returns / sets source value for object -% @maroi/spm_hold - hold - returns / sets hold value for object -% @maroi/times - overloaded times function -% @maroi/volume - volume method - returns volume of ROI in mm -% @maroi/xor - overloaded xor function -% -% @maroi/private/my_classdata - my_classdata method - sets/gets class data -% @maroi/private/my_loadroi - my_loadroi function - loads ROI from file, sets source field -% @maroi/private/my_roifname - changes fname to appropriate ROI format -% -% @maroi_box/centre - centre method - sets / returns centre of ROI in mm -% @maroi_box/flip_lr - flips ROI left / right -% @maroi_box/is_empty_roi - returns 1 if ROI contains no volume -% @maroi_box/maroi_box - maroi_box - class constructor -% @maroi_box/volume - volume method - returns volume of ROI in mm -% @maroi_box/voxpts - voxpts method - voxels within a box in given space -% -% @maroi_image/flip_lr - flips ROI left / right -% @maroi_image/loadobj - loadobj method - reloads matrix from img file -% @maroi_image/maroi_image - maroi_image - class constructor -% @maroi_image/maroi_matrix - maroi_matrix method - converts maroi_image to maroi_matrix -% @maroi_image/saveobj - saveobj method - removes matrix information from parent to save space -% @maroi_image/vol - vol - returns / sets image vol for object -% -% @maroi_image/private/my_vol_func - checks vol and func, returns processed image matrix or error -% -% @maroi_matrix/do_write_image - method saves matrix as image and returns spm_vol -% @maroi_matrix/domaths - helper function to do maths on matrix object -% @maroi_matrix/flip_lr - flips ROI left / right -% @maroi_matrix/is_empty_roi - is_empty_roi - returns true if ROI contains no volume -% @maroi_matrix/loadobj - loadobj function - undoes run length encoding if appropriate -% @maroi_matrix/maroi_matrix - maroi_matrix - class constructor -% @maroi_matrix/matrixdata - matrixdata method - gets matrix from ROI object -% @maroi_matrix/native_space - native_space method - returns native space of object -% @maroi_matrix/rebase - rebase method - returns data from maroi_matrix in new space -% @maroi_matrix/saveobj - saveobj function - does run length encoding if helpful -% @maroi_matrix/spm_mat - spm_mat method - returns mat file defining orientation etc -% @maroi_matrix/voxpts - voxpts method - returns 3xN ijk matrix in voxels -% -% @maroi_matrix/private/my_rld - function to do run length decoding -% @maroi_matrix/private/my_rle - method to do run length encoding on matrix -% -% @maroi_pointlist/flip_lr - flips ROI left / right -% @maroi_pointlist/getvals - returns vals for pointlist object -% @maroi_pointlist/is_empty_roi - is_empty_roi - returns true if ROI contains no volume -% @maroi_pointlist/loadobj - loadobj method - creates temporary voxel block -% @maroi_pointlist/maroi_matrix - maroi_matrix method - converts roi to maroi matrix type -% @maroi_pointlist/maroi_pointlist - maroi_pointlist - class constructor -% @maroi_pointlist/native_space - native_space method - returns native space of object -% @maroi_pointlist/saveobj - saveobj method - removes temporary voxblock structure -% @maroi_pointlist/voxpts - voxpts method - returns 3xN ijk matrix in voxels -% -% @maroi_pointlist/private/my_voxblock - returns voxel block and modified mat file for pointlist -% -% @maroi_shape/c_o_m - c_o_m method - calculates centre of mass -% @maroi_shape/has_space - has_space method - returns true if object has a native space -% @maroi_shape/maroi_matrix - method to convert shape objects to maroi_matrix objects -% @maroi_shape/maroi_shape - maroi_shape - (virtual) shape roi class constructor -% -% @maroi_sphere/centre - centre method - sets / returns centre of ROI in mm -% @maroi_sphere/flip_lr - flips ROI left / right -% @maroi_sphere/is_empty_roi - is_empty_roi - returns true if ROI contains no volume -% @maroi_sphere/maroi_sphere - maroi_sphere - class constructor -% @maroi_sphere/volume - volume method - returns volume of ROI in mm -% @maroi_sphere/voxpts - voxpts method - voxels within a sphere in given space -% -% @mars_space/display - display method for mars_space object -% @mars_space/eq - overloaded eq method for mars_space objects -% @mars_space/mars_space - mars_space - class constructor for space defining object -% @mars_space/subsasgn - method to over load . notation in assignments. -% @mars_space/subsref - method to overload the . notation. -% -% @marsy/as_summary_only - returns object with region data removed -% @marsy/block_rows - gets/sets cell array of rows for each (subject/session) block -% @marsy/can_summarize - returns 1 if object contains enough information to be summarized -% @marsy/display - display method for marsy objects -% @marsy/eq - method overrides == operator -% @marsy/is_summarized - returns 1 if object contains calculated summary data -% @marsy/is_summary_only - method returns 1 if object only contains summary data -% @marsy/is_valid - method returns 1 if object contains valid data -% @marsy/join - joins marsy objects into one object -% @marsy/marsy - Class constructor for marsy: the MarsBaR data object -% @marsy/n_blocks - method returns number of subjects/sessions in data -% @marsy/n_regions - get number of regions -% @marsy/n_time_points - get number of time_points -% @marsy/ne - method overrides ~= operator -% @marsy/region - gets / sets data for region or regions -% @marsy/region_data - method gets or sets data for region(s) as cell array -% @marsy/region_descrip - method gets or sets descrip for region(s) as cell array -% @marsy/region_field - method gets or sets data for region field -% @marsy/region_info - method gets or sets info for region(s) as cell array -% @marsy/region_name - method gets or sets data for region name -% @marsy/region_size - method to get size of specified region data -% @marsy/region_weights - method gets or sets weights for region(s) as cell array -% @marsy/resummarize - recalculate summary data if possible -% @marsy/savestruct - saves data in y_struct as variables in .mat file -% @marsy/split - method splits regions in object into separate objects -% @marsy/sumfunc - method to get or set sumfunc -% @marsy/summary - method returns cell array of strings describing marsy object -% @marsy/summary_block_means - return raw means over blocks in summary data -% @marsy/summary_data - method to get summary data, maybe set sumfunc -% @marsy/summary_descrip - get/set method for summary data description -% @marsy/summary_info - get/set method for summary data info -% @marsy/summary_size - method returns number of time points x number of regions -% @marsy/ui_plot - method plots data in various formats -% @marsy/verbose - get/set method for verbose field -% @marsy/xyz - gets XYZ coordinates for region -% @marsy/y_struct - get/set method for y_struct field -% -% @marsy/private/pr_sum_func - creates summary stats for region data -% -% release/make_contents - MAKECONTENTS makes Contents file, usually in current working directory. -% release/pre_release - Runs pre-release export, cleanup -% release/test_rig - runs tests on MarsBaR using specified designs -% -% spm2/mars_blob_ui - Displays SPM results, and ROI menu in SPM input window -% spm2/mars_veropts - returns SPM version specific parameters -% spm2/spm_create_image - Wrapper for spm_create_vol, for compatibility with SPM99 -% -% spm5/mars_blob_ui - Displays SPM results, and ROI menu in SPM input window -% spm5/mars_veropts - returns SPM version specific parameters -% spm5/spm_create_image - Wrapper for spm_create_vol, for compatibility with SPM99 -% spm5/spm_get - compatibility function to allow spm_get calls with SPM5 -% -% spm99/mars_blob_ui - Displays SPM results, and ROI menu in SPM input window -% spm99/mars_veropts - returns SPM version specific parameters -% spm99/spm_close_vol - Close image volume - for SPM2 / SPM99 compatibility -% spm99/spm_create_vol - Wrapper for spm_create_image, for compatibility with SPM2 -% spm99/spm_read_hdr - SPM2 routine to read (SPM customised) Analyze header -% spm99/spm_write_plane - Write a transverse plane of image data. -% spm99/spm_write_vol - Write an image volume to disk, setting scales and offsets as appropriate diff --git a/lib/marsbar-0.44/examples/batch/README b/lib/marsbar-0.44/examples/batch/README deleted file mode 100644 index c87074f..0000000 --- a/lib/marsbar-0.44/examples/batch/README +++ /dev/null @@ -1,34 +0,0 @@ -Batch processing scripts for MarsBaR example data -------------------------------------------------- - -This directory contains the batch scripts for preprocessing of the -MarsBaR example dataset. You can get the dataset from the MarsBaR -download page, currently: - -https://sourceforge.net/project/showfiles.php?group_id=76381 - -To run initial processing on the dataset in SPM, start matlab, change -('cd') to the '/examples/batch' directory, and, from the -console window run: - -run_preprocess - -The routines will create smoothed images and run a standard -SPM statistical model on each of the three sessions. - -The routines should work with SPM99 through SPM12. - -There is also an example batch script for MarsBaR that replicates the -analyses described in the MarsBaR tutorial; see -http://marsbar.sourceforge.net. To run: - -run_tutorial - -Please use the MarsBaR mailing list for any questions or to report -problems: - -https://lists.souceforge.net/lists/listinfo/marsbar-users - -We wish you a pleasant FMRI experience, - -Matthew Brett - for the team diff --git a/lib/marsbar-0.44/examples/batch/configure_er_model.m b/lib/marsbar-0.44/examples/batch/configure_er_model.m deleted file mode 100644 index 798de53..0000000 --- a/lib/marsbar-0.44/examples/batch/configure_er_model.m +++ /dev/null @@ -1,92 +0,0 @@ -function model_file = configure_er_model(sess_dir, sesses, sdirname) -% batch script wrapper to configure model for MarsBaR ER data -% -% sess_dir - directory containing session directories -% sesses - string or cell array of session directory names -% sdirname - subdirectory name to put model in -% -% Returns -% model_file - full path to SPM model file -% -% This wrapper does single or multisesson analyses. -% -% If only one session directory is passed, and sdirname is not an absolute -% path, then the function assumes sdirname is a subdirectory of the session -% directory -% -% $Id: configure_er_model.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $ - -if nargin < 1 - error('Need directory containing session subdirectories'); -end -if nargin < 2 - error('Need directory names for sessions'); -end -if ischar(sesses), sesses = cellstr(sesses); end -if nargin < 3 - error('Need subdirectory name for results'); -end - -% store path -pwd_orig = pwd; - -% make absolute path -sess_dir = spm_get('CPath', sess_dir); - -% If only one session directory is passed, and sdirname is not an -% absolute path, then assume sdirname is a subdirectory of the session -% directory -if ~sf_isabspath(sdirname) & length(sesses) == 1 - sdir_parent = fullfile(sess_dir, sesses{1}); -else - sdir_parent = sess_dir; -end - -% results directory -ana_dir = fullfile(sdir_parent, sdirname); -if ~exist(ana_dir, 'dir') - mkdir(sdir_parent, sdirname); -end - -switch spm('ver') - case 'SPM99' - % Batch directory should be current directory, but maybe not - m_file = 'er_model_spm99'; - ms = which(m_file); - if isempty(ms) - error(sprintf(['Hmm - can''t find %s on the path - maybe ' ... - 'you should run from the batch directory'], ... - m_file)) - end - - % Fill batch thing and send - global SPM_BCH_VARS - SPM_BCH_VARS = struct(... - 'work_dir', ana_dir, ... - 'sess_dir', sess_dir, ... - 'sesses', {sesses}, ... - 'ana_type', 1, ... % model - 'm_file', ms); - spm_bch('do_bch_wrapper'); - model_file = fullfile(ana_dir, 'SPMcfg.mat'); - - otherwise - er_model_spm2(sess_dir, sesses, ana_dir); - model_file = fullfile(ana_dir, 'SPM.mat'); - -end - -return - -function absf = sf_isabspath(path) -%======================================================================= -%-Returns true if path is absolute, false if relative (or empty) -switch (spm_platform('filesys')) -case 'unx' - if (~isempty(path) & path(1)=='/'), absf=1; else, absf=0; end -case 'win' - if (length(path)>1 & path(2)==':'), absf=1; else, absf=0; end -otherwise - error('isabspath not coded for this filesystem'); -end -return diff --git a/lib/marsbar-0.44/examples/batch/do_bch_wrapper.m b/lib/marsbar-0.44/examples/batch/do_bch_wrapper.m deleted file mode 100644 index 517a4c6..0000000 --- a/lib/marsbar-0.44/examples/batch/do_bch_wrapper.m +++ /dev/null @@ -1,37 +0,0 @@ -%--------------------------------------------------------------- -% Generic single analysis wrapper for SPM99 crash mode. -% Sorry, I mean SPM99 batch mode. -%--------------------------------------------------------------- -% The analysis parameters are specified here using the global variable -% SPM_BCH_VARS -% Fields are: -% work_dir - work_dir -% ana_type - number specifying analysis type -% m_file - string giving mfile to run -% -% We have to use the global variable to pass parameters here because of -% the peculiarities of the batch mode. -%--------------------------------------------------------------- -% -% $Id: do_bch_wrapper.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $ - -global SPM_BCH_VARS - -% get (and make) the subdirectory in the main directory -work_dir = {SPM_BCH_VARS.work_dir}; -[pn1 pn2] = fileparts(work_dir{1}); -if ~exist(work_dir{1}, 'dir') - mkdir(pn1, pn2); -end - -analyses = struct( ... - 'type', SPM_BCH_VARS.ana_type, ... - 'index', 1, ... - 'work_dir', 1, ... - 'mfile', 1 ... - ); - -type = {'model','contrasts','defaults_edit','headers',... - 'means','realign','normalize','smooth'}; - -mfile = {SPM_BCH_VARS.m_file}; diff --git a/lib/marsbar-0.44/examples/batch/er_contrast_spm99.m b/lib/marsbar-0.44/examples/batch/er_contrast_spm99.m deleted file mode 100644 index 3c44bc6..0000000 --- a/lib/marsbar-0.44/examples/batch/er_contrast_spm99.m +++ /dev/null @@ -1,12 +0,0 @@ -%------------------------------------------------------------------ -% SPM99 batch mfile to configure contrasts -%------------------------------------------------------------------ -% -% $Id: er_contrast_spm99.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $ - -global SPM_BCH_VARS - -con = SPM_BCH_VARS.contrasts; -contrasts(1).names = con.names; -contrasts(1).types = con.types; -contrasts(1).values = con.values; diff --git a/lib/marsbar-0.44/examples/batch/er_model_spm2.m b/lib/marsbar-0.44/examples/batch/er_model_spm2.m deleted file mode 100644 index 3a20156..0000000 --- a/lib/marsbar-0.44/examples/batch/er_model_spm2.m +++ /dev/null @@ -1,119 +0,0 @@ -function SPM = er_model_spm2(sess_dir, sesses, ana_dir) -% SPM2 batch script wrapper for ER data -% FORMAT SPM = er_model_spm2(sess_dir, sesses) -% -% sess_dir - directory containing session directories -% sesses - string or cell array of session directory names -% ana_dir - analysis directory -% -% Returns -% SPM - SPM model structure after configuration -% -% The script is specific to this design... -% -% $Id: er_model_spm2.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $ - -if nargin < 1 - error('Need directory containing session subdirectories'); -end -if nargin < 2 - error('Need directory names for sessions'); -end -if nargin < 3 - ana_dir = pwd; -end - -if ischar(sesses), sesses = cellstr(sesses); end -nsessions = length(sesses); - -pwd_store = pwd; -cd(ana_dir); - -% load SPM defaults -if ~exist('defaults', 'var') - global defaults; - spm_defaults; -end - -% Specify some design stuff -SPM.xY.RT = 2.02726; % seconds - -% Specify design -%=========================================================================== -% global normalization: OPTOINS:'Scaling'|'None' -%--------------------------------------------------------------------------- -SPM.xGX.iGXcalc = 'None'; - -% low frequency confound: high-pass cutoff (secs) [Inf = no filtering] -%--------------------------------------------------------------------------- -SPM.xX.K(1).HParam = 60; - -% intrinsic autocorrelations: OPTIONS: 'none'|'AR(1) + w' -%----------------------------------------------------------------------- -SPM.xVi.form = 'AR(1) + w'; - -% basis functions and timing parameters -%--------------------------------------------------------------------------- -% OPTIONS:'hrf' -% 'hrf (with time derivative)' -% 'hrf (with time and dispersion derivatives)' -% 'Fourier set' -% 'Fourier set (Hanning)' -% 'Gamma functions' -% 'Finite Impulse Response' -%--------------------------------------------------------------------------- -SPM.xBF.name = 'hrf (with time derivative)'; -SPM.xBF.length = 24; % length in seconds -SPM.xBF.order = 1; % order of basis set -SPM.xBF.T = 16; % number of time bins per scan -SPM.xBF.T0 = 1; % first time bin (see slice timing) -SPM.xBF.UNITS = 'scans'; % OPTIONS: 'scans'|'secs' for onsets -SPM.xBF.Volterra = 1; % OPTIONS: 1|2 = order of convolution - -condnames = {'vis_stim'}; -nconds = length(condnames); - -% specify filter for filenames -Filter = 's*.img'; - -PP = ''; stimons = []; -for ss = 1:nsessions - % directory containing scans - fildir = fullfile(sess_dir, sesses{ss}); - - % Condition stuff - onset times for visual stimulus - condir = fullfile(fildir, 'onsets'); - condfile = spm_get('Files', condir, 'flash*.txt'); - condons = spm_load(condfile); - tmp = condons(:,2); % get stimulus column - tmp(tmp < 0) = 0; % correct negative onsets - stimons{1} = tmp; - - for cno = 1:nconds - SPM.Sess(ss).U(cno).name =condnames(cno); - SPM.Sess(ss).U(cno).P(1).name = 'none'; % Parametric modulation - SPM.Sess(ss).U(cno).ons = stimons{cno}; - SPM.Sess(ss).U(cno).dur = 0; - end - - % file selection - P = spm_get('files',fildir,Filter); - SPM.nscan(ss) = size(P,1); - - % covariates - SPM.Sess(ss).C.C = []; % [n x c double] covariates - SPM.Sess(ss).C.name = {}; % [1 x c cell] names - - % set files - PP = strvcat(PP, P); - -end - -% set files -SPM.xY.P = PP; - -% Configure design matrix -SPM = spm_fmri_spm_ui(SPM); - -% Return to original directory -cd(pwd_store); diff --git a/lib/marsbar-0.44/examples/batch/er_model_spm99.m b/lib/marsbar-0.44/examples/batch/er_model_spm99.m deleted file mode 100644 index 2633c57..0000000 --- a/lib/marsbar-0.44/examples/batch/er_model_spm99.m +++ /dev/null @@ -1,81 +0,0 @@ -%------------------------------------------------------------------ -% SPM99 batch mfile to configure analysis for 3 sessions of ER data -%------------------------------------------------------------------ -% -% $Id: er_model_spm99.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $ - -global SPM_BCH_VARS - -sess_dir = SPM_BCH_VARS.sess_dir; -sesses = SPM_BCH_VARS.sesses; -nsessions = length(sesses); - -TR = 2.02726; -condnames = {'vis_stim'}; -nconds = length(condnames); - -clear scannames scannos; -for ss = 1:nsessions - fildir = fullfile(sess_dir, sesses{ss}); - % get scan names for the analysis - files = spm_get('Files', fildir, 's*.img'); - scannos(ss) = size(files,1); - scannames(ss) = {files}; - - % Condition stuff - onset times for visual stimulus - condir = fullfile(fildir, 'onsets'); - condfile = spm_get('Files', condir, 'flash*.txt'); - condons = spm_load(condfile); - stimons = condons(:,2); % get stimulus column - stimons(stimons < 0) = 0; % correct negative onsets - - conditions(ss) = struct( ... - 'names', {condnames},... - 'onsets',{{stimons}},... - 'types', {repmat({'events'},1,nconds)}, ... - 'bf_ev', [ones(1,nconds)], ... - 'bf_ep', [0], ... - 'volterra', 0, ... - 'variable_dur', 0 ... - ); - -end - -%--------------------------------------------------------------- -% batch variables defined here for analysis 'model' -%--------------------------------------------------------------- -o = ones(1, nsessions); -model(1) = struct( ... - 'types', 4, ... - 'global_effects', {'None'}, ... - 'burst_mode', 0, ... - 'HF_fil', 'specify', ... - 'HF_cut', o * 60, ... - 'LF_fil', 'hrf', ... - 'LF_cut', 4, ... - 'int_corr', 'none', ... - 'now_later', 0 , ... % flag is 0 -> configure only - 'stop_writing', 0, ... - 'trial_fcon', 0, ... - 'RT', TR, ... - 'replicated', 0, ... - 'nsess', nsessions, ... - 'nscans', scannos, ... - 'files', {scannames}, ... - 'conditions_nb', [ones(1,nsessions) * nconds], ... - 'conditions', [1:nsessions], ... - 'regressors_nb', o * 0, ... - 'regressors', [], ... - 'parametrics_type', {repmat({'none'},1,nsessions)}, ... - 'parametrics', [], ... - 'stochastics_flag', [0], ... - 'stochastics', [] ... -); - -%------------------------------------------- - -bf_ev(1) = struct( ... - 'ev_type', 2, ... % 2 <-> 'hrf + temporal derivative', - 'win_len',[], ... - 'order', [] ... -); diff --git a/lib/marsbar-0.44/examples/batch/er_smooth.m b/lib/marsbar-0.44/examples/batch/er_smooth.m deleted file mode 100644 index 179abfc..0000000 --- a/lib/marsbar-0.44/examples/batch/er_smooth.m +++ /dev/null @@ -1,32 +0,0 @@ -function er_smooth(subjroot, sesses, filt, fwhm) -% smooth images prior to analysis -% -% Inputs -% subjroot - root directory containing session directories -% sesses - cell array containing session subdirectories -% filt - shell exp filter for selecting files -% fwhm - FWHM in mm for smoothing -% -% $Id: er_smooth.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $ - -nsesses = length(sesses); - -imgs = ''; -for s = 1:nsesses - dirn = fullfile(subjroot,sesses{s}); - % get files in this directory - imgs = strvcat(imgs, spm_get('files', dirn, filt)); -end - -% and this is just spm_smooth_ui pasted/edited -P = imgs; -n = size(P,1); - -% implement the convolution -%--------------------------------------------------------------------------- -for i = 1:n - Q = deblank(P(i,:)); - [pth,nm,xt] = fileparts(deblank(Q)); - U = fullfile(pth,['s' nm xt]); - spm_smooth(Q,U,fwhm); -end diff --git a/lib/marsbar-0.44/examples/batch/estimate_er_model.m b/lib/marsbar-0.44/examples/batch/estimate_er_model.m deleted file mode 100644 index 3c630c0..0000000 --- a/lib/marsbar-0.44/examples/batch/estimate_er_model.m +++ /dev/null @@ -1,86 +0,0 @@ -function SPM = estimate_er_model(model_file, ev_con) -% SPM estimate of ER model, and add contrast to ER model -% -% model_file - path to directory containing model -% -% Single or multisesson analyses. -% -% $Id: estimate_er_model.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $ - -if nargin < 1 - error('Need model filename'); -end -if nargin < 2 - error('Need event contrast'); -end - -% Check for model -if ~exist(model_file, 'file') - error(['Cannot find ' model_file]); -end -SPM = load(model_file); -if isfield(SPM, 'SPM'), SPM=SPM.SPM; end - -% Work out contrast, taking into account no of sessions -nblocks = length(SPM.xX.iB); % number of sessions in this model -con = [repmat(ev_con, 1, nblocks) zeros(1, nblocks)]'; - -% new path, store path, move to model path -swd = fileparts(model_file); -pwd_orig = pwd; - -switch spm('ver') - case 'SPM99' - % Estimate parameters - cd(swd); - Sess=SPM.Sess; xsDes=SPM.xsDes; % because spm_spm uses inputname - spm_spm(SPM.VY,SPM.xX,SPM.xM,SPM.F_iX0,Sess,xsDes); - - % add contrasts, estimate all contrasts - cd(pwd_orig); - global SPM_BCH_VARS - con_struct = struct('names', {{'stim_hrf'}},... - 'types', {{'T'}}, ... - 'values', {{con'}}); - - % Batch directory should be current directory, but maybe not - m_file = 'er_contrast_spm99'; - ms = which(m_file); - if isempty(ms) - error(sprintf(['Hmm - can''t find %s on the path - maybe ' ... - 'you should run from the batch directory'], ... - m_file)) - end - - SPM_BCH_VARS = struct(... - 'work_dir', swd, ... - 'ana_type', 2, ... % contrasts - 'm_file', ms, ... - 'contrasts', con_struct); - spm_bch('do_bch_wrapper'); - - otherwise - % load SPM defaults - if ~exist('defaults', 'var') - global defaults; - spm_defaults; - end - - % Estimate parameters - cd(swd); - spm_unlink(fullfile('.', 'mask.img')); % avoid overwrite dialog - SPM = spm_spm(SPM); - - % add contrast, estimate all contrasts - new_con = spm_FcUtil('Set','stim_hrf',... - 'T','c',con,SPM.xX.xKXs); - if isempty(SPM.xCon) - SPM.xCon = new_con; - else - SPM.xCon(end + 1) = new_con; - end - SPM = spm_contrasts(SPM); - - % Back to where we started - cd(pwd_orig); -end diff --git a/lib/marsbar-0.44/examples/batch/get_subjroot.m b/lib/marsbar-0.44/examples/batch/get_subjroot.m deleted file mode 100644 index e6c603d..0000000 --- a/lib/marsbar-0.44/examples/batch/get_subjroot.m +++ /dev/null @@ -1,14 +0,0 @@ -function subjroot = get_subjroot() -% FORMAT subjroot = get_subjroot() -% -% Gets the root path for the example data. -% Looks first for an environment variable, if not defined, uses GUI -subjroot = getenv('MARSBAR_EG_DATAPATH'); -% Otherwise fetch via the GUI -if isempty(subjroot) - subjroot = spm_get(-1, '', 'Root directory of example data'); -end -if ~exist(fullfile(subjroot, 'sess1'), 'dir') - error(sprintf('Expecting "sess1" directory in %s', subjroot)) -end -return diff --git a/lib/marsbar-0.44/examples/batch/run_preprocess.m b/lib/marsbar-0.44/examples/batch/run_preprocess.m deleted file mode 100644 index c24c0f5..0000000 --- a/lib/marsbar-0.44/examples/batch/run_preprocess.m +++ /dev/null @@ -1,28 +0,0 @@ -% Run smoothing and SPM analysis for MarsBaR ER sample data -% -% $Id: run_preprocess.m,v 1.2 2004/08/15 01:19:43 matthewbrett Exp $ - -% Start marsbar to make sure spm_get works -marsbar('on') - -% You might want to define the path to the example data here, as in -% subjroot = '/my/path/somewhere'; -subjroot = get_subjroot(); - -sesses = {'sess1','sess2','sess3'}; - -spm_v = spm('ver'); -sdirname = [spm_v '_ana']; -if ~strcmp(spm_v, 'SPM99'), spm_defaults; end - -% Make sure SPM modality-specific defaults are set -spm('defaults', 'fmri'); - -% do smoothing -er_smooth(subjroot, sesses, 'nu*.img', 8); - -% Run statistics, contrasts -for ss = 1:length(sesses) - model_file = configure_er_model(subjroot, sesses{ss}, sdirname); - estimate_er_model(model_file, [1 0]); -end diff --git a/lib/marsbar-0.44/examples/batch/run_s3_model.m b/lib/marsbar-0.44/examples/batch/run_s3_model.m deleted file mode 100644 index ae2ccab..0000000 --- a/lib/marsbar-0.44/examples/batch/run_s3_model.m +++ /dev/null @@ -1,18 +0,0 @@ -% Run SPM 2-session model for MarsBaR ER sample data -% -% You might want to define the path to the example data here, as in -% subjroot = '/my/path/somewhere'; -subjroot = get_subjroot(); - -sesses = {'sess1','sess2','sess3'}; - -spm_v = spm('ver'); -sdirname = [spm_v '_ana']; -if ~strcmp(spm_v, 'SPM99'), spm_defaults; end - -% Make sure SPM modality-specific defaults are set -spm('defaults', 'fmri'); - -% Run statistics, contrasts -model_file = configure_er_model(subjroot, sesses, sdirname); -estimate_er_model(model_file, [1 0]); diff --git a/lib/marsbar-0.44/examples/batch/run_tutorial.m b/lib/marsbar-0.44/examples/batch/run_tutorial.m deleted file mode 100644 index 817dedf..0000000 --- a/lib/marsbar-0.44/examples/batch/run_tutorial.m +++ /dev/null @@ -1,173 +0,0 @@ -% MarsBaR batch script to show off MarsBaR batching -% This script replicates most of the work in the MarsBaR tutorial. -% See http://marsbar.sourceforge.net -% -% The script assumes that the current directory is the 'batch' directory -% of the example data set files. -% -% $Id: run_tutorial.m,v 1.3 2004/08/15 01:19:43 matthewbrett Exp $ - -% Start marsbar to make sure spm_get works -marsbar('on') - -% You might want to define the path to the example data here, as in -% subjroot = '/my/path/somewhere'; -subjroot = get_subjroot(); - -% Directory to store (and load) ROIs -roi_dir = fullfile(subjroot, 'rois'); - -% MarsBaR version check -v = str2num(marsbar('ver')); -if v < 0.35 - error('Batch script only works for MarsBaR >= 0.35'); -end - -% SPM version check. We need this to guess which model directory to use and -% to get the SPM configured design name. -spm_ver = spm('ver'); -sdirname = [spm_ver '_ana']; -if strcmp(spm_ver, 'SPM99') - conf_design_name = 'SPMcfg.mat'; -else - spm_defaults; - conf_design_name = 'SPM.mat'; -end - -% Set up the SPM defaults, just in case -spm('defaults', 'fmri'); - -% Subdirectory for reconfigured design -mars_sdir = 'Mars_ana'; - -% Get SPM model for session 2 -sess2_model_dir = fullfile(subjroot, 'sess2', sdirname); -sess2_model = mardo(fullfile(sess2_model_dir, 'SPM.mat')); -if ~is_spm_estimated(sess2_model) - error(['Session 2 model has not been estimated. ' ... - 'You may need to run the run_preprocess script']); -end - -% Get activation cluster by loading T image -con_name = 'stim_hrf'; -t_con = get_contrast_by_name(sess2_model, con_name); -if isempty(t_con) - error(['Cannot find the contrast ' con_name ... - ' in the design; has it been estimated?']); -end -% SPM2 stores contrasts as vols, SPM99 as filenames -if isstruct(t_con.Vspm) - t_con_fname = t_con.Vspm.fname; -else - t_con_fname = t_con.Vspm; -end -% SPM5 designs can have full paths in their Vspm.fnames -t_pth = fileparts(t_con_fname); -if isempty(t_pth) - t_con_fname = fullfile(sess2_model_dir, t_con_fname); -end -if ~exist(t_con_fname) - error(['Cannot find t image ' t_con_fname ... - '; has it been estimated?']); -end - -% Get t threshold of uncorrected p < 0.05 -p_thresh = 0.05; -erdf = error_df(sess2_model); -t_thresh = spm_invTcdf(1-p_thresh, erdf); - -% get all voxels from t image above threshold -V = spm_vol(t_con_fname); -img = spm_read_vols(V); -tmp = find(img(:) > t_thresh); -img = img(tmp); -XYZ = mars_utils('e2xyz', tmp, V.dim(1:3)); - -% make into clusters, find max cluster -cluster_nos = spm_clusters(XYZ); -[mx max_index] = max(img); -max_cluster = cluster_nos(max_index); -cluster_XYZ = XYZ(:, cluster_nos == max_cluster); - -% Make ROI from max cluster -act_roi = maroi_pointlist(struct('XYZ', cluster_XYZ, ... - 'mat', V.mat), 'vox'); - -% Make box ROI to do trimming -box_limits = [-20 20; -66 -106; -20 7]'; -box_centre = mean(box_limits); -box_widths = abs(diff(box_limits)); -box_roi = maroi_box(struct('centre', box_centre, ... - 'widths', box_widths)); - -% Combine for trimmed ROI -trim_stim = box_roi & act_roi; - -% Give it a name -trim_stim = label(trim_stim, 'batch_trim_stim'); - -% save ROI to MarsBaR ROI file, in current directory, just to show how -saveroi(trim_stim, fullfile(roi_dir, 'batch_trim_stim_roi.mat')); - -% Save as image -save_as_image(trim_stim, fullfile(subjroot, 'batch_trim_stim.img')); - -% We will do estimation for the trimmed functional ROI, and for two -% anatomical ROIs -bg_L_name = fullfile(roi_dir, 'MNI_Putamen_L_roi.mat'); -bg_R_name = fullfile(roi_dir, 'MNI_Putamen_R_roi.mat'); -roi_array{1} = trim_stim; -roi_array{2} = maroi(bg_L_name); -roi_array{3} = maroi(bg_R_name); - -% MarsBaR estimation for sessions 1 and 3 follows -pwd_orig = pwd; -sesses = {'sess1', 'sess3'}; - -% event specification for getting fitted event time-courses -% A bit silly here, as we only have one session per model and one event type -event_session_no = 1; -event_type_no = 1; -event_spec = [event_session_no; event_type_no]; -event_duration = 0; % default SPM event duration - -clear model_file -for roi_no = 1:length(roi_array) - roi = roi_array{roi_no}; - for ss = 1:length(sesses) - % Run SPM model configuration, just to show we don't need to do SPM - % estimation before using MarsBaR - % We only need to do this for the first ROI, because we reuse the - % design for each ROI - if roi_no == 1 - model_file{ss} = configure_er_model(subjroot, sesses{ss}, mars_sdir); - end - D = mardo(model_file{ss}); - % Extract data - Y = get_marsy(roi, D, 'mean'); - % MarsBaR estimation - E = estimate(D, Y); - % Add contrast, return model, and contrast index - [E Ic] = add_contrasts(E, 'stim_hrf', 'T', [1 0 0]); - % Get, store statistics - stat_struct(ss) = compute_contrasts(E, Ic); - % And fitted time courses - [this_tc dt] = event_fitted(E, event_spec, event_duration); - % Make fitted time course into ~% signal change - tc(:, ss) = this_tc / block_means(E) * 100; - end - % Show calculated t statistics and contrast values - % NB this next line only works when we have only one stat/contrast - % value per analysis - vals = [ [1 3]; [stat_struct(:).con]; [stat_struct(:).stat]; ]; - fprintf('Statistics for %s\n', label(roi)); - fprintf('Session %d; contrast value %5.4f; t stat %5.4f\n', vals); - % Show fitted event time courses - figure - secs = [0:length(tc) - 1] * dt; - plot(secs, tc) - title(['Time courses for ' label(roi)], 'Interpreter', 'none'); - xlabel('Seconds') - ylabel('% signal change'); - legend(sesses) -end diff --git a/lib/marsbar-0.44/install.txt b/lib/marsbar-0.44/install.txt deleted file mode 100644 index dac16a4..0000000 --- a/lib/marsbar-0.44/install.txt +++ /dev/null @@ -1,21 +0,0 @@ -MarsBaR installation ---------------------- - -MarsBaR is a region of interest toolbox for use within SPM -(http://wwww.fil.ion.ucl.ac.uk/spm). - -When you unpack the MarsBaR archive, you should have a new directory -named after the MarsBaR release number for example "marsbar-0.21" - -You have two options for using MarsBaR within SPM. - -First, you can add the new MarsBaR directory to your matlab path. To -use MarsBaR, start it from the matlab prompt with the command -"marsbar". - -Second, you could copy / move or link the MarsBaR directory to the -"marsbar" directory in the SPM "toolbox" directory. If you do this, -the next time you start spm you can start the toolbox by selecting -'marsbar' from the toolbox button on the SPM interface. - -Matthew Brett, 19 April 2003 diff --git a/lib/marsbar-0.44/mars_arm.m b/lib/marsbar-0.44/mars_arm.m deleted file mode 100644 index de33d89..0000000 --- a/lib/marsbar-0.44/mars_arm.m +++ /dev/null @@ -1,63 +0,0 @@ -function varargout = mars_arm(action, varargin) -% wrapper function for MarsBaR marmoire object -% FORMAT varargout = mars_arm(action, varargin) -% -% This only to make the marsbar.m code prettier -% See the help for the marmoire object for details -% -% $Id$ - -global MARS -if ~isfield(MARS, 'ARMOIRE') - error('Global structure does not contain marmoire object'); -end - -if nargin < 1 - error('Need action'); -end - -o = MARS.ARMOIRE; - -switch lower(action) - case 'get' - [varargout{1} o varargout{2}] = get_item_data(o, varargin{:}); - case 'set' - [o varargout{1}] = set_item_data(o, varargin{:}); - case 'clear' - [o varargout{1}] = clear_item_data(o, varargin{:}); - case 'set_ui' - [o varargout{1}] = set_item_data_ui(o, varargin{:}); - case 'update' - [o varargout{1}] = update_item_data(o, varargin{:}); - case 'set_param' - o = set_item_param(o, varargin{:}); - case 'get_param' - varargout{1} = get_item_param(o, varargin{:}); - case 'save' - [varargout{1} o] = save_item_data(o, varargin{:}); - case 'save_ui' - [varargout{1} o] = save_item_data_ui(o, varargin{:}); - case 'isempty' - varargout{1} = isempty_item_data(o, varargin{:}); - case 'item_exists' - varargout{1} = item_exists(o, varargin{:}); - case 'show_summary' - if nargin < 2, error('Need item name'); end - item_name = varargin{1}; - if ~item_exists(o, item_name) - error(['What is ' item_name '?']); - end - if mars_arm('isempty', item_name) - S = {'[Empty]'}; - else - S = summary(get_item_data(o, item_name)); - fn = get_item_param(o, item_name, 'file_name'); - if isempty(fn), fn = '[Not set]'; end - S = [{['Filename: ' fn]} S]; - end - mars_utils('graphic_text', S, get_item_param(o, item_name, 'title')); - otherwise - error(['Weird: ' action]); -end - -MARS.ARMOIRE = o; diff --git a/lib/marsbar-0.44/mars_arm_call.m b/lib/marsbar-0.44/mars_arm_call.m deleted file mode 100644 index c84fc50..0000000 --- a/lib/marsbar-0.44/mars_arm_call.m +++ /dev/null @@ -1,169 +0,0 @@ -function [o,errf,msg] = mars_arm_call(action, o, item, old_o) -% services callbacks from marmoire object set functions -% FORMAT [o,errf,msg] = mars_arm_call(action, o, item) -% See documentation for marmoire object for more detail -% -% action - action string -% o - candidate object for checking etc -% item - name of item that has just been set -% old_o - object before set -% -% Returns -% o - possibly modified object -% errf - flag, set if error in processing -% msg - message to examplain error -% -% $Id$ - -if nargin < 1 - error('Need action'); -end -if nargin < 2 - error('Need object'); -end -if nargin < 3 - error('Need item name'); -end -if nargin < 4 - error('Need old object'); -end - -errf = 0; msg = ''; - -item_struct = get_item_struct(o, item); - -switch lower(action) - case 'set_design' - % callback for setting design - - % Check for save of current design - [btn o] = save_item_data_ui(old_o, 'def_design', ... - struct('ync', 1, ... - 'prompt_prefix','previous ')); - if btn == -1 - errf = 1; - msg = 'Cancelled save of previous design'; - return - end - - % Make design into object, do conversions - [item_struct.data errf msg] = sf_check_design(item_struct.data); - if errf, o = []; return, end - o = set_item_struct(o, item, item_struct); - - % Unload roi data if design has been set, and data exists - % and data is not the same size as design - if ~isempty_item_data(o, 'roi_data') - [Y o] = get_item_data(o, 'roi_data'); - if n_time_points(Y) ~= n_time_points(item_struct.data) - fprintf('Design and data have different numbers of rows\n'); - [btn o] = save_item_data_ui(o, 'roi_data', struct('ync', 1)); - if btn == -1, errf = 1; msg = 'ROI save cancelled'; return, end - o = clear_item_data(o, 'roi_data'); - fprintf('Reset of design, cleared ROI data...\n'); - end - end - - case 'set_data' - % callback for setting data - - % Check for save of current data - [btn o] = save_item_data_ui(old_o, 'roi_data', ... - struct('ync', 1, ... - 'prompt_prefix','previous ')); - if btn == -1 - errf = 1; o = []; - msg = 'Cancelled save of current data'; - return - end - - % Make data into object, do conversions - [item_struct.data errf msg] = sf_check_data(item_struct.data); - if errf, o = []; return, end - o = set_item_struct(o, item, item_struct); - - % Check data matches default design; clear if not - if ~isempty_item_data(o, 'def_design') - [D o] = get_item_data(o, 'def_design'); - if n_time_points(D) ~= n_time_points(item_struct.data) - fprintf('Design and data have different numbers of rows\n'); - [btn o] = save_item_data_ui(o, 'def_design', struct('ync', 1)); - if btn == -1, errf = 1; msg = 'Design save cancelled'; return, end - o = clear_item_data(o, 'def_design'); - fprintf('Reset of ROI data, cleared default design...\n'); - end - end - - % Clear default region if data has changed - global MARS; - if mars_struct('isthere', MARS, 'WORKSPACE', 'default_region') - MARS.WORKSPACE.default_region = []; - fprintf('Reset of data, cleared default region...\n'); - end - - case 'set_results' - % callback for setting results - - % Need to set default data from results, and load contrast file - % if not present (this is so for old MarsBaR results) - - data = item_struct.data; - if isempty(data), return, end - - % Check for save of current design - [btn o] = save_item_data_ui(old_o, 'est_design', ... - struct('ync', 1, ... - 'prompt_prefix','previous ')); - if btn == -1 - errf = 1; - msg = 'Cancelled save of current design'; - return - end - - % Make design into object, do conversions - [data errf msg] = sf_check_design(data); - if errf, return, end - if ~is_mars_estimated(data) - error('Design has not been estimated') - end - - % Deal with case of old MarsBaR designs - if ~has_contrasts(data); - fname = spm_get(1, '*x?on.mat', 'Select contrast file'); - [pth, fn, ext] = fileparts(fname); - tmp = load(fname); - % Default refreshing - refreshf = mars_get_option('statistics', 'refresh_contrasts'); - % If the filename does not correspond to marsbar estimation, refresh the - % contrasts for safety (the user could have selected an SPM xCon fle). - refreshf = refreshf | ~strcmp(fn, 'mars_xCon.mat') - data = set_contrasts(data, tmp, refreshf); - end - - % Put data into object - item_struct.data = data; - o = set_item_struct(o, item, item_struct); - - otherwise - error(['Peverse request for ' action]); -end - -function [d,errf,msg] = sf_check_design(d) -% Make design into object, do conversions -errf = 0; msg = {}; -d = mardo(d); -if ~is_valid(d) - errf = 1; - msg = 'This does not appear to be a valid design'; -end -return - -function [d,errf,msg] = sf_check_data(d) -% Make data structure into object, do conversions -errf = 0; msg = {}; -d = marsy(d); -if ~is_valid(d) - errf = 1; - msg = 'This does not appear to be a valid data structure'; -end -return diff --git a/lib/marsbar-0.44/mars_armoire.m b/lib/marsbar-0.44/mars_armoire.m deleted file mode 100644 index 6b46af4..0000000 --- a/lib/marsbar-0.44/mars_armoire.m +++ /dev/null @@ -1,464 +0,0 @@ -function varargout = mars_armoire(action, item, data, filename) -% multifunction function to get/set various stores of stuff -% (armoire is the French for cupboard). -% FORMAT varargout = mars_armoire(action, item, data, filename) -% -% This cupboard is to put items which I will want to fish out -% from time to time. -% -% The items may well be associated with a filename -% If they are associated with a filename when set, they -% are assumed to have been saved already. -% If not, they are flagged as awaiting a save -% -% If the data changes, you can indicate this with the -% update method, which changes the data, and flags for a save -% -% In terms of the program structure, the function acts an object container, -% but where the objects are only half implemented, in this case as fields in -% a global variable MARMOIRE. -% -% The permissable actions are: -% -% add - add an item to the armoire -% exist - ask if there an exists an item of given name -% add_if_absent - adds item if it does not yet exist -% set - sets data for item -% get - gets data from item -% set_ui - sets data, getting via UI -% save - save data for item, if required -% save_ui - saves, using GUI to ask for filename -% For save and save_ui, the 'data' argument -% can contain a structure with flags. -% Fields in flag structure can be -% 'force' - force save even if not flagged as needed -% 'warn_empty' - GUI warn if no data to save -% 'ync' - start save with save y/n/cancel dialog -% 'prompt' - prompt for save; -% 'prompt_suffix - suffix for prompt -% 'prompt_prefix - prefix for prompt -% 'ui' - use UI prompts for save - forced if save_ui -% 'no_no_save' - if 'no' is chosen in the save dialog, -% contents are flagged as not needing a save in -% the future (has_changed flag set to 0) -% save 'all' - saves data for all items, if required -% update - updates data, sets flag to show change -% clear - clears data for item -% isempty - returns 1 if no data for item -% need_save - returns 1 if this item needs a save -% -% And for use in debugging: -% dump - returns contents of the underling variable -% -% for any other action string, mars_armoire will look to see if the action -% matches any of the field names in the structures and get/set this -% fieldname value (set if data is not empty, get otherwise) -% -% Each item is stored in a field in the global variable -% -% The name of the field is the 'item' argument to this function -% Each item field requires the following fields -% -% data - the data -% (or a filename which loads as the data - see the -% char_is_filename field) -% has_changed - flag, if set, means data has changed since first set -% save_if_changed - flag, if set, will try to save changed data when a -% save is requested. Saves can also be forced. -% leave_as_file - flag, if set, will attempt to leave the data, defined -% by the filename, on the disk, not in memory, and only -% load the data for a 'get'. -% Otherwise, if a set occurs, and the data field is -% empty, will load data into the global variable when -% 'set'ing field and leave it there. -% If the data changes, and requires a save, this field -% has no function, until the next save. -% file_name - file name of .mat file containing data -% If data is empty, and file_name is not, -% an attempt to 'get' data will load contents of -% file_name -% default_file_name - default filename offered for save -% file_type - type of file to load ('mat' or 'ascii') -% char_is_filename - flag, if set, char data is assumed to be a filename -% filter_spec - filter spec for uigetfile (see help uigetfile) -% prompt - prompt for uigetfile -% verbose - flag, if set, displays more information during -% processing -% set_action - actions to perform when item is set -% in form of callback string. This is executed -% in the 'i_set' subfunction, and can use all -% variables functions defined therein. See programmers -% notes in the function for callback format -% set_action_if_update - flag, if set, applied set_action for 'update' as -% well as 'set' -% set_action_if_clear - flag, if set, applied set_action for 'clear' as -% well as 'set' -% -% $Id$ - -% Programmers' notes -% ------------------ -% set_action callbacks -% callbacks should be one of the following two formats; -% -% [data errf msg] = my_function(args) or -% [item_field errf msg] = my_function(args) -% -% The first form just returns the data desired to be set, -% the second returns the whole item field, where the data -% is contained in the field 'data'. -% if 'errf' is set, the routine warns, and abort the set with -% the 'msg'. -% -% The available args are: -% I - proposed whole item field contents -% data - proposed data to be inserted -% passed_filename - filename passed to function -% -% and anything else... - -% NaN for an argument signals it has not been passed -% empty means that it was passed, but was empty -if nargin < 1 % no action - error('Need action!'); - return -end -if ~ismember(action, {'dump'}) - if nargin < 2 % no item - error('Need item!'); - return - end -end -if nargin < 3 - data = NaN; -end -if nargin < 4 - filename = NaN; -end - -% certain actions do not require valid item names -if ~ismember(action, ... - {'add', 'add_if_absent', 'exist', 'dump', 'save_all'}) - % the rest do - flist = i_item_list; - switch item - case 'all' - % If item is 'all', do this action for all items - % Watch for save_ui, as we need to look out for cancel - s_u_f = strcmp(lower(action), 'save_ui'); - a = {}; - for fn = flist' - a{end+1} = mars_armoire(action, fn{1}, data, filename); - if s_u_f & (a{end} == -1), varargout = {-1}; return, end - end - varargout = a; - return - otherwise - % item must be a field name in structure - % fetch and set name field - if ~ismember(item, flist) - error([item ' is an unaccountable item']); - end - i_contents = i_up_dump(item); - i_contents.name = item; - i_contents.last_action = action; - end -end - -% run actions -switch lower(action) - case 'add' - data.name = item; - I = i_def; - def_fns = fieldnames(I); - new_fns = def_fns(~ismember(def_fns, fieldnames(data))); - for fn = new_fns' - data = setfield(data, fn{1}, getfield(I, fn{1})); - end - i_down_dump(data); - case 'add_if_absent' - if ~mars_armoire('exist', item) - mars_armoire('add', item, data); - end - case 'exist' - varargout = {ismember(item, i_item_list)}; - case 'default_item' - varargout = {i_def}; - case 'set' - if is_nan(data) & is_nan(filename) - varargout = {i_set_ui(i_contents)}; - else - varargout = {i_set(i_contents, data, filename)}; - end - case 'get' - if i_isempty(i_contents) - varargout = {i_set_ui(i_contents)}; - else - varargout = {i_get(i_contents)}; - end - case 'set_ui' - varargout = {i_set_ui(i_contents)}; - case 'update' - varargout = {i_set(i_contents, data, filename)}; - i_contents = i_up_dump(item); - i_contents.has_changed = 1; - i_down_dump(i_contents); - case 'clear' - varargout = {i_set(i_contents, [], '')}; - case 'save' - if is_nix(filename) & ... - isempty(i_contents.file_name) - varargout = {i_save_ui(i_contents, data, filename)}; - else - varargout = {i_save(i_contents, data, filename)}; - end - case 'save_ui' - % data is used as flags for save call - if ~isstruct(data), data = []; end - data.ui = 1; - varargout = {i_save_ui(i_contents, data, filename)}; - case 'need_save' - varargout = {i_need_save(i_contents)}; - case 'isempty' - varargout = {i_isempty(i_contents)}; - case 'dump' - varargout = {i_dump}; - otherwise - % look in fieldnames - if ismember(action, fieldnames(i_contents)) - if ~is_nan(data) % it's a set - i_contents = setfield(i_contents, action, data); - i_down_dump(i_contents); - end - varargout = {getfield(i_contents, action)}; - else % really, this must be a mistake - error(['The suggested action, ' action ', is disturbing']); - end -end -return % end of main function - -function I = i_def -% returns default item -I = struct('data', [],... - 'file_name', '',... - 'default_file_name','',... - 'has_changed', 0,... - 'leave_as_file', 0,... - 'save_if_changed', 1,... - 'file_type', 'mat',... - 'char_is_filename',1,... - 'set_action_if_update', 0 ,... - 'set_action_if_clear', 0 ,... - 'verbose', 1,... - 'title', 'file',... - 'filter_spec', '',... - 'set_action', ''); -return - -function res = i_isempty(I) -res = isempty(I.data) & isempty(I.file_name); -return - -function res = i_set_ui(I) -[fn pn] = mars_uifile('get', I.filter_spec, ['Select ' I.title '...']); -if isequal(fn,0) | isequal(pn,0), res = []; return, end -res = i_set(I, [], fullfile(pn, fn)); -return - - -function res = i_set(I, data, filename) - -% Keep copy of passed filename for set_action call -passed_filename = filename; - -% optionally, treat char data as filename -% but passed filename overrides char data -if I.char_is_filename & ischar(data) - if ~is_nix(filename) - warning(sprintf(... - 'Passed filename %s overrides data filename %s\n',... - filename, data)); - else - filename = data; - end - data = []; -end - -if is_nix(filename) % may need to save if no associated filename - I.has_changed = 1; -else % don't need to save, but may need to load from file - I.has_changed = 0; - if isempty(data) - data = load(filename, ['-' I.file_type]); - end -end -I.data = data; - -% If no filename passed: -% if new set, filename is empty -% if an update, filename stays -is_update = strcmp(I.last_action, 'update'); -if is_nan(filename) - if ~is_update - filename = ''; - end -end -I.file_name = filename; - -% If this was a clear, don't flag for save -if i_isempty(I), I.has_changed = 0; end - -% and here is where we do the rules stuff -is_clear = strcmp(I.last_action, 'clear'); -if ~isempty(I.set_action) & ... - (ismember(I.last_action, {'get','set','set_ui'}) | ... - (is_update & I.set_action_if_update) | ... - (is_clear & I.set_action_if_clear)) - [tmp errf msg] = eval(I.set_action); - if errf - res = []; - warning(['Data not set: ' msg]); - return - end - % work out if whole thing as been returned, or only data - if isfield(tmp, 'set_action') % whole thing - I = tmp; - else % it's just the data - I.data = tmp; - end -end - -% return set data -res = I.data; - -% possibly remove data from structure -if ~I.has_changed & I.leave_as_file - I.data = []; -end - -% do the actual save into global structure -i_down_dump(I); - -return - -function res = i_get(I) -res = I.data; -if isempty(res) & ~isempty(I.file_name) - res = load(I.file_name, ['-' I.file_type]); -end -return - -function res = i_save_ui(I, flags, filename) -if ~isstruct(flags), flags = []; end -if i_isempty(I) & isfield(flags, 'warn') - msgbox('Nothing to save', [I.title ' is not set'], 'warn'); - res = 0; - return -end -flags.ui = 1; -res = i_save(I, flags, filename); -return - -function res = i_save(I, flags, filename) -% data field is treated as flags -if is_nix(flags) flags == []; end -if is_nix(filename), filename = I.file_name; end -if is_nix(filename), filename = I.default_file_name; end -if i_need_save(I) | isfield(flags, 'force') % force flag - % prompt for filename if UI - if isfield(flags, 'ui') - % Work out prompt - if isfield(flags, 'prompt') - prompt = flags.prompt; - else - prompt = I.title; - end - if isfield(flags, 'prompt_prefix') - prompt = [flags.prompt_prefix prompt]; - end - if isfield(flags, 'prompt_suffix') - prompt = [prompt flags.prompt_suffix]; - end - if isfield(flags, 'ync') - save_yn = questdlg(['Save ' prompt '?'],... - 'Save', 'Yes', 'No', 'Cancel', 'Yes'); - if strcmp(save_yn, 'Cancel'), res = -1; return, end - if strcmp(save_yn, 'No') - if isfield(flags, 'no_no_save') - I.has_changed = 0; - i_down_dump(I); - end - res = 0; - return - end - end - pr = ['Filename to save ' prompt]; - [f p] = mars_uifile('put', I.filter_spec, pr, filename); - if all(f==0), res = -1, return, end - filename = fullfile(p, f); - end - savestruct(I.data, filename); - if I.verbose - fprintf('%s saved to %s\n', I.title, filename); - end - I.file_name = filename; - I.has_changed = 0; - if I.leave_as_file - % maintain only on file, as it has beed saved - I.data = []; - end - res = 1; - i_down_dump(I); -else - res = 0; -end -return - -function res = i_need_save(I) -res = ~i_isempty(I) & I.has_changed & I.save_if_changed; -return - -function res = is_nix(v) -res = isempty(v) | is_nan(v); -return - -function res = is_nan(v) -res = 0; -if isnumeric(v) & ~isempty(v) - res = isnan(v); -end -return - -function items = i_item_list -items = g_fieldnames; -return - -function I = i_up_dump(i_name) -I = g_getfield(i_name); -return - -% Routines below explicity manipulate global variable - -function I = i_dump -global MARMOIRE -I = MARMOIRE; -return - -function I = i_down_dump(I) -global MARMOIRE -MARMOIRE = setfield(MARMOIRE, I.name, I); -return - -function fns = g_fieldnames -global MARMOIRE -if isempty(MARMOIRE) | ~isstruct(MARMOIRE) - fns = {}; -else - fns = fieldnames(MARMOIRE); -end -return - -function r = g_getfield(fn) -global MARMOIRE -r = getfield(MARMOIRE, fn); -return diff --git a/lib/marsbar-0.44/mars_blob2roi.m b/lib/marsbar-0.44/mars_blob2roi.m deleted file mode 100644 index 5366b41..0000000 --- a/lib/marsbar-0.44/mars_blob2roi.m +++ /dev/null @@ -1,33 +0,0 @@ -function mars_blob2roi(xSPM, pt) -% saves ROI for cluster in xSPM structure, containing point pt -% FORMAT mars_blob2roi(xSPM, pt) -% -% Input -% xSPM - SPM results structure with needed fields -% title -% XYZ - voxel coordinates of activated points -% Z - statistic values for activated points -% M - 4x4 matrix from voxels to mm -% -% $Id$ - -if nargin < 1 - error('Need SPM structure'); -end -if nargin < 2 - error('Need point to identify cluster'); -end - -vx_i = spm_XYZreg('findxyz', pt, xSPM.XYZmm); -if isempty(vx_i) - msgbox('No activated voxel at this location'); - return -end -Clusters = spm_clusters(xSPM.XYZ); -cXYZ = xSPM.XYZmm(:, Clusters==Clusters(vx_i)); -if isempty(cXYZ), return, end -d = sprintf('%s cluster at [%0.1f %0.1f %0.1f]', xSPM.title, pt); -l = sprintf('%s_%0.0f_%0.0f_%0.0f', xSPM.title, pt); -o = maroi_pointlist(struct('XYZ',cXYZ, 'mat', xSPM.M, ... - 'label', l, 'descrip', d)); -marsbar('saveroi', o); diff --git a/lib/marsbar-0.44/mars_blob_menu.m b/lib/marsbar-0.44/mars_blob_menu.m deleted file mode 100644 index 66cda45..0000000 --- a/lib/marsbar-0.44/mars_blob_menu.m +++ /dev/null @@ -1,56 +0,0 @@ -function hC = mars_blob_menu -% puts up ROI menu to add to SPM results interface -% FORMAT hC = mars_blob_menu -% -% Returns -% hC - handle of menu -% -% $Id$ - -% Tag -tg = 'blob_menu'; - -%-Get Interactive window and delete any previous DesRepUI menu -%----------------------------------------------------------------------- -Finter = spm_figure('GetWin','Interactive'); -delete(findobj(get(Finter,'Children'),'flat','Tag',tg)) - -hC = uimenu(Finter,'Label','Write ROI(s)',... - 'Separator','on',... - 'Tag',tg,... - 'UserData','',... - 'HandleVisibility','on'); - -%-Write one blob -%----------------------------------------------------------------------- -hWo = uimenu(hC,'Label','Write one cluster','Accelerator','O',... - 'CallBack','mars_blob_ui(''save_one'')',... - 'UserData',hC,... - 'HandleVisibility','off'); - -%-Write all blobs -%----------------------------------------------------------------------- -hWo = uimenu(hC,'Label','Write all clusters','Accelerator','A',... - 'CallBack','mars_blob_ui(''save_many'')',... - 'UserData',hC,... - 'HandleVisibility','off'); - -%-Rerun results ui -%----------------------------------------------------------------------- -hWo = uimenu(hC,'Label','Rerun results UI','Accelerator','R',... - 'CallBack','mars_blob_ui(''reinit'')',... - 'UserData',hC,... - 'HandleVisibility','off'); -%-Clear -%----------------------------------------------------------------------- -uimenu(hC,'Label','Clear','Accelerator','L','Separator','on',... - 'CallBack','spm_results_ui(''Clear'')',... - 'HandleVisibility','off'); - -%-Pop open 'Interactive' window -%----------------------------------------------------------------------- -figure(Finter) - -%-Return handle of menu -%----------------------------------------------------------------------- -varargout = {hC}; diff --git a/lib/marsbar-0.44/mars_blobs2rois.m b/lib/marsbar-0.44/mars_blobs2rois.m deleted file mode 100644 index 6755909..0000000 --- a/lib/marsbar-0.44/mars_blobs2rois.m +++ /dev/null @@ -1,64 +0,0 @@ -function mars_blobs2rois(xSPM, roipath, rootn) -% creates ROIs from spm_results_ui SPM -% FORMAT mars_blobs2rois(xSPM, roipath, rootn) -% -% Inputs -% xSPM - SPM results structure with needed fields -% title -% XYZ - voxel coordinates of activated points -% Z - statistic values for activated points -% M - 4x4 matrix from voxels to mm -% roipath - directory in which to write ROIs -% rootn - root name for ROI(s) - -if nargin < 1 - error('Need SPM structure'); -end -if nargin < 2 - roipath = ''; -end -if nargin < 3 - rootn = ''; -end - -if isempty(roipath) - roipath = spm_get([-1 0], '', 'Directory to save ROI(s)'); -end -if isempty(roipath) - return -end -if isempty(rootn) - rootn = mars_utils('str2fname', xSPM.title); - rootn = spm_input('Root name for clusters', '+1', 's', rootn); -end - -pre_ones = ones(1, size(xSPM.XYZ,2)); -clusters = spm_clusters(xSPM.XYZ); -[N Z maxes A] = spm_max(xSPM.Z,xSPM.XYZ); - -for c = unique(A(:)') - % maximum maximum for this cluster - tmp = Z; tmp(A~=c) = -Inf; - [tmp mi] = max(tmp); - % voxel coordinate of max - vco = maxes(:, mi); - % in mm - maxmm = xSPM.M * [vco; 1]; - maxmm = maxmm(1:3); - % corresponding cluster in spm_clusters, XYZ for cluster - my_c = clusters(all(xSPM.XYZ == vco * pre_ones)); - XYZ = xSPM.XYZ(:, clusters == my_c(1)); - if ~isempty(XYZ) - % file name and labels - d = sprintf('%s cluster at [%0.1f %0.1f %0.1f]', rootn, maxmm); - l = sprintf('%s_%0.0f_%0.0f_%0.0f', rootn, maxmm); - fn = mars_utils('str2fname', l); - fname = maroi('filename', fullfile(roipath, fn)); - o = maroi_pointlist(struct('XYZ',XYZ,'mat',xSPM.M,... - 'descrip',d, 'label', l), ... - 'vox'); - fprintf('\nSaving %s as %s...', d, fname); - saveroi(o, fname); - end -end -fprintf('\nDone...\n'); diff --git a/lib/marsbar-0.44/mars_build_roi.m b/lib/marsbar-0.44/mars_build_roi.m deleted file mode 100644 index acb8417..0000000 --- a/lib/marsbar-0.44/mars_build_roi.m +++ /dev/null @@ -1,107 +0,0 @@ -function o = mars_build_roi -% builds ROIs via the SPM GUI -% -% $Id$ - -o = []; -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Build ROI', 0); - -% get ROI type -optfields = {'image','voxel', 'sphere', 'box_cw', 'box_lims'}; -optlabs = {'Image', 'Voxel', 'Sphere',... - 'Box (centre,widths)', 'Box (ranges XYZ)'}; - -roitype = char(... - spm_input('Type of ROI', '+1', 'm',{optlabs{:} 'Quit'},... - {optfields{:} 'quit'},length(optfields)+1)); - -% For selecting images, later -img_flt = mars_veropts('get_img_ext'); - -d = []; -switch roitype - case 'image' - imgname = spm_get(1, img_flt, 'Image defining ROI'); - [p f e] = fileparts(imgname); - binf = spm_input('Maintain as binary image', '+1','b',... - ['Yes|No'], [1 0],1); - func = ''; - if spm_input('Apply function to image', '+1','b',... - ['Yes|No'], [1 0],1); - spm_input('img < 30',1,'d','Example function:'); - func = spm_input('Function to apply to image', '+1', 's', 'img'); - end - d = f; l = f; - if ~isempty(func) - d = [d ' func: ' func]; - l = [l '_f_' func]; - end - if binf - d = [d ' - binarized']; - l = [l '_bin']; - end - o = maroi_image(struct('vol', spm_vol(imgname), 'binarize',binf,... - 'func', func)); - - % convert to matrix format to avoid delicacies of image format - o = maroi_matrix(o); - - case 'voxel' - not_donef = 1; - while not_donef - XYZ = spm_input('Coordinate(s)', '+1', 'e', []); - if size(XYZ,1) == 1, XYZ = XYZ'; end - if size(XYZ,1) ~= 3, warning('Need 3xN or Nx3 matrix'); - else not_donef = 0; end - end - v = char(spm_input('Coordinate(s) in','+1','b','mm|voxels',{'mm','vox'}, 1)); - spopts = {'spacebase','image'}; - splabs = {'Base space for ROIs','From image'}; - spo = spm_input('Space for voxel ROI', '+1', 'm',splabs,... - spopts, 1); - switch char(spo) - case 'spacebase' - sp = maroi('classdata', 'spacebase'); - case 'image' - img = spm_get([0 1], img_flt, 'Image defining space'); - if isempty(img),return,end - sp = mars_space(img); - end - o = maroi_pointlist(struct('XYZ', XYZ, 'mat', sp.mat), v); - if size(XYZ, 2) > 1 - pos = c_o_m(o); coord_lbl = 'C.o.M.'; - else - pos = XYZ; coord_lbl = 'coordinate'; - end - d = sprintf('points; %s (%s) [%0.1f %0.1f %0.1f]',coord_lbl,v,pos); - l = sprintf('points_%s_%s_%0.0f_%0.0f_%0.0f',coord_lbl,v,pos); - case 'sphere' - c = spm_input('Centre of sphere (mm)', '+1', 'e', [], 3); - r = spm_input('Sphere radius (mm)', '+1', 'r', 10, 1); - d = sprintf('%0.1fmm radius sphere at [%0.1f %0.1f %0.1f]',r,c); - l = sprintf('sphere_%0.0f-%0.0f_%0.0f_%0.0f',r,c); - o = maroi_sphere(struct('centre',c,'radius',r)); - case 'box_cw' - c = spm_input('Centre of box (mm)', '+1', 'e', [], 3); - w = spm_input('Widths in XYZ (mm)', '+1', 'e', [], 3); - d = sprintf('[%0.1f %0.1f %0.1f] box at [%0.1f %0.1f %0.1f]',w,c); - l = sprintf('box_w-%0.0f_%0.0f_%0.0f-%0.0f_%0.0f_%0.0f',w,c); - o = maroi_box(struct('centre',c,'widths',w)); - case 'box_lims' - X = sort(spm_input('Range in X (mm)', '+1', 'e', [], 2)); - Y = sort(spm_input('Range in Y (mm)', '+1', 'e', [], 2)); - Z = sort(spm_input('Range in Z (mm)', '+1', 'e', [], 2)); - A = [X Y Z]; - c = mean(A); - w = diff(A); - d = sprintf('box at %0.1f>X<%0.1f %0.1f>Y<%0.1f %0.1f>Z<%0.1f',A); - l = sprintf('box_x_%0.0f:%0.0f_y_%0.0f:%0.0f_z_%0.0f:%0.0f',A); - o = maroi_box(struct('centre',c,'widths',w)); - case 'quit' - o = []; - return - otherwise - error(['Strange ROI type: ' roitype]); -end -o = descrip(o,d); -o = label(o,l); diff --git a/lib/marsbar-0.44/mars_display_roi.m b/lib/marsbar-0.44/mars_display_roi.m deleted file mode 100644 index 5b69228..0000000 --- a/lib/marsbar-0.44/mars_display_roi.m +++ /dev/null @@ -1,270 +0,0 @@ -function varargout=mars_display_roi(action_str, varargin) -% utility routines for display of ROIs in graphic window -% FORMAT varargout=mars_display_roi(action_str, varargin) -% -% Usual call displays one or more ROIs on structural image: -% FORMAT mars_display_roi('display', roi_obj, structv, cmap) -% -% roi_obj - single ROI object, or cell array of objects, or strings -% structv - structural image or spm_vol struct for image -% [marsbar default structural if not passed] -% cmap - colormap to use for display -% -% V0.2 - use of jet/specified colormap for display of many ROIs -% V0.3 - string input allowed, actionstrs as first arg, service callback -% -% $Id$ - -global st; % global variable from spm_orthviews - -if nargin < 1 - action_str = ''; -end -if isempty(action_str), action_str = 'display'; end - -switch lower(action_str), case 'display' %-Display ROIs -if nargin < 2 - roi_obj = spm_get([0 Inf],'*roi.mat','Select ROI(s) to view'); -else - roi_obj = varargin{1}; -end -if isempty(roi_obj), return, end - -if nargin < 3 - mb = spm('getglobal', 'MARS'); - if ~isempty(mb) - structv = mb.OPTIONS.structural.fname; - else - structv = fullfile(spm('dir'), 'canonical', ... - ['avg152T1' mars_veropts('template_ext')]); - end -else - structv = varargin{2}; -end -if ischar(structv) - structv = spm_vol(structv); -end -if nargin < 4 - cmap = jet; -else - cmap = varargin{3}; -end - -% Process filenames to roi objects -roi_obj = maroi('load_cell', roi_obj); - -olen = prod(size(roi_obj)); -if olen > 1 - col_inds = round((0:(olen-1))*(size(cmap, 1)-1)/(olen-1))+1; -else - col_inds = 1; -end - -% display with spm orthoviews -spm_image('init', structv.fname); - -% space for object for which this is not defined -sp = mars_space(structv); - -mo = []; -roi_ctr = 1; -for i = 1:olen - roi = roi_obj{i}; - - % check ROI contains something - if isempty(roi) - warning(sprintf('ROI %d is missing', i)); - elseif is_empty_roi(roi) - warning(sprintf('ROI %d:%s is empty', i, label(roi))); - else - % Define space for ROI - nsp = native_space(roi); - if isempty(nsp) - nsp = sp; - end - - % convert ROI to matrix - mo = maroi_matrix(roi, nsp); - dat = matrixdata(mo); - if isempty(dat) | ~any(dat(:)) - warning(sprintf('ROI %d: %s - contains no points to show',... - i, label(roi))); - else - dat(dat == 0) = NaN; - % add to image to display - mars_orthviews('AddColouredMatrix', 1, dat, nsp.mat, cmap(col_inds(i),:)); - - % Information for display - XYZ = realpts(roi,nsp); - mx = max(XYZ, [], 2); mn = min(XYZ, [], 2); - lbl = label(roi); - if isempty(lbl), lbl = '[No label]'; end - roi_info(roi_ctr) = struct(... - 'label', lbl,... - 'num', i,... - 'c_o_m', c_o_m(mo, nsp, 'real'),... - 'volume', volume(mo),... - 'maxx', [mn(1) mx(1)],... - 'maxy', [mn(2) mx(2)],... - 'maxz', [mn(3) mx(3)] ... - ); - roi_ctr = roi_ctr + 1; - end - end -end -if roi_ctr == 1 - return -end - -% ROI information panel -%----------------------------------------------------------------------- -WS = spm('WinScale'); -fg = spm_figure('GetWin','Graphics'); -% Frame for ROI info -uicontrol(fg,'Style','Frame','Position',[305 360 280 240].*WS); - -% ROI selection menu -rl = length(roi_info); -labs = [num2str([1:rl]') repmat(': ', rl, 1) strvcat(roi_info(:).label)]; -uicontrol(fg,'Style','popupmenu' ,'Position',[320 570 250 20].*WS,... - 'String', cellstr(labs),... - 'Callback','mars_display_roi(''roi_menu'')', ... - 'ToolTipString','ROIs', 'Userdata', roi_info); - -uicontrol(fg,'Style','Text', 'Position',[310 520 50 020].*WS,... - 'String','Label:','HorizontalAlignment','left'); -uicontrol(fg,'Style','Text', 'Position',[310 490 110 020].*WS,... - 'String','Centre of mass:','HorizontalAlignment','left'); -uicontrol(fg,'Style','Text', 'Position',[310 460 110 020].*WS,... - 'String','Volume (mm):','HorizontalAlignment','left'); -uicontrol(fg,'Style','Text', 'Position',[310 430 110 020].*WS,... - 'String','Max/min X(mm):','HorizontalAlignment','left'); -uicontrol(fg,'Style','Text', 'Position',[310 400 110 020].*WS,... - 'String','Max/min Y(mm):','HorizontalAlignment','left'); -uicontrol(fg,'Style','Text', 'Position',[310 370 110 020].*WS,... - 'String','Max/min Z(mm):','HorizontalAlignment','left'); - -% Text information -st.mars.txt.label = uicontrol(fg,'Style','Text', ... - 'Position',[360 520 220 020].*WS,... - 'String','',... - 'HorizontalAlignment','left',... - 'FontWeight','bold'); -st.mars.txt.c_o_m = uicontrol(fg,'Style','Text', ... - 'Position',[425 490 155 020].*WS,... - 'String','',... - 'HorizontalAlignment','left',... - 'FontWeight','bold'); -st.mars.txt.volume = uicontrol(fg,'Style','Text', ... - 'Position',[425 460 155 020].*WS,... - 'String','',... - 'HorizontalAlignment','left',... - 'FontWeight','bold'); -st.mars.txt.maxx = uicontrol(fg,'Style','Text', ... - 'Position',[425 430 155 020].*WS,... - 'String','',... - 'HorizontalAlignment','left',... - 'FontWeight','bold'); -st.mars.txt.maxy = uicontrol(fg,'Style','Text', ... - 'Position',[425 400 155 020].*WS,... - 'String','',... - 'HorizontalAlignment','left',... - 'FontWeight','bold'); -st.mars.txt.maxz = uicontrol(fg,'Style','Text', ... - 'Position',[425 370 155 020].*WS,... - 'String','',... - 'HorizontalAlignment','left',... - 'FontWeight','bold'); - -% store ROI information is orthviews global structure -st.mars.roi_info = roi_info; - -% set our own callback for crosshair move -st.callback = 'mars_display_roi(''orthcb'');'; - -% Move to centre of mass of last ROI in list -mars_orthviews('Reposition', roi_info(end).c_o_m); -mars_display_roi('show_info', length(roi_info)); - -case 'roi_menu' % callback service from ROI menu -if isfield(st, 'mars') - v = get(gco, 'Value'); - mars_orthviews('Reposition', st.mars.roi_info(v).c_o_m); - mars_display_roi('show_info', v); -end - -case 'show_info' % show info for ROI, from ROI info structure -v = varargin{1}; -if isfield(st, 'mars') - if ~isempty(v) - set(st.mars.txt.label, 'String', ... - st.mars.roi_info(v).label); - set(st.mars.txt.c_o_m, 'String', ... - sprintf('%.3g %.3g %.3g', ... - st.mars.roi_info(v).c_o_m)); - set(st.mars.txt.volume, 'String', ... - sprintf('%8.2f', st.mars.roi_info(v).volume)); - set(st.mars.txt.maxx, 'String', ... - sprintf('%.3g %.3g', st.mars.roi_info(v).maxx)); - set(st.mars.txt.maxy, 'String', ... - sprintf('%.3g %.3g', st.mars.roi_info(v).maxy)); - set(st.mars.txt.maxz, 'String', ... - sprintf('%.3g %.3g', st.mars.roi_info(v).maxz)); - else - set(st.mars.txt.label, 'String',''); - set(st.mars.txt.c_o_m, 'String',''); - set(st.mars.txt.volume, 'String',''); - set(st.mars.txt.maxx, 'String',''); - set(st.mars.txt.maxy, 'String',''); - set(st.mars.txt.maxz, 'String',''); - end -end - -case 'orthcb' % callback service from mars_orthviews - -% This copied from mars_orthviews 'shopos' function - -% The position of the crosshairs has been moved. -%----------------------------------------------------------------------- -if isfield(st,'mp'), - fg = spm_figure('Findwin','Graphics'); - if any(findobj(fg) == st.mp), - set(st.mp,'String',sprintf('%.1f %.1f %.1f',mars_orthviews('pos'))); - pos = mars_orthviews('pos',1); - set(st.vp,'String',sprintf('%.1f %.1f %.1f',pos)); - - % Set intensity to ROI list - in_str = ''; - roi_p = []; - V1 = st.vols{1}; - for r = 1:length(V1.blobs) - p2 = V1.blobs{r}.mat \ V1.mat * [pos; 1]; - rval = spm_sample_vol(V1.blobs{r}.vol,... - p2(1),p2(2),p2(3), ... - 0); - if ~isnan(rval) & rval ~= 0 - roi_p = [roi_p r]; - in_str = [in_str num2str(r) ' ']; - end - end - set(st.in,'String',in_str); - - % find, and show info for ROI - if ~isempty(roi_p) - v = find(roi_p(end) == [st.mars.roi_info(:).num]); - mars_display_roi('show_info', v); - else - mars_display_roi('show_info', []); - end - - else, - st.Callback = ';'; - rmfield(st,{'mp','vp','in'}); - end; -else, - st.Callback = ';'; -end; - -otherwise - error(['Unknown action strig: ' action_str]); -end diff --git a/lib/marsbar-0.44/mars_get_option.m b/lib/marsbar-0.44/mars_get_option.m deleted file mode 100644 index 2a49102..0000000 --- a/lib/marsbar-0.44/mars_get_option.m +++ /dev/null @@ -1,13 +0,0 @@ -function optval = mars_get_option(varargin) -% Get option subfield as named by ``varargin``. -% -% FORMAT optval = mars_get_option(varargin) -% -% Tries to get base default if option is not set. Returns empty matrix if -% there is no information for this option (for example, if the option fields -% were mis-spelled). -mars = mars_struct('getifthere', spm('getglobal','MARS'), 'OPTIONS'); -if isempty(mars) - mars = mars_options('basedefaults'); -end -optval = mars_struct('getifthere', mars, varargin{:}); diff --git a/lib/marsbar-0.44/mars_image_scaling.m b/lib/marsbar-0.44/mars_image_scaling.m deleted file mode 100644 index 27d96e3..0000000 --- a/lib/marsbar-0.44/mars_image_scaling.m +++ /dev/null @@ -1,157 +0,0 @@ -function [VY,row] = mars_image_scaling(marsD) -% get image scaling data for images, maybe via SPM design -% FORMAT [VY,row] = mars_image_scaling(marsD) -%----------------------------------------------------------------------- -% -% Inputs -% marsD - design matrix to (optionally) get parameters from -% -% Returns -% VY - SPM vol structs with selected scaling -% row - cell array, one per subject/session giving corresponding -% rows in for VY array -% -% $Id$ - -VY = []; -if nargin < 1 - marsD = []; -end -if isempty(marsD) - mod_code = spm_input('Modality of images to scale', '+1', 'b', ... - 'PET|FMRI|Other', [1 2 3], 2); -else - mod_code = is_fmri(marsD) + 1; -end - -switch mod_code - case 1 % PET - dGM = 50; - sess_str = 'Subject'; - case 2 % FMRI - dGM = 100; - sess_str = 'Session'; - case 3 % Other - dGM = 0; - sess_str = 'Subject'; -end - -VY = []; -Global = []; - -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Extract data from ROI(s)'); - -% images -if isempty(marsD) - spmf = 0; -else - spmf = spm_input('Images from:', '+1','b',['SPM design|GUI select'], ... - [1 0], 2); -end - -% get images, from design, or by hand -if spmf - if ~has_images(marsD); - warning('Design structure does not specify images'); - return - end - VY = get_images(marsD); - row = block_rows(marsD); - nsess = length(row); -end - -if isempty(VY) % need to know about images - % no of sessions / subjects - nsess = spm_input(sprintf('No of %ss', sess_str), '+1', 'r', 1, 1); - % select files for each session - for s = 1:nsess - simgs = spm_get(Inf, mars_veropts('get_img_ext'), ... - sprintf('Data images %s %d', sess_str, s)); - row{s} = (1:size(simgs, 1))'+size(VY,1); - VY = strvcat(VY, simgs); - end -end % of image get routines -if isempty(VY), return, end - -% global scaling options -askGMf = 1; -if spmf - gopts = {''}; - glabs = ['SPM design|' sess_str ' specific scaling',... - '|Proportional scaling|Raw data']; - tmp = spm_input('Scaling from:', '+1', 'm', glabs, 1:4, 1); - if tmp == 1 - Global = []; - askGMf = 0; - else - % force remap to wipe out previous SPM scaling - VY = strvcat(VY(:).fname); - if tmp == 2 - Global = 'None'; - elseif tmp == 3 - Global = 'Scale'; - elseif tmp == 4 - Global = []; - end - end - -else % scaling by hand - glabs = [sess_str ' specific scaling',... - '|Proportional scaling|Raw data']; - tmp = spm_input('Scaling from:', '+1', 'm', glabs, [1 2 3], 1); - if tmp == 1 - Global = 'None'; - elseif tmp == 2 - Global = 'Scale'; - else - Global = []; - end -end - -% Grand mean scaling -GM = 0; -if askGMf - GM = spm_input('Scale grand mean to (0=raw)','+1','r',dGM,1); -end - -% map files now, if not yet mapped -if ischar(VY) - fprintf('\n%-40s: %30s','Mapping files',' ') %-# - VY = spm_vol(VY); - fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-# -end - -% Apply scaling options if necessary -if ~isempty(Global) - -%-Compute Global variate -%----------------------------------------------------------------------- -q = length(VY); -g = zeros(q,1); -fprintf('%-40s: %30s','Calculating globals',' ') %-# -for i = 1:q - fprintf('%s%30s',repmat(sprintf('\b'),1,30),sprintf('%4d/%-4d',i,q)) %-# - g(i) = spm_global(VY(i)); -end -fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-# - -% get null GM scaling -if (GM == 0) - GM = mean(g); -end - -% scale if specified (otherwise subject / session specific grand mean scaling) -%----------------------------------------------------------------------- -gSF = GM./g; -if strcmp(Global,'None') - for i = 1:nsess - j = row{i}; - gSF(j) = GM./mean(g(j)); - end -end - -%-Apply gSF to memory-mapped scalefactors to implement scaling -%----------------------------------------------------------------------- -for i = 1:q, VY(i).pinfo(1:2,:) = VY(i).pinfo(1:2,:)*gSF(i); end - -end % of global options diff --git a/lib/marsbar-0.44/mars_img2rois.m b/lib/marsbar-0.44/mars_img2rois.m deleted file mode 100644 index c12cda4..0000000 --- a/lib/marsbar-0.44/mars_img2rois.m +++ /dev/null @@ -1,130 +0,0 @@ -function mars_img2rois(P, roipath, rootn, flags) -% creates ROIs from cluster image or image containing ROIs defined by unique nos -% FORMAT mars_img2rois(P, roipath, rootn, flags) -% -% P - image (string or struct) -% roipath - path to directory to store ROIs -% rootn - string to prefix to ROI filenames -% flags - none or more of: [default = 'i'] -% 'i' - id image, voxel values identify ROIs -% 'c' - cluster image, clusters identified by location -% 'x' - label clusters by location of maximum -% (default is location of centre of mass) -% -% $Id$ - -if nargin < 1 - P = ''; -end -if nargin < 2 - roipath = ''; -end -if nargin < 3 - rootn = ''; -end -if nargin < 4 - flags = ' '; -end - -% Process input arguments -if any(flags == 'i') - Pprompt = 'Image containing ROI ids'; -else - Pprompt = 'Image containing clusters'; -end -if isempty(P) - P = spm_get(1, mars_veropts('get_img_ext', Pprompt)); -end -if isempty(P) - return -end -if ischar(P) - P = spm_vol(P); -end -if isempty(roipath) - roipath = spm_get([-1 0], '', 'Directory to save ROIs'); -end -if isempty(roipath) - return -end -if isempty(rootn) - [pn rootn ext] = fileparts(P.fname); - rootn = spm_input('Prefix for ROI filenames', '+1', 's', rootn); -end -if isempty(rootn) - return -end - -if isempty(flags) - flags = 'i'; % id image is default -end - -% read img, get non-zero voxels -img = spm_read_vols(P); -img = img(:)'; -dim = P.dim(1:3); -pts = find(img~=0); - -% e2xyz -nz = pts-1; -pl_sz = dim(1)*dim(2); -Z = floor(nz / pl_sz); -nz = nz - Z*pl_sz; -Y = floor(nz / dim(1)); -X = nz - Y*dim(1); -XYZ = [X; Y;Z] +1; - -% collect clusters -vals = img(pts); - -% select cluster or id -if any(flags == 'i') - cl_vals = vals; -else - cl_vals = spm_clusters(XYZ); -end - -for c = unique(cl_vals) - % points for this region/cluster - t_cl_is = find(cl_vals == c); - - % corresponding XYZ - cXYZ = XYZ(:, t_cl_is); - - if ~isempty(cXYZ) - % location label for cluster images - if any(flags == 'c') - if any(flags == 'x') % maximum - [mx maxi] = max(vals(t_cl_is)); - mi = t_cl_is(maxi); - % voxel coordinate of max - vco = XYZ(:, mi); - else % centre of mass - vco = mean(cXYZ, 2); - end - - % pt coordinates in mm - pt_lab = P.mat * [vco; 1]; - pt_lab = pt_lab(1:3); - - % file name and labels - d = sprintf('%s cluster at [%0.1f %0.1f %0.1f]', rootn, pt_lab); - l = sprintf('%s_%0.0f_%0.0f_%0.0f', rootn, pt_lab); - - else % id image labels from voxel values - % file name and labels - d = sprintf('%s: id: %d', rootn, c); - l = sprintf('%s_%d', rootn, c); - end - - fname = maroi('filename', fullfile(roipath, l)); - o = maroi_pointlist(struct('XYZ',cXYZ,... - 'mat',P.mat,... - 'descrip',d,... - 'label', l), ... - 'vox'); - fprintf('\nSaving %s as %s...', d, fname); - saveroi(o, fname); - end -end -fprintf('\nDone...\n'); diff --git a/lib/marsbar-0.44/mars_licence.man b/lib/marsbar-0.44/mars_licence.man deleted file mode 100644 index fd83258..0000000 --- a/lib/marsbar-0.44/mars_licence.man +++ /dev/null @@ -1,365 +0,0 @@ - -% MarsBaR is copyright, distributed under the GNU General Public Licence. -%_______________________________________________________________________ -% -% MarsBaR (being the collection of files given in the manifest in the -% contents.m file) is free but copyright software, distributed under -% the terms of the GNU General Public Licence as published by the Free -% Software Foundation (either version 2, as given below, or at your -% option, any later version). -% -% For more details on "copyleft", see http://www.gnu.org/copyleft/ -% -% MarsBaR is supplied as is: -% No formal support or maintenance is provided or implied. -%_______________________________________________________________________ -% -% GNU GENERAL PUBLIC LICENSE -% Version 2, June 1991 -% -% Copyright (C) 1989, 1991 Free Software Foundation, Inc. -% 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -% Everyone is permitted to copy and distribute verbatim copies -% of this license document, but changing it is not allowed. -% -% Preamble -% -% The licenses for most software are designed to take away your -% freedom to share and change it. By contrast, the GNU General Public -% License is intended to guarantee your freedom to share and change free -% software--to make sure the software is free for all its users. This -% General Public License applies to most of the Free Software -% Foundation's software and to any other program whose authors commit to -% using it. (Some other Free Software Foundation software is covered by -% the GNU Library General Public License instead.) You can apply it to -% your programs, too. -% -% When we speak of free software, we are referring to freedom, not -% price. Our General Public Licenses are designed to make sure that you -% have the freedom to distribute copies of free software (and charge for -% this service if you wish), that you receive source code or can get it -% if you want it, that you can change the software or use pieces of it -% in new free programs; and that you know you can do these things. -% -% To protect your rights, we need to make restrictions that forbid -% anyone to deny you these rights or to ask you to surrender the rights. -% These restrictions translate to certain responsibilities for you if you -% distribute copies of the software, or if you modify it. -% -% For example, if you distribute copies of such a program, whether -% gratis or for a fee, you must give the recipients all the rights that -% you have. You must make sure that they, too, receive or can get the -% source code. And you must show them these terms so they know their -% rights. -% -% We protect your rights with two steps: (1) copyright the software, and -% (2) offer you this license which gives you legal permission to copy, -% distribute and/or modify the software. -% -% Also, for each author's protection and ours, we want to make certain -% that everyone understands that there is no warranty for this free -% software. If the software is modified by someone else and passed on, we -% want its recipients to know that what they have is not the original, so -% that any problems introduced by others will not reflect on the original -% authors' reputations. -% -% Finally, any free program is threatened constantly by software -% patents. We wish to avoid the danger that redistributors of a free -% program will individually obtain patent licenses, in effect making the -% program proprietary. To prevent this, we have made it clear that any -% patent must be licensed for everyone's free use or not licensed at all. -% -% The precise terms and conditions for copying, distribution and -% modification follow. -% -% ---------------- -% -% GNU GENERAL PUBLIC LICENSE -% TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -% -% 0. This License applies to any program or other work which contains -% a notice placed by the copyright holder saying it may be distributed -% under the terms of this General Public License. The "Program", below, -% refers to any such program or work, and a "work based on the Program" -% means either the Program or any derivative work under copyright law: -% that is to say, a work containing the Program or a portion of it, -% either verbatim or with modifications and/or translated into another -% language. (Hereinafter, translation is included without limitation in -% the term "modification".) Each licensee is addressed as "you". -% -% Activities other than copying, distribution and modification are not -% covered by this License; they are outside its scope. The act of -% running the Program is not restricted, and the output from the Program -% is covered only if its contents constitute a work based on the -% Program (independent of having been made by running the Program). -% Whether that is true depends on what the Program does. -% -% 1. You may copy and distribute verbatim copies of the Program's -% source code as you receive it, in any medium, provided that you -% conspicuously and appropriately publish on each copy an appropriate -% copyright notice and disclaimer of warranty; keep intact all the -% notices that refer to this License and to the absence of any warranty; -% and give any other recipients of the Program a copy of this License -% along with the Program. -% -% You may charge a fee for the physical act of transferring a copy, and -% you may at your option offer warranty protection in exchange for a fee. -% -% 2. You may modify your copy or copies of the Program or any portion -% of it, thus forming a work based on the Program, and copy and -% distribute such modifications or work under the terms of Section 1 -% above, provided that you also meet all of these conditions: -% -% a) You must cause the modified files to carry prominent notices -% stating that you changed the files and the date of any change. -% -% b) You must cause any work that you distribute or publish, that in -% whole or in part contains or is derived from the Program or any -% part thereof, to be licensed as a whole at no charge to all third -% parties under the terms of this License. -% -% c) If the modified program normally reads commands interactively -% when run, you must cause it, when started running for such -% interactive use in the most ordinary way, to print or display an -% announcement including an appropriate copyright notice and a -% notice that there is no warranty (or else, saying that you provide -% a warranty) and that users may redistribute the program under -% these conditions, and telling the user how to view a copy of this -% License. (Exception: if the Program itself is interactive but -% does not normally print such an announcement, your work based on -% the Program is not required to print an announcement.) -% -% These requirements apply to the modified work as a whole. If -% identifiable sections of that work are not derived from the Program, -% and can be reasonably considered independent and separate works in -% themselves, then this License, and its terms, do not apply to those -% sections when you distribute them as separate works. But when you -% distribute the same sections as part of a whole which is a work based -% on the Program, the distribution of the whole must be on the terms of -% this License, whose permissions for other licensees extend to the -% entire whole, and thus to each and every part regardless of who wrote it. -% -% Thus, it is not the intent of this section to claim rights or contest -% your rights to work written entirely by you; rather, the intent is to -% exercise the right to control the distribution of derivative or -% collective works based on the Program. -% -% In addition, mere aggregation of another work not based on the Program -% with the Program (or with a work based on the Program) on a volume of -% a storage or distribution medium does not bring the other work under -% the scope of this License. -% -% 3. You may copy and distribute the Program (or a work based on it, -% under Section 2) in object code or executable form under the terms of -% Sections 1 and 2 above provided that you also do one of the following: -% -% a) Accompany it with the complete corresponding machine-readable -% source code, which must be distributed under the terms of Sections -% 1 and 2 above on a medium customarily used for software interchange; or, -% -% b) Accompany it with a written offer, valid for at least three -% years, to give any third party, for a charge no more than your -% cost of physically performing source distribution, a complete -% machine-readable copy of the corresponding source code, to be -% distributed under the terms of Sections 1 and 2 above on a medium -% customarily used for software interchange; or, -% -% c) Accompany it with the information you received as to the offer -% to distribute corresponding source code. (This alternative is -% allowed only for noncommercial distribution and only if you -% received the program in object code or executable form with such -% an offer, in accord with Subsection b above.) -% -% The source code for a work means the preferred form of the work for -% making modifications to it. For an executable work, complete source -% code means all the source code for all modules it contains, plus any -% associated interface definition files, plus the scripts used to -% control compilation and installation of the executable. However, as a -% special exception, the source code distributed need not include -% anything that is normally distributed (in either source or binary -% form) with the major components (compiler, kernel, and so on) of the -% operating system on which the executable runs, unless that component -% itself accompanies the executable. -% -% If distribution of executable or object code is made by offering -% access to copy from a designated place, then offering equivalent -% access to copy the source code from the same place counts as -% distribution of the source code, even though third parties are not -% compelled to copy the source along with the object code. -% -% 4. You may not copy, modify, sublicense, or distribute the Program -% except as expressly provided under this License. Any attempt -% otherwise to copy, modify, sublicense or distribute the Program is -% void, and will automatically terminate your rights under this License. -% However, parties who have received copies, or rights, from you under -% this License will not have their licenses terminated so long as such -% parties remain in full compliance. -% -% 5. You are not required to accept this License, since you have not -% signed it. However, nothing else grants you permission to modify or -% distribute the Program or its derivative works. These actions are -% prohibited by law if you do not accept this License. Therefore, by -% modifying or distributing the Program (or any work based on the -% Program), you indicate your acceptance of this License to do so, and -% all its terms and conditions for copying, distributing or modifying -% the Program or works based on it. -% -% 6. Each time you redistribute the Program (or any work based on the -% Program), the recipient automatically receives a license from the -% original licensor to copy, distribute or modify the Program subject to -% these terms and conditions. You may not impose any further -% restrictions on the recipients' exercise of the rights granted herein. -% You are not responsible for enforcing compliance by third parties to -% this License. -% -% 7. If, as a consequence of a court judgment or allegation of patent -% infringement or for any other reason (not limited to patent issues), -% conditions are imposed on you (whether by court order, agreement or -% otherwise) that contradict the conditions of this License, they do not -% excuse you from the conditions of this License. If you cannot -% distribute so as to satisfy simultaneously your obligations under this -% License and any other pertinent obligations, then as a consequence you -% may not distribute the Program at all. For example, if a patent -% license would not permit royalty-free redistribution of the Program by -% all those who receive copies directly or indirectly through you, then -% the only way you could satisfy both it and this License would be to -% refrain entirely from distribution of the Program. -% -% If any portion of this section is held invalid or unenforceable under -% any particular circumstance, the balance of the section is intended to -% apply and the section as a whole is intended to apply in other -% circumstances. -% -% It is not the purpose of this section to induce you to infringe any -% patents or other property right claims or to contest validity of any -% such claims; this section has the sole purpose of protecting the -% integrity of the free software distribution system, which is -% implemented by public license practices. Many people have made -% generous contributions to the wide range of software distributed -% through that system in reliance on consistent application of that -% system; it is up to the author/donor to decide if he or she is willing -% to distribute software through any other system and a licensee cannot -% impose that choice. -% -% This section is intended to make thoroughly clear what is believed to -% be a consequence of the rest of this License. -% -% 8. If the distribution and/or use of the Program is restricted in -% certain countries either by patents or by copyrighted interfaces, the -% original copyright holder who places the Program under this License -% may add an explicit geographical distribution limitation excluding -% those countries, so that distribution is permitted only in or among -% countries not thus excluded. In such case, this License incorporates -% the limitation as if written in the body of this License. -% -% 9. The Free Software Foundation may publish revised and/or new versions -% of the General Public License from time to time. Such new versions will -% be similar in spirit to the present version, but may differ in detail to -% address new problems or concerns. -% -% Each version is given a distinguishing version number. If the Program -% specifies a version number of this License which applies to it and "any -% later version", you have the option of following the terms and conditions -% either of that version or of any later version published by the Free -% Software Foundation. If the Program does not specify a version number of -% this License, you may choose any version ever published by the Free Software -% Foundation. -% -% 10. If you wish to incorporate parts of the Program into other free -% programs whose distribution conditions are different, write to the author -% to ask for permission. For software which is copyrighted by the Free -% Software Foundation, write to the Free Software Foundation; we sometimes -% make exceptions for this. Our decision will be guided by the two goals -% of preserving the free status of all derivatives of our free software and -% of promoting the sharing and reuse of software generally. -% -% NO WARRANTY -% -% 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -% FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -% OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -% PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -% OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -% MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -% TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -% PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -% REPAIR OR CORRECTION. -% -% 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -% WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -% REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -% INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -% OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -% TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -% YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -% PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -% POSSIBILITY OF SUCH DAMAGES. -% -% END OF TERMS AND CONDITIONS -% -% ---------------- -% -% How to Apply These Terms to Your New Programs -% -% If you develop a new program, and you want it to be of the greatest -% possible use to the public, the best way to achieve this is to make it -% free software which everyone can redistribute and change under these terms. -% -% To do so, attach the following notices to the program. It is safest -% to attach them to the start of each source file to most effectively -% convey the exclusion of warranty; and each file should have at least -% the "copyright" line and a pointer to where the full notice is found. -% -% -% Copyright (C) 19yy -% -% This program is free software; you can redistribute it and/or modify -% it under the terms of the GNU General Public License as published by -% the Free Software Foundation; either version 2 of the License, or -% (at your option) any later version. -% -% This program is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with this program; if not, write to the Free Software -% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -% -% -% Also add information on how to contact you by electronic and paper mail. -% -% If the program is interactive, make it output a short notice like this -% when it starts in an interactive mode: -% -% Gnomovision version 69, Copyright (C) 19yy name of author -% Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. -% This is free software, and you are welcome to redistribute it -% under certain conditions; type `show c' for details. -% -% The hypothetical commands `show w' and `show c' should show the appropriate -% parts of the General Public License. Of course, the commands you use may -% be called something other than `show w' and `show c'; they could even be -% mouse-clicks or menu items--whatever suits your program. -% -% You should also get your employer (if you work as a programmer) or your -% school, if any, to sign a "copyright disclaimer" for the program, if -% necessary. Here is a sample; alter the names: -% -% Yoyodyne, Inc., hereby disclaims all copyright interest in the program -% `Gnomovision' (which makes passes at compilers) written by James Hacker. -% -% , 1 April 1989 -% Ty Coon, President of Vice -% -% This General Public License does not permit incorporating your program into -% proprietary programs. If your program is a subroutine library, you may -% consider it more useful to permit linking proprietary applications with the -% library. If this is what you want to do, use the GNU Library General -% Public License instead of this License. -%_______________________________________________________________________ -% -% Copied from @(#)spm_LICENCE.man 2.4 FIL 99/05/16 -% -% $Id$ diff --git a/lib/marsbar-0.44/mars_new_space.m b/lib/marsbar-0.44/mars_new_space.m deleted file mode 100644 index 0fd7218..0000000 --- a/lib/marsbar-0.44/mars_new_space.m +++ /dev/null @@ -1,83 +0,0 @@ -function [dim2, mat2, vox2] = mars_new_space(dim, mat, vox) -% make a new image space to contain image with rotations etc -% FORMAT [dim2, mat2, vox2] = mars_new_space(dim, mat, vox) -% -% dim - original dimensions in voxels -% mat - orignal mat file (4x4 transformation matrix) -% vox - required ouput voxel size -% -% OUTPUT -% dim2 - new dimensions -% mat2 - new mat file -% vox2 - new voxel dimensions -% -% $Id$ - -if nargin < 2 - error('Need two input args'); -end -dim = dim(:); -dim = dim(1:3)'; -if nargin < 3 - vox = []; -end - -% size, opposite corners of transformed img in mm -[sz mn_mx] = mmsz(dim, mat); - -% select new voxel size if needed -if isempty(vox) - % original voxel size - vox = sqrt(sum(mat(1:3,1:3).^2)); - - % XYZ max difference for one voxel - vxsz = mmsz([1 1 1], mat); - - % reassign original dimensions to best matching - % of new dimensions - [t o] = sort(vxsz); - vox2(o) = sort(vox); -else - vox2 = vox; -end - -% new dimensions add 1 to allow for half voxel at either -% side of voxel centres, allowing for rounding -dim2 = sz./vox2 + 1; -rdim2 = round(dim2); -tiny = 1e-12; -for d = 1:3 - if (dim2(d) - rdim2(d))=2, st.vols{H}.area = varargin{2}; end; - if isempty(st.bb), st.bb = maxbb; end; - bbox; - redraw(H); - end; - varargout{1} = H; - -case 'bb', - if length(varargin)> 0 & all(size(varargin{1})==[2 3]), st.bb = varargin{1}; end; - bbox; - redraw_all; - -case 'redraw', - redraw_all; - eval(st.callback); - if isfield(st,'registry'), - spm_XYZreg('SetCoords',st.centre,st.registry.hReg,st.registry.hMe); - end; - -case 'reposition', - if length(varargin)<1, tmp = findcent; - else, tmp = varargin{1}; end; - if length(tmp)==3, st.centre = tmp(:); end; - redraw_all; - eval(st.callback); - if isfield(st,'registry'), - spm_XYZreg('SetCoords',st.centre,st.registry.hReg,st.registry.hMe); - end; - -case 'setcoords', - st.centre = varargin{1}; - st.centre = st.centre(:); - redraw_all; - eval(st.callback); - -case 'space', - if length(varargin)<1, - st.Space = eye(4); - st.bb = maxbb; - redraw_all; - else, - space(varargin{1}); - redraw_all; - end; - bbox; - -case 'maxbb', - st.bb = maxbb; - bbox; - redraw_all; - -case 'resolution', - resolution(varargin{1}); - bbox; - redraw_all; - -case 'window', - if length(varargin)<2, - win = 'auto'; - elseif length(varargin{2})==2, - win = varargin{2}; - end; - for i=valid_handles(varargin{1}), - st.vols{i}.window = win; - end; - redraw(varargin{1}); - -case 'delete', - my_delete(varargin{1}); - -case 'move', - move(varargin{1},varargin{2}); - % redraw_all; - -case 'reset', - my_reset; - -case 'pos', - if isempty(varargin), - H = st.centre(:); - else, - H = pos(varargin{1}); - end; - varargout{1} = H; - -case 'interp', - st.hld = varargin{1}; - redraw_all; - -case 'xhairs', - xhairs(varargin{1}); - -case 'register', - register(varargin{1}); - -case 'addblobs', - addblobs(varargin{1}, varargin{2},varargin{3},varargin{4}); - redraw(varargin{1}); - -case 'addcolouredblobs', - addcolouredblobs(varargin{1}, varargin{2},varargin{3},varargin{4},varargin{5}); - -case 'addcolouredmatrix', - addcolouredmatrix(varargin{1}, varargin{2},varargin{3},varargin{4}); - -case 'addimage', - addimage(varargin{1}, varargin{2}); - redraw(varargin{1}); - -case 'addcolouredimage', - addcolouredimage(varargin{1}, varargin{2},varargin{3}); - -case 'addtruecolourimage', - % mars_orthviews('Addtruecolourimage',handle,filename,colourmap,prop,mx,mn) - % Adds blobs from an image in true colour - % handle - image number to add blobs to [default 1] - % filename of image containing blob data [default - request via GUI] - % colourmap - colormap to display blobs in [GUI input] - % prop - intensity proportion of activation cf grayscale [0.4] - % mx - maximum intensity to scale to [maximum value in activation image] - % mn - minimum intensity to scale to [minimum value in activation image] - % - - % For selecting images, later -img_flt = mars_veropts('get_img_ext'); - - if nargin < 2 - varargin(1) = {1}; - end - if nargin < 3 - varargin(2) = {spm_get(1, img_flt, 'Image with activation signal')}; - end - if ischar(varargin{2}),varargin{2} = spm_vol(varargin{2});end - if nargin < 4 - actc = []; - while isempty(actc) - actc = getcmap(spm_input('Colourmap for activation image', '+1','s')); - end - varargin(3) = {actc}; - end - if nargin < 5 - varargin(4) = {0.4}; - end - if nargin < 6 - varargin(5) = {max([eps maxval(varargin{2})])}; - end - if nargin < 7 - varargin(6) = {min([0 minval(varargin{2})])}; - end - - addtruecolourimage(varargin{1}, varargin{2},varargin{3}, varargin{4}, ... - varargin{5}, varargin{6}); - redraw(varargin{1}); - -case 'rmblobs', - rmblobs(varargin{1}); - redraw(varargin{1}); - -otherwise, - warning('Unknown action string') -end; - -spm('Pointer'); -return; - - -%_______________________________________________________________________ -%_______________________________________________________________________ -function addblobs(handle, xyz, t, mat) -global st -for i=valid_handles(handle), - if ~isempty(xyz), - rcp = round(xyz); - dim = max(rcp,[],2)'; - off = rcp(1,:) + dim(1)*(rcp(2,:)-1 + dim(2)*(rcp(3,:)-1)); - vol = zeros(dim)+NaN; - vol(off) = t; - vol = reshape(vol,dim); - st.vols{i}.blobs=cell(1,1); - if st.mode == 0, - axpos = get(st.vols{i}.ax{2}.ax,'Position'); - else, - axpos = get(st.vols{i}.ax{1}.ax,'Position'); - end; - ax = axes('Parent',st.fig,'Position',[(axpos(1)+axpos(3)+0.1) (axpos(2)+0.005) 0.05 (axpos(4)-0.01)],... - 'Box','on'); - mx = max([eps max(t)]); - mn = min([0 min(t)]); - image([0 1],[mn mx],[1:64]' + 64,'Parent',ax); - set(ax,'YDir','normal','XTickLabel',[]); - st.vols{i}.blobs{1} = struct('vol',vol,'mat',mat,'cbar',ax,'max',mx, 'min',mn); - end; -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function addimage(handle, fname) -global st -for i=valid_handles(handle), - vol = spm_vol(fname); - mat = vol.mat; - st.vols{i}.blobs=cell(1,1); - if st.mode == 0, - axpos = get(st.vols{i}.ax{2}.ax,'Position'); - else, - axpos = get(st.vols{i}.ax{1}.ax,'Position'); - end; - ax = axes('Parent',st.fig,'Position',[(axpos(1)+axpos(3)+0.05) (axpos(2)+0.005) 0.05 (axpos(4)-0.01)],... - 'Box','on'); - mx = max([eps maxval(vol)]); - mn = min([0 minval(vol)]); - image([0 1],[mn mx],[1:64]' + 64,'Parent',ax); - set(ax,'YDir','normal','XTickLabel',[]); - st.vols{i}.blobs{1} = struct('vol',vol,'mat',mat,'cbar',ax,'max',mx); -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function addcolouredblobs(handle, xyz, t, mat,colour) -global st -for i=valid_handles(handle), - if ~isempty(xyz), - rcp = round(xyz); - dim = max(rcp,[],2)'; - off = rcp(1,:) + dim(1)*(rcp(2,:)-1 + dim(2)*(rcp(3,:)-1)); - vol = zeros(dim)+NaN; - vol(off) = t; - vol = reshape(vol,dim); - if ~isfield(st.vols{i},'blobs'), - st.vols{i}.blobs=cell(1,1); - bset = 1; - else, - bset = length(st.vols{i}.blobs)+1; - end; - axpos = get(st.vols{i}.ax{2}.ax,'Position'); - mx = max([eps maxval(vol)]); - mn = min([0 minval(vol)]); - st.vols{i}.blobs{bset} = struct('vol',vol,'mat',mat,'max',mx,'min',mn,'colour',colour); - end; -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function addcolouredmatrix(handle, vol, mat,colour) -global st -for i=valid_handles(handle), - if ~isempty(vol), - if ~isfield(st.vols{i},'blobs'), - st.vols{i}.blobs=cell(1,1); - bset = 1; - else, - bset = length(st.vols{i}.blobs)+1; - end; - axpos = get(st.vols{i}.ax{2}.ax,'Position'); - mx = max([eps maxval(vol)]); - mn = min([0 minval(vol)]); - st.vols{i}.blobs{bset} = struct('vol',vol,'mat',mat,'max',mx,'min',mn,'colour',colour); - end; -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function addcolouredimage(handle, fname,colour) -global st -for i=valid_handles(handle), - - vol = spm_vol(fname); - mat = vol.mat; - if ~isfield(st.vols{i},'blobs'), - st.vols{i}.blobs=cell(1,1); - bset = 1; - else, - bset = length(st.vols{i}.blobs)+1; - end; - axpos = get(st.vols{i}.ax{2}.ax,'Position'); - mx = max([eps maxval(vol)]); - mn = min([0 minval(vol)]); - st.vols{i}.blobs{bset} = struct('vol',vol,'mat',mat,'max',mx,'min',mn,'colour',colour); -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function addtruecolourimage(handle,vol,colourmap,prop,mx,mn) -% adds true colour image to current displayed image -global st -mat = vol.mat; -if isstruct(vol) & isfield(vol, 'vol'), vol = vol.vol;end -for i=valid_handles(handle), - if ~isfield(st.vols{i},'blobs'), - st.vols{i}.blobs=cell(1,1); - bset = 1; - else, - bset = length(st.vols{i}.blobs)+1; - end; -% axpos = get(st.vols{i}.ax{2}.ax,'Position'); - c = struct('cmap', colourmap,'prop',prop); - st.vols{i}.blobs{bset} = struct('vol',vol,'mat',mat,'max',mx,'min',mn,'colour',c); -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function rmblobs(handle) -global st -for i=valid_handles(handle), - if isfield(st.vols{i},'blobs'), - for j=1:length(st.vols{i}.blobs), - if isfield(st.vols{i}.blobs{j},'cbar') & ishandle(st.vols{i}.blobs{j}.cbar), - delete(st.vols{i}.blobs{j}.cbar); - end; - end; - st.vols{i} = rmfield(st.vols{i},'blobs'); - end; -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function register(hreg) -global st -tmp = uicontrol('Position',[0 0 1 1],'Visible','off','Parent',st.fig); -h = valid_handles(1:24); -if ~isempty(h), - tmp = st.vols{h(1)}.ax{1}.ax; - st.registry = struct('hReg',hreg,'hMe', tmp); - spm_XYZreg('Add2Reg',st.registry.hReg,st.registry.hMe, 'mars_orthviews'); -else, - warning('Nothing to register with'); -end; -st.centre = spm_XYZreg('GetCoords',st.registry.hReg); -st.centre = st.centre(:); -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function xhairs(arg1), -global st -st.xhairs = 0; -opt = 'on'; -if ~strcmp(arg1,'on'), - opt = 'off'; -else, - st.xhairs = 1; -end; -for i=valid_handles(1:24), - for j=1:3, - set(st.vols{i}.ax{j}.lx,'Visible',opt); - set(st.vols{i}.ax{j}.ly,'Visible',opt); - end; -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function H = pos(arg1) -global st -H = []; -for arg1=valid_handles(arg1), - is = inv(st.vols{arg1}.premul*st.vols{arg1}.mat); - H = is(1:3,1:3)*st.centre(:) + is(1:3,4); -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function my_reset -global st -if ~isempty(st) & isfield(st,'registry') & ishandle(st.registry.hMe), - delete(st.registry.hMe); st = rmfield(st,'registry'); -end; -my_delete(1:24); -reset_st; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function my_delete(arg1) -global st -for i=valid_handles(arg1), - kids = get(st.fig,'Children'); - for j=1:3, - if any(kids == st.vols{i}.ax{j}.ax), - set(get(st.vols{i}.ax{j}.ax,'Children'),'DeleteFcn',''); - delete(st.vols{i}.ax{j}.ax); - end; - end; - st.vols{i} = []; -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function resolution(arg1) -global st -res = arg1/mean(svd(st.Space(1:3,1:3))); -Mat = diag([res res res 1]); -st.Space = st.Space*Mat; -st.bb = st.bb/res; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function move(handle,pos) -global st -for handle = valid_handles(handle), - st.vols{handle}.area = pos; -end; -bbox; -% redraw(valid_handles(handle)); -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function bb = maxbb -global st -mn = [Inf Inf Inf]; -mx = -mn; -for i=valid_handles(1:24), - bb = [[1 1 1];st.vols{i}.dim(1:3)]; - c = [ bb(1,1) bb(1,2) bb(1,3) 1 - bb(1,1) bb(1,2) bb(2,3) 1 - bb(1,1) bb(2,2) bb(1,3) 1 - bb(1,1) bb(2,2) bb(2,3) 1 - bb(2,1) bb(1,2) bb(1,3) 1 - bb(2,1) bb(1,2) bb(2,3) 1 - bb(2,1) bb(2,2) bb(1,3) 1 - bb(2,1) bb(2,2) bb(2,3) 1]'; - tc = st.Space\(st.vols{i}.premul*st.vols{i}.mat)*c; - tc = tc(1:3,:)'; - mx = max([tc ; mx]); - mn = min([tc ; mn]); -end; -bb = [mn ; mx]; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function space(arg1) -global st -if ~isempty(st.vols{arg1}) - num = arg1; - Mat = st.vols{num}.premul(1:3,1:3)*st.vols{num}.mat(1:3,1:3); - Mat = diag([sqrt(sum(Mat.^2)) 1]); - Space = (st.vols{num}.mat)/Mat; - bb = [1 1 1;st.vols{num}.dim(1:3)]; - bb = [bb [1;1]]; - bb=bb*Mat'; - bb=bb(:,1:3); - st.Space = Space; - st.bb = bb; -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function H = specify_image(arg1, arg2) -global st -H=[]; -ok = 1; -eval('V = spm_vol(arg1);','ok=0;'); -if ok == 0, - fprintf('Can not use image "%s"\n', arg1); - return; -end; - -ii = 1; -while ~isempty(st.vols{ii}), ii = ii + 1; end; - -DeleteFcn = ['mars_orthviews(''Delete'',' num2str(ii) ');']; -V.ax = cell(3,1); -for i=1:3, - ax = axes('Visible','off','DrawMode','fast','Parent',st.fig,'DeleteFcn',DeleteFcn,... - 'YDir','normal'); - d = image(0,'Tag','Transverse','Parent',ax,... - 'DeleteFcn',DeleteFcn); - set(ax,'Ydir','normal'); - lx = line(0,0,'Parent',ax,'DeleteFcn',DeleteFcn); - ly = line(0,0,'Parent',ax,'DeleteFcn',DeleteFcn); - if ~st.xhairs, - set(lx,'Visible','off'); - set(ly,'Visible','off'); - end; - V.ax{i} = struct('ax',ax,'d',d,'lx',lx,'ly',ly); -end; -V.premul = eye(4); -V.window = 'auto'; -st.vols{ii} = V; - -H = ii; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function bbox -global st -Dims = diff(st.bb)'+1; - -TD = Dims([1 2])'; -CD = Dims([1 3])'; -if st.mode == 0, SD = Dims([3 2])'; else, SD = Dims([2 3])'; end; - -un = get(st.fig,'Units');set(st.fig,'Units','Pixels');sz=get(st.fig,'Position');set(st.fig,'Units',un); -sz = sz(3:4); -sz(2) = sz(2)-40; - -for i=valid_handles(1:24), - area = st.vols{i}.area(:); - area = [area(1)*sz(1) area(2)*sz(2) area(3)*sz(1) area(4)*sz(2)]; - if st.mode == 0, - sx = area(3)/(Dims(1)+Dims(3))/1.02; - else, - sx = area(3)/(Dims(1)+Dims(2))/1.02; - end; - sy = area(4)/(Dims(2)+Dims(3))/1.02; - s = min([sx sy]); - - offy = (area(4)-(Dims(2)+Dims(3))*1.02*s)/2 + area(2); - sky = s*(Dims(2)+Dims(3))*0.02; - if st.mode == 0, - offx = (area(3)-(Dims(1)+Dims(3))*1.02*s)/2 + area(1); - skx = s*(Dims(1)+Dims(3))*0.02; - else, - offx = (area(3)-(Dims(1)+Dims(2))*1.02*s)/2 + area(1); - skx = s*(Dims(1)+Dims(2))*0.02; - end; - - DeleteFcn = ['mars_orthviews(''Delete'',' num2str(i) ');']; - - % Transverse - set(st.vols{i}.ax{1}.ax,'Units','pixels', ... - 'Position',[offx offy s*Dims(1) s*Dims(2)],... - 'Units','normalized','Xlim',[0 TD(1)]+0.5,'Ylim',[0 TD(2)]+0.5,... - 'Visible','on','XTick',[],'YTick',[]); - - % Coronal - set(st.vols{i}.ax{2}.ax,'Units','Pixels',... - 'Position',[offx offy+s*Dims(2)+sky s*Dims(1) s*Dims(3)],... - 'Units','normalized','Xlim',[0 CD(1)]+0.5,'Ylim',[0 CD(2)]+0.5,... - 'Visible','on','XTick',[],'YTick',[]); - - % Sagittal - if st.mode == 0, - set(st.vols{i}.ax{3}.ax,'Units','Pixels', 'Box','on',... - 'Position',[offx+s*Dims(1)+skx offy s*Dims(3) s*Dims(2)],... - 'Units','normalized','Xlim',[0 SD(1)]+0.5,'Ylim',[0 SD(2)]+0.5,... - 'Visible','on','XTick',[],'YTick',[]); - else, - set(st.vols{i}.ax{3}.ax,'Units','Pixels', 'Box','on',... - 'Position',[offx+s*Dims(1)+skx offy+s*Dims(2)+sky s*Dims(2) s*Dims(3)],... - 'Units','normalized','Xlim',[0 SD(1)]+0.5,'Ylim',[0 SD(2)]+0.5,... - 'Visible','on','XTick',[],'YTick',[]); - end; -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function redraw_all -global st -redraw(1:24); -return; -%_______________________________________________________________________ -function mx = maxval(vol) -if isstruct(vol) & isfield(vol, 'vol'), vol = vol.vol;end -if isstruct(vol), - mx = -Inf; - for i=1:vol.dim(3), - tmp = spm_slice_vol(vol,spm_matrix([0 0 i]),vol.dim(1:2),0); - imx = max(tmp(find(isfinite(tmp)))); - if ~isempty(imx),mx = max(mx,imx);end - end; -else, - mx = max(vol(find(isfinite(vol)))); -end; -%_______________________________________________________________________ -function mn = minval(vol) -if isstruct(vol) & isfield(vol, 'vol'), vol = vol.vol;end -if isstruct(vol), - mn = Inf; - for i=1:vol.dim(3), - tmp = spm_slice_vol(vol,spm_matrix([0 0 i]),vol.dim(1:2),0); - imn = min(tmp(find(isfinite(tmp)))); - if ~isempty(imn),mn = min(mn,imn);end - end; -else, - mn = min(vol(find(isfinite(vol)))); -end; - -%_______________________________________________________________________ -%_______________________________________________________________________ -function redraw(arg1) -global st -bb = st.bb; -Dims = diff(bb)'+1; -is = inv(st.Space); -cent = is(1:3,1:3)*st.centre(:) + is(1:3,4); - -for i = valid_handles(arg1), - M = st.vols{i}.premul*st.vols{i}.mat; - TM0 = [ 1 0 0 -bb(1,1)+1 - 0 1 0 -bb(1,2)+1 - 0 0 1 -cent(3) - 0 0 0 1]; - TM = inv(TM0*(st.Space\M)); - TD = Dims([1 2]); - - CM0 = [ 1 0 0 -bb(1,1)+1 - 0 0 1 -bb(1,3)+1 - 0 1 0 -cent(2) - 0 0 0 1]; - CM = inv(CM0*(st.Space\M)); - CD = Dims([1 3]); - - if st.mode ==0, - SM0 = [ 0 0 1 -bb(1,3)+1 - 0 1 0 -bb(1,2)+1 - 1 0 0 -cent(1) - 0 0 0 1]; - SM = inv(SM0*(st.Space\M)); SD = Dims([3 2]); - else, - SM0 = [ 0 1 0 -bb(1,2)+1 - 0 0 1 -bb(1,3)+1 - 1 0 0 -cent(1) - 0 0 0 1]; - SM0 = [ 0 -1 0 +bb(2,2)+1 - 0 0 1 -bb(1,3)+1 - 1 0 0 -cent(1) - 0 0 0 1]; - SM = inv(SM0*(st.Space\M)); - SD = Dims([2 3]); - end; - - ok=1; - eval('imgt = (spm_slice_vol(st.vols{i},TM,TD,st.hld))'';','ok=0;'); - eval('imgc = (spm_slice_vol(st.vols{i},CM,CD,st.hld))'';','ok=0;'); - eval('imgs = (spm_slice_vol(st.vols{i},SM,SD,st.hld))'';','ok=0;'); - if (ok==0), fprintf('Image "%s" can not be resampled\n', st.vols{i}.fname); - else, - if strcmp(st.vols{i}.window,'auto'), - mx = -Inf; mn = Inf; - if ~isempty(imgt), - mx = max([mx max(max(imgt))]); - mn = min([mn min(min(imgt))]); - end; - if ~isempty(imgc), - mx = max([mx max(max(imgc))]); - mn = min([mn min(min(imgc))]); - end; - if ~isempty(imgs), - mx = max([mx max(max(imgs))]); - mn = min([mn min(min(imgs))]); - end; - if mx==mn, mx=mn+eps; end; - else, - mx = st.vols{i}.window(2); - mn = st.vols{i}.window(1); - r=min([mn mx]);imgt = max(imgt,r); r=max([mn mx]);imgt = min(imgt,r); - r=min([mn mx]);imgc = max(imgc,r); r=max([mn mx]);imgc = min(imgc,r); - r=min([mn mx]);imgs = max(imgs,r); r=max([mn mx]);imgs = min(imgs,r); - end; - - if isfield(st.vols{i},'blobs'), - if ~isfield(st.vols{i}.blobs{1},'colour'), - % Add blobs for display using the split colourmap - scal = 64/(mx-mn); - dcoff = -mn*scal; - imgt = imgt*scal+dcoff; - imgc = imgc*scal+dcoff; - imgs = imgs*scal+dcoff; - - vol = st.vols{i}.blobs{1}.vol; - mat = st.vols{i}.premul*st.vols{i}.blobs{1}.mat; - if isfield(st.vols{i}.blobs{1},'max'), - mx = st.vols{i}.blobs{1}.max; - else, - mx = max([eps maxval(st.vols{i}.blobs{1}.vol)]); - st.vols{i}.blobs{1}.max = mx; - end; - if isfield(st.vols{i}.blobs{1},'min'), - mn = st.vols{i}.blobs{1}.min; - else, - mn = min([0 minval(st.vols{i}.blobs{1}.vol)]); - st.vols{i}.blobs{1}.min = mn; - end; - - vol = st.vols{i}.blobs{1}.vol; - M = st.vols{i}.premul*st.vols{i}.blobs{1}.mat; - tmpt = spm_slice_vol(vol,inv(TM0*(st.Space\M)),TD,[0 NaN])'; - tmpc = spm_slice_vol(vol,inv(CM0*(st.Space\M)),CD,[0 NaN])'; - tmps = spm_slice_vol(vol,inv(SM0*(st.Space\M)),SD,[0 NaN])'; - - sc = 64/(mx-mn); - off = 65.51-mn*sc; - msk = find(isfinite(tmpt)); imgt(msk) = off+tmpt(msk)*sc; - msk = find(isfinite(tmpc)); imgc(msk) = off+tmpc(msk)*sc; - msk = find(isfinite(tmps)); imgs(msk) = off+tmps(msk)*sc; - - cmap = get(st.fig,'Colormap'); - if size(cmap,1)~=128 - figure(st.fig) - spm_figure('Colormap','gray-hot') - end; - elseif isstruct(st.vols{i}.blobs{1}.colour), - % Add blobs for display using a defined - % colourmap - - % colourmaps - gryc = [0:63]'*ones(1,3)/63; - actc = ... - st.vols{1}.blobs{1}.colour.cmap; - actp = ... - st.vols{1}.blobs{1}.colour.prop; - - % scale grayscale image, not finite -> black - imgt = scaletocmap(imgt,mn,mx,gryc,65); - imgc = scaletocmap(imgc,mn,mx,gryc,65); - imgs = scaletocmap(imgs,mn,mx,gryc,65); - gryc = [gryc; 0 0 0]; - - % get max for blob image - vol = st.vols{i}.blobs{1}.vol; - mat = st.vols{i}.premul*st.vols{i}.blobs{1}.mat; - if isfield(st.vols{i}.blobs{1},'max'), - cmx = st.vols{i}.blobs{1}.max; - else, - cmx = max([eps maxval(st.vols{i}.blobs{1}.vol)]); - end; - - % get blob data - vol = st.vols{i}.blobs{1}.vol; - M = st.vols{i}.premul*st.vols{i}.blobs{1}.mat; - tmpt = spm_slice_vol(vol,inv(TM0*(st.Space\M)),TD,[0 NaN])'; - tmpc = spm_slice_vol(vol,inv(CM0*(st.Space\M)),CD,[0 NaN])'; - tmps = spm_slice_vol(vol,inv(SM0*(st.Space\M)),SD,[0 NaN])'; - - % actimg scaled round 0, black NaNs - topc = size(actc,1)+1; - tmpt = scaletocmap(tmpt,-cmx,cmx,actc,topc); - tmpc = scaletocmap(tmpc,-cmx,cmx,actc,topc); - tmps = scaletocmap(tmps,-cmx,cmx,actc,topc); - actc = [actc; 0 0 0]; - - % combine gray and blob data to - % truecolour - imgt = reshape(actc(tmpt(:),:)*actp+ ... - gryc(imgt(:),:)*(1-actp), ... - [size(imgt) 3]); - imgc = reshape(actc(tmpc(:),:)*actp+ ... - gryc(imgc(:),:)*(1-actp), ... - [size(imgc) 3]); - imgs = reshape(actc(tmps(:),:)*actp+ ... - gryc(imgs(:),:)*(1-actp), ... - [size(imgs) 3]); - - - else, - % Add full colour blobs - several sets at once - scal = 1/(mx-mn); - dcoff = -mn*scal; - imgt = repmat(imgt*scal+dcoff,[1,1,3]); - imgc = repmat(imgc*scal+dcoff,[1,1,3]); - imgs = repmat(imgs*scal+dcoff,[1,1,3]); - - for j=1:length(st.vols{i}.blobs), - vol = st.vols{i}.blobs{j}.vol; - mat = st.vols{i}.premul*st.vols{i}.blobs{j}.mat; - if isfield(st.vols{i}.blobs{j},'colour'), - colour = st.vols{i}.blobs{j}.colour; - else, - colour = [1 0 0]; - end; - if isfield(st.vols{i}.blobs{j},'max'), - mx = st.vols{i}.blobs{j}.max; - else, - mx = max([eps max(st.vols{i}.blobs{j}.vol(:))]); - st.vols{i}.blobs{j}.max = mx; - end; - if isfield(st.vols{i}.blobs{j},'min'), - mn = st.vols{i}.blobs{j}.min; - else, - mn = min([0 min(st.vols{i}.blobs{j}.vol(:))]); - st.vols{i}.blobs{j}.min = mn; - end; - - vol = st.vols{i}.blobs{j}.vol; - M = st.vols{i}.premul*st.vols{i}.blobs{j}.mat; - tmpt = spm_slice_vol(vol,inv(TM0*(st.Space\M)),TD,[0 NaN])'/(mx-mn)+mn; - tmpc = spm_slice_vol(vol,inv(CM0*(st.Space\M)),CD,[0 NaN])'/(mx-mn)+mn; - tmps = spm_slice_vol(vol,inv(SM0*(st.Space\M)),SD,[0 NaN])'/(mx-mn)+mn; - tmpt(find(~isfinite(tmpt))) = 0; - tmpc(find(~isfinite(tmpc))) = 0; - tmps(find(~isfinite(tmps))) = 0; - - tmp = cat(3,tmpt*colour(1),tmpt*colour(2),tmpt*colour(3)); - imgt = (repmat(1-tmpt,[1 1 3]).*imgt+tmp); - tmp = find(imgt<0); imgt(tmp)=0; tmp = find(imgt>1); imgt(tmp)=1; - - tmp = cat(3,tmpc*colour(1),tmpc*colour(2),tmpc*colour(3)); - imgc = (repmat(1-tmpc,[1 1 3]).*imgc+tmp); - tmp = find(imgc<0); imgc(tmp)=0; tmp = find(imgc>1); imgc(tmp)=1; - - tmp = cat(3,tmps*colour(1),tmps*colour(2),tmps*colour(3)); - imgs = (repmat(1-tmps,[1 1 3]).*imgs+tmp); - tmp = find(imgs<0); imgs(tmp)=0; tmp = find(imgs>1); imgs(tmp)=1; - end; - end; - else, - scal = 64/(mx-mn); - dcoff = -mn*scal; - imgt = imgt*scal+dcoff; - imgc = imgc*scal+dcoff; - imgs = imgs*scal+dcoff; - end; - - callback = 'mars_orthviews(''Reposition'');'; - - set(st.vols{i}.ax{1}.d,'ButtonDownFcn',callback, 'Cdata',imgt); - set(st.vols{i}.ax{1}.lx,'ButtonDownFcn',callback,... - 'Xdata',[0 TD(1)]+0.5,'Ydata',[1 1]*(cent(2)-bb(1,2)+1)); - set(st.vols{i}.ax{1}.ly,'ButtonDownFcn',callback,... - 'Ydata',[0 TD(2)]+0.5,'Xdata',[1 1]*(cent(1)-bb(1,1)+1)); - - set(st.vols{i}.ax{2}.d,'ButtonDownFcn',callback, 'Cdata',imgc); - set(st.vols{i}.ax{2}.lx,'ButtonDownFcn',callback,... - 'Xdata',[0 CD(1)]+0.5,'Ydata',[1 1]*(cent(3)-bb(1,3)+1)); - set(st.vols{i}.ax{2}.ly,'ButtonDownFcn',callback,... - 'Ydata',[0 CD(2)]+0.5,'Xdata',[1 1]*(cent(1)-bb(1,1)+1)); - - set(st.vols{i}.ax{3}.d,'ButtonDownFcn',callback,'Cdata',imgs); - if st.mode ==0, - set(st.vols{i}.ax{3}.lx,'ButtonDownFcn',callback,... - 'Xdata',[0 SD(1)]+0.5,'Ydata',[1 1]*(cent(2)-bb(1,2)+1)); - set(st.vols{i}.ax{3}.ly,'ButtonDownFcn',callback,... - 'Ydata',[0 SD(2)]+0.5,'Xdata',[1 1]*(cent(3)-bb(1,3)+1)); - else, - set(st.vols{i}.ax{3}.lx,'ButtonDownFcn',callback,... - 'Xdata',[0 SD(1)]+0.5,'Ydata',[1 1]*(cent(3)-bb(1,3)+1)); - set(st.vols{i}.ax{3}.ly,'ButtonDownFcn',callback,... - 'Ydata',[0 SD(2)]+0.5,'Xdata',[1 1]*(bb(2,2)+1-cent(2))); - end; - end; -end; -drawnow; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function centre = findcent -global st -obj = get(st.fig,'CurrentObject'); -centre = []; -cent = []; -cp = []; -for i=valid_handles(1:24), - for j=1:3, - if ~isempty(obj), - if any([st.vols{i}.ax{j}.d ... - st.vols{i}.ax{j}.lx ... - st.vols{i}.ax{j}.ly]== obj) - cp = get(get(obj,'Parent'),'CurrentPoint'); - elseif (st.vols{i}.ax{j}.ax == obj), - cp = get(obj,'CurrentPoint'); - end; - end; - if ~isempty(cp), - cp = cp(1,1:2); - is = inv(st.Space); - cent = is(1:3,1:3)*st.centre(:) + is(1:3,4); - switch j, - case 1, - cent([1 2])=[cp(1)+st.bb(1,1)-1 cp(2)+st.bb(1,2)-1]; - case 2, - cent([1 3])=[cp(1)+st.bb(1,1)-1 cp(2)+st.bb(1,3)-1]; - case 3, - if st.mode ==0, - cent([3 2])=[cp(1)+st.bb(1,3)-1 cp(2)+st.bb(1,2)-1]; - else, - cent([2 3])=[st.bb(2,2)+1-cp(1) cp(2)+st.bb(1,3)-1]; - end; - end; - break; - end; - end; - if ~isempty(cent), break; end; -end; -if ~isempty(cent), centre = st.Space(1:3,1:3)*cent(:) + st.Space(1:3,4); end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function handles = valid_handles(handles) -global st; -handles = handles(:)'; -handles = handles(find(handles<=24 & handles>=1 & ~rem(handles,1))); -for h=handles, - if isempty(st.vols{h}), handles(find(handles==h))=[]; end; -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function reset_st -global st -fig = spm_figure('FindWin','Graphics'); -bb = [ [-78 78]' [-112 76]' [-50 85]' ]; -st = struct('n', 0, 'vols',[], 'bb',bb,'Space',eye(4),'centre',[0 0 0],'callback',';','xhairs',1,'hld',1,'fig',fig,'mode',1); -st.vols = cell(24,1); -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function img = scaletocmap(inpimg,mn,mx,cmap,miscol) -if nargin < 5, miscol=1;end -cml = size(cmap,1); -scf = (cml-1)/(mx-mn); -img = round((inpimg-mn)*scf)+1; -img(find(img<1))=1; -img(find(img>cml))=cml; -img(~isfinite(img)) = miscol; -%_______________________________________________________________________ -%_______________________________________________________________________ -function cmap = getcmap(acmapname) -% get colormap of name acmapname -if ~isempty(acmapname) - cmap = evalin('base',acmapname,'[]'); - if isempty(cmap) % not a matrix, is .mat file? - [p f e] = fileparts(acmapname); - acmat = fullfile(p, [f '.mat']); - if exist(acmat, 'file') - s = struct2cell(load(acmat)); - cmap = s{1}; - end - end -end -if size(cmap, 2)~=3 - warning('Colormap was not an N by 3 matrix') - cmap = []; -end -return diff --git a/lib/marsbar-0.44/mars_rois2img.m b/lib/marsbar-0.44/mars_rois2img.m deleted file mode 100644 index d65a3d9..0000000 --- a/lib/marsbar-0.44/mars_rois2img.m +++ /dev/null @@ -1,101 +0,0 @@ -function mars_rois2img(roi_list, img_name, roi_space, flags) -% creates cluster or number labelled ROI image from ROIs -% FORMAT mars_rois2img(roi_list, img_name, roi_space, flags) -% -% roi_list - strings with ROI filenames -% img_name - name of image to write out -% roi_space - space for image -% flags - none or more of: [default = 'i'] -% 'i' - id image, voxel values identify ROIs -% 'c' - cluster image, clusters identified by location -% -% $Id % - -if nargin < 1 - roi_list = ''; -end -if nargin < 2 - img_name = ''; -end -if nargin < 3 - roi_space = []; -end -if nargin < 4 - flags = ''; -end - -% Process input arguments -if isempty(roi_list) - roi_list = spm_get([0 Inf], ['*' maroi('classdata', 'fileend')], ... - 'Select ROIs to write to image'); - if isempty(roi_list), return, end -end -if isempty(img_name) - img_name = mars_utils('get_img_name'); - if isempty(img_name), return, end -end -if isempty(roi_space) - roi_space = maroi('classdata', 'spacebase'); -end -if isempty(flags) - flags = 'i'; % id image is default -end - -roi_list = maroi('load_cell', roi_list); -roi_len = prod(size(roi_list)); - -img_data = zeros(roi_space.dim); -roi_ctr = 1; -for i = 1:roi_len - roi = roi_list{i}; - % check ROI contains something - if isempty(roi) - warning(sprintf('ROI %d is missing', i)); - elseif is_empty_roi(roi) - warning(sprintf('ROI %d:%s is empty', i, label(roi))); - else - % convert ROI to matrix - mo = maroi_matrix(roi, roi_space); - dat = matrixdata(mo); - if isempty(dat) | ~any(dat(:)) - warning(sprintf('ROI %d: %s - contains no points in this space',... - i, label(roi))); - else - % add matrix to image - if any(flags == 'i') - img_data(dat ~= 0) = roi_ctr; - roi_info(roi_ctr) = struct('label', label(roi),... - 'number', roi_ctr); - else - img_data = img_data + dat; - end - roi_ctr = roi_ctr + 1; - end - end -end -if roi_ctr == 1 - warning('Found no useful ROIs, no image saved'); - return -end - -% output image type -img_type = 'float'; % to avoid rounding errors - -% save ROI info -if any(flags == 'i') - [p f e] = fileparts(img_name); - iname = fullfile(p, [f '_labels.mat']); - save(iname, 'roi_info'); -end - -% Prepare and write image -V = mars_vol_utils('def_vol'); -V.fname = img_name; -V.mat = roi_space.mat; -V.dim(1:3) = roi_space.dim; -V = mars_vol_utils('set_type', V, img_type); - -V = spm_create_vol(V); -V = spm_write_vol(V, img_data); - -fprintf('Wrote image %s\nDone...\n', img_name); diff --git a/lib/marsbar-0.44/mars_struct.m b/lib/marsbar-0.44/mars_struct.m deleted file mode 100644 index 825800f..0000000 --- a/lib/marsbar-0.44/mars_struct.m +++ /dev/null @@ -1,264 +0,0 @@ -function varargout = mars_struct(action, varargin) -% multifunction function for manipulating structures -% -% To help the exposition a bit: -% 'fill' in a name, means that values empty or missing -% in one structure are fetched from another -% -% 'merge' means simply that missing fields are added, with -% values, from a second structure (but not filled if empty) -% -% Each function needs to deal with the case of empty arguments -% -% FORMAT c = mars_struct('fillafromb', a, b, fieldns, flags) -% fills structure fields empty or missing in a from those present in b -% a, b are structures -% fieldns (optional) is cell array of field names to fill from in b -% c is returned structure -% Is recursive, will fill struct fields from struct fields -% flags may contain 'f', which Force fills a from b (all non empty -% fields in b overwrite those in a) -% flags may also contain 'r', which Restricts fields to write from b, to -% those that are already present in a -% -% FORMAT [c, d] = mars_struct('split', a, b) -% split structure a into two, according to fields in b -% so that c becomes a structure which contains the fields -% in a, that are also present in b, and d contains the fields -% in a that are not present in b. b can be a structure -% or a cell array of fieldnames -% -% FORMAT [d] = mars_struct('strip', a, b) -% strips all fields present in b from those in a, -% returning denuded structure as d. b can be a structure -% or a cell array of fieldnames. 'strip' is just 'split' -% but returning only the second argument -% -% FORMAT c = mars_struct('merge', a, b) -% merges structure a and b (fields present in b added to a) -% -% FORMAT [c,d] = mars_struct('ffillsplit', a, b) -% force fill, followed by split -% All fields from a, that are also present in b, and not empty in b, -% are replaced with the values in b; the result is returned as c -% Any fields present in b, but not present in a, are returned in d -% So, let's say you have a default structure D, and you want to fill this -% in with any interesting data in a passed structure P, you could use: -% [good_struct not_recognized]= mars_struct('ffillsplit', D, P); -% -% FORMAT c = mars_struct('ffillmerge', a, b) -% force fill followed by merge -% performs 'ffillsplit' on a and b, then merges a and b -% All fields present in a or b are returned in c, but -% any fields present in both, now have the value from b -% -% FORMAT [c d] = mars_struct('splitmerge', a, b) -% performs 'split' on a and b, creating c and d -% then merges c with b. -% d contains fields in a that were not present in b -% c contains fields present in both, or just in b -% -% FORMAT z = mars_struct('isthere', a, b [, c [, d ...]) -% returns 1 if field named in b is present in a -% and field value is not empty. -% The call is recursive if more than two arguments are passed -% Thus with structure s = struct('one', struct('two', 3)) -% mars_struct('isthere', s, 'one', 'two') returns 1 -% -% FORMAT z = mars_struct('getifthere', a, b [, c [, d ...]) -% returns value of field named in b from a or [] if absent -% Call is recursive, like 'isthere' above. -% -% FORMAT strs = mars_struct('celldisp', a) -% returns output like disp(a) as a cell array -% Useful for printing text description of structure -% -% $Id$ - -if nargin < 1 - error('Action needed'); -end -if nargin < 2 - error('Must specify structure') -end -if nargin < 3 - varargin = {varargin{:} []}; -end -[a b] = deal(varargin{1:2}); - -switch lower(action) - case 'fillafromb' - % Return for empty passed args - if isempty(a), varargout = {b}; return, end - if isempty(b), varargout = {a}; return, end - if nargin < 4, fieldns = []; else fieldns = varargin{3}; end - if isempty(fieldns) - if ~isstruct(b), error('Need struct as 2nd argument'); end - fieldns = fieldnames(b); - end - if nargin < 5, flags = ''; else flags = varargin{4}; end - if isempty(flags), flags = ' ';end - - if ischar(fieldns), fieldns=cellstr(fieldns);end - - af = fieldnames(a)'; - bf = fieldns'; - - % classify fields 0 = a~b, 1 = a&b, 2=b~a - cf = af; - ftype = ismember(af, bf); - if ~any(flags == 'r') - b_not_a = find(~ismember(bf, af)); - cf = {cf{:} bf{b_not_a}}; - ftype = [ftype ones(1, length(b_not_a))*2]; - end - - % cope with arrays of structures - alen = prod(size(a)); - blen = prod(size(b)); - maxlen = max(alen, blen); - - for si=1:maxlen - ctmp = []; - for i=1:length(cf) - fn = cf{i}; - switch ftype(i) - case 0 % a~b - fval = getfield(a(si), fn); - case 1 % shared field - bfc = getfield(b(si), fn); - if isempty(getfield(a(si), fn)) || ... % a field is empty - (any(flags == 'f' && ~isempty(bfc)))% or force fill - fval = bfc; - else % field not empty, could be struct -> recurse - fval = getfield(a(si),fn); - if isstruct(fval) && isstruct(bfc) - fval = mars_struct('fillafromb',fval,bfc); - end - end - case 2 % b~a - fval = getfield(b(si), fn); - case 3 % no field information, see below - fval = []; - end - if isempty(ctmp) - ctmp = struct(fn, fval); - else - ctmp = setfield(ctmp, fn, fval); - end - end - c(si) = ctmp; - - if si == blen % reached end of bs, rest of b~a fields are empty - ftype = (ftype == 2) * 3; - elseif si == alen % end of a's rest of a~b fields are empty - ftype = (ftype == 0) * 2 + 1; - end - - end - varargout = {c}; - - case 'split' - if isempty(a), varargout = {a,a}; return, end - if isempty(b), varargout = {b,a}; return, end - d = a; - c = []; - - if ischar(b), b = {b};end - if isstruct(b), b = fieldnames(b);end - - for bf = b(:)' - if isfield(a, bf{1}) - c = setfield(c, bf{1}, getfield(a, bf{1})); - d = rmfield(d, bf{1}); - end - end - varargout = {c, d}; - - case 'strip' - [c d] = mars_struct('split', a, b); - varargout = {d}; - - case 'merge' - if isempty(a), varargout = {b}; return, end - if isempty(b), varargout = {a}; return, end - c = a; - - for bf = fieldnames(b)'; - if ~isfield(a, bf{1}) - c = setfield(c, bf{1}, getfield(b, bf{1})); - end - end - varargout = {c}; - - case 'ffillsplit' - if isempty(a) || isempty(b) - % Nothing in common, return unchanged - varargout = {a, b}; return - end - c = a; d = b; - - cf = fieldnames(c); - for i=1:length(cf) - if isfield(d, cf{i}) - dfc = getfield(d,cf{i}); - if ~isempty(dfc) - c = setfield(c, cf{i}, dfc); - end - d = rmfield(d, cf{i}); - end - end - varargout = {c,d}; - - case 'ffillmerge' - [a b] = mars_struct('ffillsplit', a, b); - varargout = {mars_struct('merge', a, b)}; - - case 'splitmerge' - [a c] = mars_struct('split', a, b); - varargout = {mars_struct('merge', a, b) c}; - - case 'isthere' - if isempty(a), varargout = {0}; return, end - c = mars_struct('getifthere', varargin{:}); - varargout = {~isempty(c)}; - - case 'getifthere' - if isempty(a), varargout = {[]}; return, end - if isempty(b), varargout = {[]}; return, end - for v = 2:nargin-1 - b = varargin{v}; - if ~isfield(a, b) - varargout = {[]}; - return - end - a = getfield(a, b); - end - varargout = {a}; - - case 'celldisp' - if isempty(a), varargout = {{}}; return, end - af = fieldnames(a); - c = {}; - pad_len = size(char(af), 2) + 4; - pad_str = ['%' num2str(pad_len) 's: %s']; - for f = 1:length(af) - d = getfield(a, af{f}); - cls = class(d); - sz = size(d); - szstr = sprintf('%dx', size(d)); - szstr(end) = []; - switch cls - case 'char' - case {'double', 'float'} - d = ['[' num2str(d) ']']; - otherwise - d = sprintf('[%s %s]', szstr, cls); - end - c{f} = sprintf(pad_str, af{f}, d); - end - varargout = {c}; - - otherwise - error(['Suspicious action was ' action]); -end % switch diff --git a/lib/marsbar-0.44/mars_uifile.m b/lib/marsbar-0.44/mars_uifile.m deleted file mode 100644 index a50ef86..0000000 --- a/lib/marsbar-0.44/mars_uifile.m +++ /dev/null @@ -1,87 +0,0 @@ -function [fn,pn,fi] = mars_uifile(action, filter_spec, prompt, filename, varargin) -% wrapper for matlab uiputfile/getfile; to resolve version differences -% FORMAT [fn,pn,fi] = mars_uifile(action, filter_spec, prompt, filename, varargin) -% -% uigetfile and uiputfile in matlab 5.3 does not support the use of multiple -% filters, in the filter_spec array. -% Matlab < 6.5 does not allow the passing of a seperate filename default -% as a third argument. -% Matlab < 6.5 does not return a third argument (file index) -% -% mars_uifile acts as a wrapper for calls to uiputfile and uigetfile, so -% that 6.5 format calls will be translated to something useful to 5.3, -% 6.1 if 5.3 or 6.1 is running. -% -% $Id$ - -if nargin < 1 - error('Need action'); -end -if nargin < 2 - filter_spec = ''; -end -if nargin < 3 - prompt = ''; -end -if nargin < 4 - filename = ''; -end -if isnumeric(filename) - varargin = [{filename} varargin]; - filename = ''; -end - -mlv = version; mlv = str2num(mlv(1:3)); -if mlv < 6.5 - % If we have a default filename, we cannot use it with the filterspec, - % so use filename instead of filterspec - if ~isempty(filename) - filter_spec = filename; - elseif mlv < 6 % only allowed string filterspec - if iscell(filter_spec) - filter_spec = filter_spec{1}; - end - semic = find(filter_spec == ';'); - if ~isempty(semic) - filter_spec(semic(1):end) = []; - end - end - arglist = {filter_spec, prompt, varargin{:}}; -else % (so matlab >= 6.5) - % It seems that, in the following setup: - % matlab 7; Java interface; linux; cell array filterspec - % - all uigetfile filters need to be of form '*.', where is - % the file extension. This is not so for the one version of matlab 7 - % on windows that I tested (matlab 7.1.0.253 or something). I'm - % guessing that other Unices may have the same problem though. - if mlv >= 7 & usejava('jvm') & isunix - for fsn = 1:size(filter_spec, 1) - [pn fn ext] = fileparts(filter_spec{fsn, 1}); - filter_spec{fsn, 1} = ['*' ext]; - end - end - - if isempty(filename) % matlab 7 does not tolerate empty filenames - arglist = {filter_spec, prompt, varargin{:}}; - else - arglist = {filter_spec, prompt, filename, varargin{:}}; - end -end - -fi = []; -switch lower(action) - case 'get' - if mlv < 6.5 - [fn pn] = uigetfile(arglist{:}); - else - [fn pn fi] = uigetfile(arglist{:}); - end - case 'put' - if mlv < 6.5 - [fn pn] = uiputfile(arglist{:}); - else - [fn pn fi] = uiputfile(arglist{:}); - end - otherwise - error(['Strange desire for ' action]); -end diff --git a/lib/marsbar-0.44/mars_utils.m b/lib/marsbar-0.44/mars_utils.m deleted file mode 100644 index 2b50382..0000000 --- a/lib/marsbar-0.44/mars_utils.m +++ /dev/null @@ -1,275 +0,0 @@ -function varargout=mars_utils(varargin) -% collection of useful utility functions for MarsBaR etc -% -% fname = mars_utils('str2fname', str) -% accepts string, attempts return of string for valid filename -% The passed string should be without path or extension -% -% tf = mars_utils('is_valid_varname', str) -% accepts string, tests if it is a valid variable name -% returns 1 for yes. -% -% P = mars_utils('get_img_name', fname, flags); -% gets name of image, if image exists, checks for overwrite -% returns filename, or empty string if overwrite not wanted -% -% XYZ = mars_utils('e2xyz', els, dims); -% takes element numbers in an image (e.g. find(img>5)) and the -% dimensions of the image [X Y Z] and returns the 3xN voxel -% coordinates corresponding to the N elements -% -% absf = mars_utils('isabspath', path); -% Takes path name, and returns flag, 1 if path is absolute on this -% system, 0 if relative or empty -% -% mars_utils('graphic_text', strs, [title_str, [, figure_str]]) -% Displays cell array of text (strs) in SPM graphics window -% with optional title (char) title_string. Can also set to display to -% other figure window (string or figure handle). -% -% mars_utils('spm_version', [check_global]) -% Gets SPM version string. Robust version to allow there to be -% versions of the spm.m file to not have Contents.m files in the same -% directory. If optional flag check_global is zero, does _not_ check -% global SPM_VER variable for version, and tries to get directly from -% spm.m / Contents.m pairs. -% -% tf = mars_utils('is_swapped_wrong', V) -% Deprecated - see version in mars_vol_utils -% -% tf = mars_utils('version_less_than', v1, v2) -% Returns 1 if version v1 is lower than version v2. -% Versions can be numbers. If strings, versions can contain more than -% one '.' character. For example, '0.38.1' is less than '0.39', or -% '0.38.2' -% -% $Id$ - -if nargin < 1 - error('Need action'); -end -Action = lower(varargin{1}); - -switch(Action) - -%======================================================================= -case 'str2fname' %-string to file name -%======================================================================= -if nargin < 2 - error('Need to specify string'); -end -str = varargin{2}; -% forbidden chars in file name -badchars = unique([filesep '/\ :;.''"~*?<>|&']); - -tmp = find(ismember(str, badchars)); -if ~isempty(tmp) - str(tmp) = '_'; - dt = diff(tmp); - if ~isempty(dt) - str(tmp(dt==1))=[]; - end -end -varargout={str}; - -%======================================================================= -case 'is_valid_varname' %- tests if string is valid variable name -%======================================================================= -if nargin < 2 - error('Need to specify string'); -end -str = varargin{2}; -try - eval([str '= [];']); - varargout={1}; -catch - varargout = {0}; -end - -%======================================================================= -case 'get_img_name' %-gets name of image, checks for overwrite -%======================================================================= -if nargin < 2 - fname = ''; -else - fname = varargin{2}; -end -if nargin < 3 - flags = ''; -else - flags = varargin{3}; -end -if isempty(flags) - flags = 'k'; -end - -varargout = {''}; -fdir = spm_get(-1, '', 'Directory to save image'); -fname = spm_input('Image filename', '+1', 's', fname); -if isempty(fname), return, end - -% set img extension and make absolute path -[pn fn ext] = fileparts(fname); -out_ext = mars_veropts('pref_img_out_ext'); -fname = fullfile(fdir, [fn out_ext]); -fname = spm_get('cpath', fname); - -if any(flags == 'k') && exist(fname, 'file') - if ~spm_input(['Overwrite ' fn], '+1', ... - 'b','Yes|No',[1 0], 1) - return - end -end -varargout = {fname}; - -%======================================================================= -case 'e2xyz' %-returns XYZ voxel coordinates for element numbers -%======================================================================= -if nargin < 2 - error('Need element numbers'); -end -if nargin < 3 - error('Need image dimensions'); -end -els = varargin{2}; -dim = varargin{3}; -if size(els, 2) == 1, els = els'; end -nz = els-1; -pl_sz = dim(1)*dim(2); -Z = floor(nz / pl_sz); -nz = nz - Z*pl_sz; -Y = floor(nz / dim(1)); -X = nz - Y*dim(1); -XYZ = [X; Y; Z] +1; -varargout = {XYZ}; - -%======================================================================= -case 'isabspath' % Returns 1 for absolute path, 0 if relative (or empty) -%======================================================================= -if nargin < 2 - error('Need path to test'); -end -pn = varargin{2}; -switch (spm_platform('filesys')) - case 'unx' - if (~isempty(pn) && pn(1)=='/'), absf=1; else, absf=0; end - case 'win' - if (length(pn)>1 && pn(2)==':'), absf=1; else, absf=0; end - otherwise - error('isabspath not coded for this filesystem'); -end -varargout = {absf}; - -%======================================================================= -case 'graphic_text' % Displays text in SPM figure window -%======================================================================= -if nargin < 2, error('Need text to show'); else S = varargin{2}; end -if ischar(S), S = cellstr(S); end -if nargin < 3, TTitle = ''; else TTitle = varargin{3}; end -if nargin < 4, F = []; else, F=varargin{4}; end -if isempty(F), F='Graphics'; end -if ischar(F), F = spm_figure('GetWin', F); end -if isempty(F), F = spm_figure('GetWin', 'Graphics'); end - -FS = spm('FontSizes'); -PF = spm_platform('fonts'); - -spm_figure('clear', F); -figure(F); -hAxes = axes('Position',[0.028,0.05,0.85,0.85],... - 'DefaultTextInterpreter','none',... - 'Units','Points','Visible','off'); -AxPos = get(hAxes,'Position'); set(hAxes,'YLim',[0,AxPos(4)]) - -dy = FS(10)*1.2; y0 = floor(AxPos(4)) -dy; y = y0; - -text(-0.03,y0,TTitle,'FontSize',FS(14),'FontWeight','bold'); -y = y0 - FS(14); - -%-Loop over lines of text -%------------------------ -for i = 1:prod(size(S)) - d = S{i}; - - %-For some reason, '|' characters cause a CR. - d = strrep(d,'|','I'); - h = text(0,y,d,'FontName',PF.courier,'FontSize',FS(10)); - y = y - dy; -end - -%======================================================================= -case 'spm_version' % Robust get for SPM version string -%======================================================================= -% The problem we are trying to solve here is how to take account of the -% unusual situation of the spm.m file _not_ being in the same directory -% as the Contents.m file. SPM8 raises an error, SPM5 and probably -% previous just returns 'SPM'. We raise an error always. - -try - ver = spm('ver'); -catch - err = lasterr; - if strcmp('Undefined', err(1:length('Undefined'))) - error('Marsbar needs SPM on the matlab path') - end - error(lasterr) -end -% If version find failed, for SPM5, routine returns 'SPM' -str = ['Can''t obtain SPM Revision information. Is spm.m in the same' ... - ' directory as Contents.m?']; -if strcmp(ver, 'SPM') - error(str) -end -varargout = {ver}; - -%======================================================================= -case 'is_swapped_wrong' % Returns 1 for if vol is incorrectly swapped -%======================================================================= -warning(... - sprintf(['mars_utils version of ''is_swapped_wrong'' deprecated\n',... - 'Please use same function in mars_vol_utils'])); -varargout = {mars_vol_utils(varargin{:})}; - -%======================================================================= -case 'version_less_than' % Returns 1 for if first version less than last -%======================================================================= - -if nargin < 3 - error('Need two version strings to compare'); -end -varargout{1} = sf_ver_lt(varargin{2:3}); - -otherwise - error([Action ' is too strange']); -end -return - -% Subfunctions - -function tf = sf_ver_lt(v1, v2) -% Returns 1 if version string v1 is lower than v2 -vs = {v1, v2}; -for v = 1:2 - ns = vs{v}; - if ~ischar(ns), ns = num2str(ns); end - ns = sf_str_to_nums(ns); - cmp_mat(v, 1:length(ns)) = ns; -end -dp = diff(cmp_mat) * -1; -for i = 1:length(dp) - if dp(i)<0, tf = 1; return, end - if dp(i)>0, tf = 0; return, end -end -tf = 0; -return - -function ns = sf_str_to_nums(str) -str = str(ismember(str, '0123456789.')); -str = ['.' str '.']; -ps = find(str == '.'); -ns = []; -for p = 2:length(ps) - s = str(ps(p-1)+1:ps(p)-1); - ns = [ns str2num(s)]; -end -return diff --git a/lib/marsbar-0.44/mars_vol_check.m b/lib/marsbar-0.44/mars_vol_check.m deleted file mode 100644 index 039cb64..0000000 --- a/lib/marsbar-0.44/mars_vol_check.m +++ /dev/null @@ -1,70 +0,0 @@ -function [samef, msg, chgf] = mars_vol_check(varargin) -% FORMAT [samef, msg, chgf] = mars_vol_check(V1, V2, ...) -% checks spm_vol structs are in same space -% -% V1, V2, etc - arrays of spm_vol structs -% -% samef - true if images have same dims, mats -% msg - cell array containing helpful message if not -% chgf - logical Nx2 array of difference flags -%_______________________________________________________________________ -% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging - -% Copied from spm_vol_check.m -% Matthew Brett -% $Id: spm_vol_check.m 2696 2009-02-05 20:29:48Z guillaume $ - - -[fnames samef msg] = deal({},1,{}); - -if nargin < 1, - return; -end - -for i = 1:numel(varargin), - vols = varargin{i}; - if ~isempty(vols), - if i == 1, - dims = cat(3,vols(:).dim); - mats = cat(3,vols(:).mat); - else - dims = cat(3,dims,vols(:).dim); - mats = cat(3,mats,vols(:).mat); - end - fnames = {fnames{:}, vols(:).fname}; - end -end - -nimgs = size(dims, 3); -if nimgs < 2, - return; -end - -labs = {'dimensions', 'orientation & voxel size'}; - -dimf = any(diff(dims(:,1:3,:),1,3)); -matf = any(any(diff(mats,1,3))); -chgf = logical([dimf(:) matf(:)]); -chgi = find(any(chgf, 2)); -if ~isempty(chgi), - samef = 0; - e1 = chgi(1); - msg = {['Images don''t all have the same ' ... - sepcat(labs(chgf(e1,:)),', ')],... - 'First difference between image pair:',... - fnames{e1},... - fnames{e1+1}}; -end - -function s = sepcat(strs, sep) -% returns cell array of strings as one char string, separated by sep -if nargin < 2, - sep = ';'; -end -if isempty(strs), - s = ''; - return -end -strs = strs(:)'; -strs = [strs; repmat({sep}, 1, length(strs))]; -s = [strs{1:end-1}]; diff --git a/lib/marsbar-0.44/mars_vol_utils.m b/lib/marsbar-0.44/mars_vol_utils.m deleted file mode 100644 index ec0e1c5..0000000 --- a/lib/marsbar-0.44/mars_vol_utils.m +++ /dev/null @@ -1,341 +0,0 @@ -function varargout=mars_vol_utils(varargin) -% collection of useful utility functions for vol structs -% -% tf = mars_vol_utils('is_vol', V) -% Returns 1 if V may be a vol struct (right fields) -% -% [t,be,sw] = mars_vol_utils('type', V) -% Returns type number for vol struct - see spm_type, spm_vol -% Second output t = 1 if vol seems to be little-endian -% Third output sw = 1 if vol swapped relative to this platform -% -% V = mars_vol_utils('set_type', V, type_info) -% Sets type of vol struct, using type_info -% type_info can be a number, or a string (see spm_type) -% -% tf = mars_vol_utils('is_swapped', V) -% Returns 1 if V contains data that has opposite endianness from -% current platform (as given by spm_platform('bigendian') -% -% ver = mars_vol_utils('ver', V) -% Returns version string for vol struct -% '99' if appears to be spm99 format, '5' for spm5 -% -% ver = mars_vol_utils('current_ver') -% Returns '99' if current spm_vols returns 99 vol type, else '5' -% -% tf = mars_vol_utils('is_swapped_wrong', V) -% Returns 1 if the vol struct V has the different swapping -% information from a fresh mapping from the same file, and thus might -% have to be remapped. -% -% V = mars_vol_utils('byte_swap', V) -% Returns new vols for opposite byte ordering to current spec -% -% V = mars_vol_utils('convert', V, ver) -% Return vol struct(s) V converted to type specified in ver -% If ver not specified, convert to current ver type -% -% V = mars_vol_utils('def_vol', ver) -% Return default structure for type ver -% If ver not specified, use current ver type -% -% $Id: mars_vol_utils.m 581 2005-06-21 15:40:17Z matthewbrett $ - -nout = max(nargout,1); -varargout = cell(1, nout); -if nargin < 1 - error('Need action'); -end -Action = lower(varargin{1}); -if nargin > 1 - V = varargin{2}; -end - -switch(Action) - -%======================================================================= -case 'is_vol' % Returns 1 if this appears to be a vol struct -%======================================================================= -if nargin < 2 - error('Need vol struct to check'); -end -varargout = {sf_is_vol(V)}; - -%======================================================================= -case 'type' % Returns vol type number -%======================================================================= -if nargin < 2 - error('Need vol struct to give type'); -end -sf_die_no_vol(V); -varargout{:} = sf_type(V); - -%======================================================================= -case 'set_type' % Sets vol type -%======================================================================= -if nargin < 2 - error('Need vol struct to set type'); -end -sf_die_no_vol(V); -if nargin < 3 - error('Need type to set'); -end -type_info = varargin{3}; -varargout = {sf_set_type(V, type_info)}; - -%======================================================================= -case 'is_swapped' % Returns 1 if vol swapped relative to this platform -%======================================================================= -if nargin < 2 - error('Need vol struct to check swapping'); -end -sf_die_no_vol(V); -[t be sw] = sf_type(V); -varargout = {sw}; - -%======================================================================= -case 'ver' % Returns vol type version -%======================================================================= -if nargin < 2 - error('Need vol struct to give version'); -end -sf_die_no_vol(V); -varargout = {sf_ver(V)}; - -%======================================================================= -case 'current_ver' % Returns vol type from spm_vol on path -%======================================================================= -varargout = {sf_current_ver}; - -%======================================================================= -case 'is_swapped_wrong' % Returns 1 for if vol is incorrectly swapped -%======================================================================= -if nargin < 2 - error('Need vol struct to test'); -end -sf_die_no_vol(V); -V2 = spm_vol(V.fname); -[t be] = sf_type(V); -[t be2] = sf_type(V2); -varargout = {be ~= be2}; - -%======================================================================= -case 'byte_swap' % return vols with opposite recorded byte ordering -%======================================================================= -if nargin < 2 - error('Need vol struct to swap'); -end -sf_die_no_vol(V); -switch sf_ver(V) - case '99' - for i = 1:numel(V) - if V(i).dim(4) < 256, scf = 256; else scf = 1/256; end - V(i).dim(4) = V(i).dim(4) * scf; - end - case '5' - for i = 1:numel(V) - V(i).dt(2) = 1-V(i).dt(2); - end - otherwise - error(['Don''t often see those ' sf_ver(V)]); -end -varargout = {V}; - -%======================================================================= -case 'convert' % Returns vols converted to alternative type -%======================================================================= -if nargin < 2 - error('Need vol struct to convert'); -end -if ~sf_is_vol(V), varargout={V}; return, end -if nargin < 3 - ver = sf_current_ver; -else - ver = varargin{3}; - if sf_is_vol(ver), ver = sf_ver(ver); end -end -if sf_same_ver(V, ver) - varargout = {V}; - return -end -switch sf_ver(V) - case '99' - varargout = {sf_99_to_5(V)}; - case '5' - varargout = {sf_5_to_99(V)}; - otherwise - error([sf_ver(V) ' is just nuts']); -end - -%======================================================================= -case 'def_vol' % Returns default vol struct of given type -%======================================================================= -if nargin < 2 - ver = sf_current_ver; -else - ver = varargin{2}; - if sf_is_vol(ver), ver = sf_ver(ver); end -end -switch ver - case '99' - varargout = {sf_def_vol_99}; - case '5' - varargout = {sf_def_vol_5}; - otherwise - error([ver ' is unacceptable']); -end -return - -otherwise - error([Action ' is beyond my range']); -end -return - -% Subfunctions - -function tf = sf_is_vol(V) -% returns 1 if this may be a vol struct -tf = 0; -if ~isstruct(V), return, end -if ~isfield(V, 'dim'), return, end -tf = 1; -return - -function sf_die_no_vol(V) -if ~sf_is_vol(V) - error('I really wanted a vol struct here'); -end -return - -function [t, be, sw] = sf_type(V) -% returns type number, big-endian flag, swapped flag -plat_be = spm_platform('bigend'); -V = V(1); -if sf_same_ver(V, '5') % spm5 vol type - t = V.dt(1); - be = V.dt(2); - sw = xor(be, plat_be); -elseif length(V.dim) > 3 % spm99 style type specifier - t = V.dim(4); - sw = (t > 256); - if sw, t = t/256; end - be = xor(plat_be, sw); -else - error('Could not get vol type'); -end -return - -function V = sf_set_type(V, type_info) -% set type for V from type_info -switch sf_current_ver - case '99' - if ischar(type_info) - if strcmp(type_info, 'float32'), type_info='float'; end - if strcmp(type_info, 'float64'), type_info='double'; end - type_info = spm_type(type_info); - end - case '5' - if ischar(type_info) - if strcmp(type_info, 'float'), type_info='float32'; end - if strcmp(type_info, 'double'), type_info='float64'; end - type_info = spm_type(type_info); - end - otherwise - error(['Don''t like your type: ' sf_current_ver]); -end -switch sf_ver(V) - case '99' - V.dim(4) = type_info; - case '5' - V.dt(1) = type_info; - otherwise - error(['That''s a funny type: ' sf_ver(V)]); -end -return - -function ver = sf_ver(V) -% returns version string ('99' or '5') -if isfield(V, 'dt') - ver = '5'; -else - ver = '99'; -end -return - -function ver = sf_current_ver; -% returns version for spm_vol on path -% spm2,99 spm_vol do not accept no args -try - V = spm_vol; - ver = sf_ver(V); -catch - ver = '99'; -end -return - -function V = sf_def_vol_99; -V = struct(... - 'fname', '',... - 'dim', zeros(1,4), ... - 'pinfo', [1 0 0]', ... - 'mat', eye(4), ... - 'n', [], ... - 'descrip', ''); -return - -function V = sf_def_vol_5; -V = struct('fname', '',... - 'dim', zeros(1,3),... - 'dt', [0 0],... - 'pinfo', [1 0 0]',... - 'mat', eye(4),... - 'n', [],... - 'descrip', '',... - 'private',[]); -return - -function Vo = sf_99_to_5(Vi) -% converts spm99 vols to spm5 vols -d = sf_def_vol_5; -Vo = d; % in case Vi is empty -is_n = isfield(Vi, 'n'); -for i = 1:numel(Vi) - OV = Vi(i); - NV = d; - [t be] = sf_type(OV); - NV.fname = OV.fname; - NV.dim = OV.dim(1:3); - NV.dt = [t be]; - NV.mat = OV.mat; - NV.pinfo = OV.pinfo; - NV.descrip = OV.descrip; - if is_n, NV.n = [OV.n 1]; end - Vo(i) = NV; -end -Vo = reshape(Vo, size(Vi)); -return - -function Vo = sf_5_to_99(Vi) -% converts spm5 vols to spm99 vols -d = sf_def_vol_99; -Vo = d; % in case Vi is empty -for i = 1:numel(Vi) - OV = Vi(i); - NV = d; - [t be sw] = sf_type(OV); - if sw, t = t * 256; end - NV.fname = OV.fname; - NV.dim = [OV.dim(1:3) t]; - NV.mat = OV.mat; - NV.pinfo = OV.pinfo; - NV.descrip = OV.descrip; - NV.n = OV.n(1); - Vo(i) = NV; -end -Vo = reshape(Vo, size(Vi)); -return - -function tf = sf_same_ver(V, ver) -tf = strcmp(sf_ver(V), ver); -return diff --git a/lib/marsbar-0.44/marsbar.jpg b/lib/marsbar-0.44/marsbar.jpg deleted file mode 100644 index b15ce7fe61d04cadd23825182552eddf6126e521..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7460 zcmbuEbx;)E+x8b01OaKJ%cVgCq(i!-q(hL7C52UxE=5`Clv=u3V%Y_jmhJ{&0i{bq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fv(K6!SaBmRA% zTj<gPRhodTX7qFG@f2Ze~9!1 zzCIK4ZB6gQ zU+>3#lS>oP8XF|0R;mVBDov`{!Q&rMI8^SjmarB&Al8UKZ;uve8=k<67q!CbdQetz zfdI|-tQJkz#7?R=CP}W*Q_>7@PuOK%_#i$Q`}({#Vy`}ghAe!ZS6RIS)YlYpk2d5= z4zP>x6_~mDQHTyZN-8ZXAyyLjCw2-KHLOjezcR{TLB!0lU9gWnXXR^CC?ih%ESvaN zJ!LBtwe)E03#eo{5^lo2MXW~0lxp*%)MEJ0+qHq9`NRlTZHBYV8gF|yU-?j6sdG^7 zSiMiW8hC$oehuyk>PR%u^jHhpxHo=EQ!6X?R^-&1TzP;WrmE$=@`pB5d>O`zGqk-0 zxC6+~Rf9V)bEh{jEGUh+gJTl*WnZzRLdR1N5v}mfY2_O3lNJ0LVyL+KY5fyHu7DgZ zbh#iNEVyoz*G&K7UC0zQMvE$Y!`mR1w0ne7lOi!}F-@*g3974e&a3)3VIUt$Lrm=& z=Bp14rZ!4p2SgAK$SGE7<=_<$1PT>!%gZ{)!q%_(eV~AG#FSmbU^1n+k7TFC#NTrM gr== 7 && strcmp(computer, 'GLNX86') - if usejava('jvm') - setappdata(0,'UseNativeSystemDialogs',false) - else - warning(['Matlab 7, linux, no java, please see FAQ for '... - 'information on problems with file selection dialogs']); - end -end - -%-Open startup window, set window defaults -%----------------------------------------------------------------------- -S = get(0,'ScreenSize'); -if all(S==1), error('Can''t open any graphics windows...'), end -PF = spm_platform('fonts'); - -% Splash screen -%------------------------------------------ -if splashf - marsbar('splash'); -end - -%-Draw marsbar window -%----------------------------------------------------------------------- -Fmenu = marsbar('CreateMenuWin','off'); - -%-Reveal windows -%----------------------------------------------------------------------- -set([Fmenu],'Visible','on') - -%======================================================================= -case 'on' %-Initialise MarsBaR -%======================================================================= - -% promote spm replacement directory -% remove incorrect spm replacement directories -mbpath = fileparts(which('marsbar.m')); -spmV = mars_utils('spm_version'); -m_spm_paths = {'spm99', 'spm2', 'spm5'}; -v_path = lower(spmV); -% spm8 is effectively identical to spm5 for marsbar -switch v_path -case {'spm8', 'spm12b', 'spm12'} - v_path = 'spm5'; -end -w_s = warning; -warning off -for p = m_spm_paths(~ismember(m_spm_paths, v_path)) - rmpath(fullfile(mbpath, char(p))) -end -warning(w_s) -MARS.ADDPATHS = {fullfile(mbpath, v_path)}; -addpath(MARS.ADDPATHS{:}, '-begin'); -fprintf('MarsBaR analysis functions prepended to path\n'); - -% check SPM defaults are loaded -mars_veropts('defaults'); - -% set up the ARMOIRE stuff -% see marmoire help for details -if isfield(MARS, 'ARMOIRE') - o = MARS.ARMOIRE; -else - o = marmoire; -end - -spm_design_filter = mars_veropts('design_filter_spec'); -filter_specs = {[spm_design_filter(1,:);... - {'*_mdes.mat','MarsBaR: *_mdes.mat'}; ... - spm_design_filter(2:end,:)], ... - {'*_mdata.mat','MarsBaR data file (*_mdata.mat)'},... - {'*_mres.mat', 'MarsBaR results (*_mres.mat)'}}; - -o = add_if_absent(o, 'def_design', ... - struct('default_file_name', 'untitled_mdes.mat',... - 'filter_spec', {filter_specs{1}},... - 'title', 'Default design',... - 'set_action','mars_arm_call(''set_design'',o,item,old_o)')); -o = add_if_absent(o, 'roi_data',... - struct('default_file_name', 'untitled_mdata.mat',... - 'filter_spec', {filter_specs{2}},... - 'title', 'ROI data',... - 'set_action','mars_arm_call(''set_data'',o,item,old_o)')); -o = add_if_absent(o, 'est_design',... - struct('default_file_name', 'untitled_mres.mat',... - 'filter_spec', {filter_specs{3}},... - 'title', 'MarsBaR estimated design',... - 'set_action', 'mars_arm_call(''set_results'',o,item,old_o)')); -MARS.ARMOIRE = o; - -% and workspace -if ~isfield(MARS, 'WORKSPACE'), MARS.WORKSPACE = []; end - -% read any necessary defaults -if ~mars_struct('isthere', MARS, 'OPTIONS') - loadf = 1; - MARS.OPTIONS = []; -else - loadf = 0; -end -[mbdefs sourcestr] = mars_options('Defaults'); -MARS.OPTIONS = mars_options('fill',MARS.OPTIONS, mbdefs); -mars_options('put'); -if loadf - fprintf('Loaded MarsBaR defaults from %s\n',sourcestr); -end - -% Add very very odd fix for maroi object path problem -% and matlab 7.1 (at least) -% Don't ask why this is needed - I don't know. -maroi; - -%======================================================================= -case 'off' %-Unload MarsBaR -%======================================================================= -% res = marsbar('Off') -%----------------------------------------------------------------------- -varargout = {0}; - -% leave if no signs of marsbar -if ~marsbar('is_started'), return, end - -% save outstanding information -btn = mars_arm('save_ui', 'all', struct('ync', 1, 'no_no_save', 1)); -if btn == -1, varargout = {-1}; return, end % cancel - -% remove marsbar added directories -rmpath(MARS.ADDPATHS{:}); -fprintf('MarsBaR analysis functions removed from path\n'); - -%======================================================================= -case 'quit' %-Quit MarsBaR window -%======================================================================= -% marsbar('Quit') -%----------------------------------------------------------------------- - -% do path stuff, save any pending changes -if marsbar('off') == -1, return, end % check for cancel - -% leave if no signs of MARSBAR -if ~marsbar('is_started'), return, end - -%-Close any existing 'MarsBaR' 'Tag'ged windows -delete(spm_figure('FindWin','MarsBaR')) -fprintf('Au revoir...\n\n') - -%======================================================================= -case 'is_started' %-returns 1 if MarsBaR GUI has been initialized -%======================================================================= -% tf = marsbar('is_started') -varargout = {~isempty(MARS)}; - -%======================================================================= -case 'cfgfile' %-finds MarsBaR cfg file -%======================================================================= -% cfgfn = marsbar('cfgfile') -cfgfile = 'marsbarcfg.mat'; -varargout = {which(cfgfile), cfgfile}; - -%======================================================================= -case 'createmenuwin' %-Draw MarsBaR menu window -%======================================================================= -% Fmenu = marsbar('CreateMenuWin',Vis) -if nargin<2, Vis='on'; else, Vis=varargin{2}; end - -%-Close any existing 'MarsBaR' 'Tag'ged windows -delete(spm_figure('FindWin','MarsBaR')) - -% Version etc info -[MBver,MBc] = marsbar('Ver'); - -%-Get size and scalings and create Menu window -%----------------------------------------------------------------------- -WS = spm('WinScale'); %-Window scaling factors -FS = spm('FontSizes'); %-Scaled font sizes -PF = spm_platform('fonts'); %-Font names (for this platform) -Rect = [50 600 300 275]; %-Raw size menu window rectangle -bno = 6; bgno = bno+1; -bgapr = 0.25; -bh = Rect(4) / (bno + bgno*bgapr); % Button height -gh = bh * bgapr; % Button gap -by = fliplr(cumsum([0 ones(1, bno-1)*(bh+gh)])+gh); -bx = Rect(3)*0.1; -bw = Rect(3)*0.8; -Fmenu = figure('IntegerHandle','off',... - 'Name',sprintf('%s',MBc),... - 'NumberTitle','off',... - 'Tag','MarsBaR',... - 'Position',Rect.*WS,... - 'Resize','off',... - 'Color',[1 1 1]*.8,... - 'UserData',struct('MBver',MBver,'MBc',MBc),... - 'MenuBar','none',... - 'DefaultTextFontName',PF.helvetica,... - 'DefaultTextFontSize',FS(12),... - 'DefaultUicontrolFontName',PF.helvetica,... - 'DefaultUicontrolFontSize',FS(12),... - 'DefaultUicontrolInterruptible','on',... - 'Renderer','painters',... - 'Visible','off'); - -%-Objects with Callbacks - main MarsBaR routines -%======================================================================= - -funcs = {'mars_display_roi(''display'');',... - 'mars_blob_ui;',... - 'marsbar(''buildroi'');',... - 'marsbar(''transform'');',... - 'marsbar(''import_rois'');',... - 'marsbar(''export_rois'');'}; - -uicontrol(Fmenu,'Style','PopUp',... - 'String',['ROI definition',... - '|View...'... - '|Get SPM cluster(s)...'... - '|Build...',... - '|Transform...',... - '|Import...',... - '|Export...'],... - 'Position',[bx by(1) bw bh].*WS,... - 'ToolTipString','Draw / build / combine ROIs...',... - 'CallBack','spm(''PopUpCB'',gcbo)',... - 'UserData',funcs); - -% Design menu -fw_st = 'struct(''force'', 1, ''warn_empty'', 1)'; -funcs = {... - 'marsbar(''make_design'', ''pet'');',... - 'marsbar(''make_design'', ''fmri'');',... - 'marsbar(''make_design'', ''basic'');',... - 'marsbar(''design_report'')',... - 'marsbar(''design_filter'')',... - 'marsbar(''add_images'')',... - 'marsbar(''edit_filter'')',... - 'marsbar(''check_images'')',... - 'marsbar(''list_images'')',... - 'marsbar(''ana_cd'')',... - 'marsbar(''ana_desmooth'')',... - 'marsbar(''def_from_est'')',... - 'marsbar(''set_def'')',... - ['mars_arm(''save_ui'', ''def_design'', ' fw_st ');'],... - 'mars_arm(''show_summary'', ''def_design'')'}; - -uicontrol(Fmenu,'Style','PopUp',... - 'String',['Design...'... - '|PET models',... - '|FMRI models',... - '|Basic models',... - '|Explore',... - '|Frequencies (event+data)',... - '|Add images to FMRI design',... - '|Add/edit filter for FMRI design',... - '|Check image names in design',... - '|List image names to console',... - '|Change design path to images',... - '|Convert to unsmoothed',... - '|Set design from estimated',... - '|Set design from file',... - '|Save design to file',... - '|Show default design summary'],... - 'Position',[bx by(2) bw bh].*WS,... - 'ToolTipString','Set/specify design...',... - 'CallBack','spm(''PopUpCB'',gcbo)',... - 'UserData',funcs); - -% Data menu -funcs = {'marsbar(''extract_data'', ''default'');',... - 'marsbar(''extract_data'', ''full'');',... - 'marsbar(''set_defregion'');',... - 'marsbar(''plot_data'', ''raw'');',... - 'marsbar(''plot_data'', ''full'');',... - 'marsbar(''import_data'');',... - 'marsbar(''export_data'');',... - 'marsbar(''split_data'');',... - 'marsbar(''join_data'');',... - 'mars_arm(''set_ui'', ''roi_data'');',... - ['mars_arm(''save_ui'', ''roi_data'', ' fw_st ');'],... - 'mars_arm(''show_summary'', ''roi_data'')'}; - -uicontrol(Fmenu,'Style','PopUp',... - 'String',['Data...'... - '|Extract ROI data (default)',... - '|Extract ROI data (full options)',... - '|Default region...',... - '|Plot data (simple)',... - '|Plot data (full)',... - '|Import data',... - '|Export data',... - '|Split regions into files',... - '|Merge data files',... - '|Set data from file',... - '|Save data to file',... - '|Show data summary'],... - 'Position',[bx by(3) bw bh].*WS,... - 'ToolTipString','Extract/set/save data...',... - 'CallBack','spm(''PopUpCB'',gcbo)',... - 'UserData',funcs); - -% results menu -funcs = {... - 'marsbar(''estimate'');',... - 'marsbar(''merge_contrasts'');',... - 'marsbar(''refresh_contrasts'');',... - 'marsbar(''add_trial_f'');',... - 'marsbar(''set_defcon'');',... - 'marsbar(''set_defregion'');',... - 'marsbar(''plot_residuals'');',... - 'marsbar(''spm_graph'');',... - 'marsbar(''stat_table'');',... - 'marsbar(''signal_change'');',... - 'marsbar(''fitted_events'');',... - 'marsbar(''fir_events'');',... - 'marsbar(''add_events_by_name'');',... - 'marsbar(''set_results'');',... - ['mars_arm(''save_ui'', ''est_design'', ' fw_st ');'],... - 'mars_arm(''show_summary'', ''est_design'')'}; - -uicontrol(Fmenu,'Style','PopUp',... - 'String',['Results...'... - '|Estimate results',... - '|Import contrasts',... - '|Refresh F contrasts',... - '|Add trial-specific F',... - '|Default contrast...',... - '|Default region...',... - '|Plot residuals',... - '|MarsBaR SPM graph',... - '|Statistic table',... - '|% signal change',... - '|Fitted event time course',... - '|FIR event time course',... - '|Add event types by name',... - '|Set results from file',... - '|Save results to file',... - '|Show estimated design summary'],... - 'Position',[bx by(4) bw bh].*WS,... - 'ToolTipString','Write/display contrasts...',... - 'CallBack','spm(''PopUpCB'',gcbo)',... - 'UserData',funcs); - -% options menu -funcs = {['global MARS; '... - 'MARS.OPTIONS=mars_options(''edit'');mars_options(''put'');'],... - ['global MARS; '... - '[MARS.OPTIONS str]=mars_options(''defaults'');' ... - 'mars_options(''put''); '... - 'fprintf(''Defaults loaded from %s\n'', str)'],... - ['global MARS; '... - '[MARS.OPTIONS str]=mars_options(''basedefaults'');' ... - 'mars_options(''put''); '... - 'fprintf(''Defaults loaded from %s\n'', str)'],... - ['global MARS; '... - 'MARS.OPTIONS=mars_options(''load'');mars_options(''put'');'],... - 'mars_options(''save'');'... - }; - -uicontrol(Fmenu,'Style','PopUp',... - 'String',['Options...'... - '|Edit options'... - '|Restore defaults'... - '|Base defaults',... - '|Set options from file'... - '|Save options to file'],... - 'Position',[bx by(5) bw bh].*WS,... - 'ToolTipString','Load/save/edit MarsBaR options',... - 'CallBack','spm(''PopUpCB'',gcbo)',... - 'UserData',funcs); - -% quit button -uicontrol(Fmenu,'String','Quit',... - 'Position',[bx by(6) bw bh].*WS,... - 'ToolTipString','exit MarsBaR',... - 'ForeGroundColor','r',... - 'Interruptible','off',... - 'CallBack','marsbar(''Quit'')'); - -% Set quit action if MarsBaR window is closed -%----------------------------------------------------------------------- -set(Fmenu,'CloseRequestFcn','marsbar(''Quit'')') -set(Fmenu,'Visible',Vis) - -varargout = {Fmenu}; - -%======================================================================= -case {'ver', 'version'} %-Return MarsBaR version -%======================================================================= -% [v [,banner]] = marsbar('Ver') -%----------------------------------------------------------------------- -varargout = {MBver, 'MarsBaR - Marseille ROI toolbox'}; - -%======================================================================= -case 'splash' %-show splash screen -%======================================================================= -% marsbar('splash') -%----------------------------------------------------------------------- -% Shows splash screen -WS = spm('WinScale'); %-Window scaling factors -[X,map] = imread('marsbar.jpg'); -aspct = size(X,1) / size(X,2); -ww = 400; -srect = [200 300 ww ww*aspct] .* WS; %-Scaled size splash rectangle -h = figure('visible','off',... - 'menubar','none',... - 'numbertitle','off',... - 'name','Welcome to MarsBaR',... - 'pos',srect); -im = image(X); -colormap(map); -ax = get(im, 'Parent'); -axis off; -axis image; -axis tight; -set(ax,'plotboxaspectratiomode','manual',... - 'unit','pixels',... - 'pos',[0 0 srect(3:4)]); -set(h,'visible','on'); -pause(2); -close(h); - -%======================================================================= -case 'buildroi' %-build and save ROI -%======================================================================= -% o = marsbar('buildroi') -%----------------------------------------------------------------------- -% build and save object -varargout = {[]}; -o = mars_build_roi; -if ~isempty(o) - varargout = {marsbar('saveroi', o)}; -end - -%======================================================================= -case 'transform' %-transform ROIs -%======================================================================= -% marsbar('transform') -%----------------------------------------------------------------------- -marsbar('mars_menu', 'Transform ROI', 'Transform:', ... - {{'combinerois'},{'flip_lr'}},... - {'Combine ROIs','Flip L/R'}); - -%======================================================================= -case 'import_rois' %- import ROIs! -%======================================================================= -% marsbar('import_rois') -%----------------------------------------------------------------------- - -marsbar('mars_menu', 'Import ROIs', 'Import ROIs from:',... - {{'img2rois','c'},... - {'img2rois','i'}},... - {'cluster image',... - 'number labelled ROI image'}); - -%======================================================================= -case 'export_rois' %-export ROIs -%======================================================================= -% marsbar('export_rois') -%----------------------------------------------------------------------- - -marsbar('mars_menu', 'Export ROI(s)', 'Export ROI(s) to:',... - {{'roi_as_image'},... - {'rois2img', 'c'},... - {'rois2img', 'i'}},... - {'image', 'cluster image',... - 'number labelled ROI image'}); - -%======================================================================= -case 'img2rois' %-import ROI image -%======================================================================= -% marsbar('img2rois', roi_type) -%----------------------------------------------------------------------- - -if nargin < 2 - roi_type = 'c'; % default is cluster image -else - roi_type = varargin{2}; -end -mars_img2rois('','','',roi_type); - -%======================================================================= -case 'rois2img' %-export ROI image -%======================================================================= -% marsbar('roi2img', roi_type) -%----------------------------------------------------------------------- - -if nargin < 2 - roi_type = 'c'; % default is cluster image -else - roi_type = varargin{2}; -end -mars_rois2img('','','',roi_type); - -%======================================================================= -case 'saveroi' %-save ROI -%======================================================================= -% o = marsbar('saveroi', obj, flags) -%----------------------------------------------------------------------- -% flags will usually be empty, or one or more characters from -% 'n' do not ask for label or description -% 'l' use label to make filename, rather than source field - -if nargin < 2 || isempty(varargin{2}) - return -end -if nargin < 3 - flags = ''; -else - flags = varargin{3}; -end -if isempty(flags), flags = ' '; end -o = varargin{2}; -varargout = {[]}; - -% Label, description -if ~any(flags=='n') - d = spm_input('Description of ROI', '+1', 's', descrip(o)); - o = descrip(o,d); - l = spm_input('Label for ROI', '+1', 's', label(o)); - o = label(o,l); -end - -fn = source(o); -if isempty(fn) || any(flags=='l') - fn = maroi('filename', mars_utils('str2fname', label(o))); -end - -f_f = ['*' maroi('classdata', 'fileend')]; -[f p] = mars_uifile('put', ... - {f_f, ['ROI files (' f_f ')']},... - 'File name for ROI', fn); -if any(f~=0) - roi_fname = maroi('filename', fullfile(p, f)); - try - varargout = {saveroi(o, roi_fname)}; - catch - warning([lasterr ' Error saving ROI to file ' roi_fname]) - end -end - -%======================================================================= -case 'combinerois' %-combine ROIs -%======================================================================= -% marsbar('combinerois') -%----------------------------------------------------------------------- -roilist = spm_get(Inf,['*' maroi('classdata', 'fileend')], ... - 'Select ROI(s) to combine'); -if isempty(roilist) - return -end -roilist = maroi('load_cell', roilist); -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Combine ROIs'); -spm_input('(r1 & r2) & ~r3',1,'d','Example function:'); -func = spm_input('Function to combine ROIs', '+1', 's', ''); -if isempty(func), retnrn, end -for i = 1:length(roilist) - eval(sprintf('r%d = roilist{%d};', i, i)); -end -try - eval(['o=' func ';']); -catch - warning(['Hmm, probem with function ' func ': ' lasterr]); - return -end -if isempty(o) - warning('Empty object resulted'); - return -end -if is_empty_roi(o) - warning('No volume resulted for ROI'); - return -end - -% save ROI -if isa(o, 'maroi') - o = label(o, func); - o = marsbar('saveroi', o); - if ~isempty(o) - fprintf('\nSaved ROI as %s\n', source(o)); - end -else - warning(sprintf('\nNo ROI resulted from function %s...\n', func)); -end - -%======================================================================= -case 'flip_lr' %-flip roi L<->R -%======================================================================= -% marsbar('flip_lr') -%----------------------------------------------------------------------- -roilist = spm_get([0 1],['*' maroi('classdata', 'fileend')],... - 'Select ROI to flip L/R'); -if isempty(roilist) - return -end -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Flip ROI L<->R'); -o = maroi('load', roilist); -o = flip_lr(o); - -% save ROI -o = marsbar('saveroi', o, 'l'); -fprintf('\nSaved ROI as %s\n', source(o)); - -%======================================================================= -case 'show_volume' %- shows ROI volume in mm to console -%======================================================================= -% marsbar('show_volume') -%----------------------------------------------------------------------- -roi_names = spm_get([0 Inf], '*roi.mat', 'Select ROIs tp get volume'); -if isempty(roi_names),return,end -rois = maroi('load_cell', roi_names); -for i = 1:size(rois, 1) - fprintf('Volume of %s: %6.2f\n', source(rois{i}), volume(rois{i})); -end -return - -%======================================================================= -case 'roi_as_image' %- writes ROI as image -%======================================================================= -% marsbar('roi_as_image') -%----------------------------------------------------------------------- -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Write ROI to image'); - -roi = spm_get([0 1], '*roi.mat', 'Select ROI to write'); -if isempty(roi),return,end -[pn fn ext] = fileparts(roi); -roi = maroi('load', roi); - -% space of object -spopts = {'spacebase','image'}; -splabs = {'Base space for ROIs','From image'}; -if has_space(roi) - spopts = {spopts{:} 'native'}; - splabs = {splabs{:} 'ROI native space'}; -end -spo = spm_input('Space for ROI image', '+1', 'm',splabs,... - spopts, 1); -switch char(spo) - case 'spacebase' - sp = maroi('classdata', 'spacebase'); - case 'image' - img = spm_get([0 1], mars_veropts('get_img_ext'), 'Image defining space'); - if isempty(img),return,end - sp = mars_space(img); - case 'native' - sp = []; -end - -% remove ROI file ending -gend = maroi('classdata', 'fileend'); -lg = length(gend); -f2 = [fn ext]; -if length(f2)>=lg && strcmp(gend, [f2(end - lg +1 : end)]) - f2 = f2(1:end-lg); -else - f2 = fn; -end - -fname = mars_utils('get_img_name', f2); -if isempty(fname), return, end -save_as_image(roi, fname, sp); -fprintf('Saved ROI as %s\n',fname); - -%======================================================================= -case 'attach_image' %- attaches image to ROI(s) -%======================================================================= -% marsbar('attach_image' [,img [,roilist]]) -%----------------------------------------------------------------------- -if nargin < 2 - V = spm_get([0 1], mars_veropts('get_img_ext'), 'Image to attach'); - if isempty(V), return, end -else - V = varargin{1}; -end -if nargin < 3 - rois = spm_get([0 Inf], ['*' maroi('classdata', 'fileend')], ... - 'Select ROIs to attach image to'); - - if isempty(rois), return, end -else - rois = varargin{2}; -end -if ischar(V), V = spm_vol(V); end -for i = 1:size(rois, 1) - n = deblank(rois(i,:)); - try - r = maroi('load', n); - catch - r = [] - if ~strmatch(lasterr, 'Cant map image file.') - error(lasterr); - end - end - if isempty(r) - continue - end - if ~isa(r, 'maroi_image') - fprintf('ROI %s is not an image ROI - ignored\n', n); - continue - end - - r = vol(r, V); - saveroi(r, n); - fprintf('Saved ROI %s, attached to image %s\n',... - n, V.fname) -end -return - -%======================================================================= -case 'make_design' %-runs design creation routines -%======================================================================= -% marsbar('make_design', des_type) -%----------------------------------------------------------------------- -if nargin < 2 - des_type = 'basic'; -else - des_type = varargin{2}; -end -if sf_prev_save('def_design') == -1, return, end -D = ui_build(mars_veropts('default_design'), des_type); -mars_arm('set', 'def_design', D); -marsbar('design_report'); - -%======================================================================= -case 'list_images' %-lists image files in SPM design -%======================================================================= -% marsbar('list_images') -%----------------------------------------------------------------------- -marsD = mars_arm('get', 'def_design'); -if isempty(marsD), return, end; -if has_images(marsD) - P = image_names(marsD); - strvcat(P{:}) -else - disp('Design does not contain images'); -end - -%======================================================================= -case 'check_images' %-checks image files in SPM design -%======================================================================= -% marsbar('check_images') -%----------------------------------------------------------------------- -marsD = mars_arm('get', 'def_design'); -if isempty(marsD), return, end; -if ~has_images(marsD) - disp('Design does not contain images'); - return -end - -P = image_names(marsD); -P = strvcat(P{:}); -ok_f = 1; -for i = 1:size(P, 1) - fname = deblank(P(i,:)); - if ~exist(fname, 'file'); - fprintf('Image %d: %s does not exist\n', i, fname); - ok_f = 0; - end -end -if ok_f - disp('All images in design appear to exist'); -end - -%======================================================================= -case 'ana_cd' %-changes path to files in SPM design -%======================================================================= -% marsbar('ana_cd') -%----------------------------------------------------------------------- -marsD = mars_arm('get', 'def_design'); -if isempty(marsD), return, end; - -% Setup input window -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Change image path in design', 0); - -% root path shown in output window -P = image_names(marsD); -P = strvcat(P{:}); -root_names = spm_str_manip(P, 'H'); -spm_input(deblank(root_names(1,:)),1,'d','Common path is:'); - -% new root -newpath = spm_get([-1 0], '', 'New directory root for files'); -if isempty(newpath), return, end - -% do -marsD = cd_images(marsD, newpath); -mars_arm('set', 'def_design', marsD); - -%======================================================================= -case 'ana_desmooth' %-makes new SPM design for unsmoothed data -%======================================================================= -% marsbar('ana_desmooth') -%----------------------------------------------------------------------- -marsD = mars_arm('get', 'def_design'); -if isempty(marsD), return, end; -marsD = prefix_images(marsD, 'remove', 's'); -mars_arm('set', 'def_design', marsD); -disp('Done'); - -%======================================================================= -case 'add_images' %-add images to FMRI design -%======================================================================= -% marsbar('add_images') -%----------------------------------------------------------------------- -marsD = mars_arm('get', 'def_design'); -if isempty(marsD), return, end -if ~is_fmri(marsD), return, end -marsD = fill(marsD, {'images'}); -mars_arm('update', 'def_design', marsD); -mars_arm('set_param', 'def_design', 'file_name', ''); -mars_arm('show_summary', 'def_design'); - -%======================================================================= -case 'edit_filter' %-add / edit filter for FMRI design -%======================================================================= -% marsbar('edit_filter') -%----------------------------------------------------------------------- -marsD = mars_arm('get', 'def_design'); -if isempty(marsD), return, end -if ~is_fmri(marsD), return, end -tmp = {'filter'}; -if ~strcmp(type(marsD), 'SPM99'), tmp = [tmp {'autocorr'}]; end -marsD = fill(marsD, tmp); -mars_arm('update', 'def_design', marsD); -mars_arm('set_param', 'def_design', 'file_name', ''); -mars_arm('show_summary', 'def_design'); - -%======================================================================= -case 'def_from_est' %-sets default design from estimated design -%======================================================================= -% marsbar('def_from_est') -%----------------------------------------------------------------------- -marsE = mars_arm('get', 'est_design'); -if isempty(marsE), return, end; -errf = mars_arm('set', 'def_design', marsE); -if ~errf, marsbar('design_report'); end - -%======================================================================= -case 'set_def' %-sets default design using GUI -%======================================================================= -% marsbar('set_def') -%----------------------------------------------------------------------- -if mars_arm('set_ui', 'def_design'), return, end -marsbar('design_report'); - -%======================================================================= -case 'design_report' %-does explore design thing -%======================================================================= -% marsbar('design_report') -%----------------------------------------------------------------------- -marsD = mars_arm('get', 'def_design'); -if isempty(marsD), return, end; -spm('FnUIsetup','Explore design', 0); - -fprintf('%-40s: ','Design reporting'); -ui_report(marsD, 'DesMtx'); -ui_report(marsD, 'DesRepUI'); -fprintf('%30s\n','...done'); - -%======================================================================= -case 'design_filter' %-shows FFT of data and design -%======================================================================= -% marsbar('design_filter') -%----------------------------------------------------------------------- -marsD = mars_arm('get', 'def_design'); -if isempty(marsD), return, end; -marsY = mars_arm('get', 'roi_data'); -if isempty(marsY), return, end -% If the design and data didn't match, the design will have been cleared -if mars_arm('isempty', 'def_design') - error('Need data and design with matching number of rows'); -end -ui_ft_design_data(marsD, marsY); - -%======================================================================= -case 'extract_data' % gets data maybe using design -%======================================================================= -% marsY = marsbar('extract_data'[, roi_list [, 'full'|'default']]); - -if nargin < 2 - etype = 'default'; -else - etype = varargin{2}; -end -if nargin < 3 - roi_list = ''; -else - roi_list = varargin{3}; -end - -varargout = {[]}; - -% Check for save of current data -if sf_prev_save('roi_data') == -1, return, end -if isempty(roi_list) - roi_list = spm_get(Inf,'*roi.mat','Select ROI(s) to extract data for'); -end -if isempty(roi_list), return, end - -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Extract data', 0); - -if strcmp(etype, 'default') - marsD = mars_arm('get', 'def_design'); - if isempty(marsD), return, end; - if ~has_images(marsD), - marsD = fill(marsD, 'images'); - mars_arm('update', 'def_design', marsD); - end - VY = marsD; - row = block_rows(marsD); -else % full options extraction - % question for design - - marsD = []; - if spm_input('Use SPM design?', '+1', 'b', 'Yes|No', [1 0], 1) - marsD = mars_arm('get', 'def_design'); - if ~has_images(marsD), - marsD = fill(marsD, 'images'); - mars_arm('update', 'def_design', marsD); - end - end - [VY row] = mars_image_scaling(marsD); -end - -% Summary function -sumfunc = sf_get_sumfunc(MARS.OPTIONS.statistics.sumfunc); - -% ROI names to objects -o = maroi('load_cell', roi_list); - -% Do data extraction -marsY = get_marsy(o{:}, VY, sumfunc, 'v'); -marsY = block_rows(marsY, row); -if ~n_regions(marsY) - msgbox('No data returned','Data extraction', 'warn'); - return -end - -% set into armoire, and display -mars_arm('set', 'roi_data', marsY); -mars_arm('show_summary', 'roi_data'); - -varargout = {marsY}; - -%======================================================================= -case 'plot_data' %- it plots data! -%======================================================================= -% marsbar('plot_data', p_type) -%----------------------------------------------------------------------- -% p_type - plot type: one of 'raw','acf','fft','all' or 'full' -% where 'full' results in a options to filter and choice of plot - -if nargin < 2 - p_type = []; -else - p_type = varargin{2}; -end -if isempty(p_type) - p_type = 'full'; -end -marsY = mars_arm('get', 'roi_data'); -if isempty(marsY), return, end - -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Plot data', 0); -if strcmp(p_type, 'full') - if ~mars_arm('isempty', 'def_design') - D = mars_arm('get', 'def_design'); - if isempty(D), return, end - if has_filter(D) - if spm_input('Use design filter?', '+1', 'y/n', [1 0], 1) - flags = {}; - if has_whitener(D) - if ~spm_input('Use whitening filter?', '+1', 'y/n', [1 0], 1) - flags = 'no_whitening'; - end - end - marsY = apply_filter(D, marsY, flags); - end - end - end - p_type = char(spm_input('Type of plot', '+1', 'm', ... - 'All|Time course|FFT|ACF', ... - {'all','raw','fft','acf'})); -end - -ns = region_name(marsY); -rno = mars_struct('getifthere', MARS, 'WORKSPACE', 'default_region'); -if ~isempty(rno) - fprintf('Using default region: %s\n', ns{rno}); -end -ui_plot(marsY, struct('types', p_type, 'r_nos', rno)); - -%======================================================================= -case 'import_data' %- it imports data -%======================================================================= -% marsbar('import_data') -%----------------------------------------------------------------------- - -% Check for save of current dataa -if sf_prev_save('roi_data') == -1, return, end - -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Import data', 0); - -r_f = spm_input('Import what?', '+1', 'm', ... - ['Sample time courses for one region'... - '|Summary time course(s) for region(s)'],... - [1 0], 2); - -Ls = ['Matlab workspace' ... - '|Text file',... - '|Lotus spreadsheet'];,... -Os = {'matlab','txt','wk1'}; - -if ~isempty(which('xlsread')) - Ls = [Ls '|Excel spreadsheet']; - Os = [Os {'xls'}]; -end - -src = spm_input('Import fron?', '+1', 'm', Ls, Os, 1); - -switch src{1} - case 'matlab' - Y = spm_input('Matlab expression', '+1', 'e'); - fn = 'Matlab input'; - pn_fn = lower(fn); - case 'txt' - [fn, pn] = mars_uifile('get', ... - {'*.txt;*.dat;*.csv', 'Text files (*.txt, *.dat, *.csv)'; ... - '*.*', 'All Files (*.*)'}, ... - 'Select a text file'); - if isequal(fn,0), return, end - pn_fn = fullfile(pn, fn); - Y = spm_load(pn_fn); - case 'wk1' - [fn, pn] = mars_uifile('get', ... - {'*.wk1', 'Lotus spreadsheet files (*.wk1)'; ... - '*.*', 'All Files (*.*)'}, ... - 'Select a Lotus file'); - if isequal(fn,0), return, end - pn_fn = fullfile(pn, fn); - Y = wk1read(pn_fn); - case 'xls' - [fn, pn] = mars_uifile('get', ... - {'*.xls', 'Excel spreadsheet files (*.xls)'; ... - '*.*', 'All Files (*.*)'}, ... - 'Select an Excel file'); - if isequal(fn,0), return, end - pn_fn = fullfile(pn, fn); - Y = xlsread(pn_fn); - otherwise - error('Strange source'); -end -if r_f % region data - s_f = sf_get_sumfunc(MARS.OPTIONS.statistics.sumfunc); - r_st = struct('name', fn,... - 'descrip', pn_fn); - s_st = struct('descrip', ['Region data loaded from ' pn_fn],... - 'sumfunc', s_f); - marsY = marsy({Y},r_st, s_st); - pref = ''; % Region name prefix not used, as names are set -else % summary data - s_st = struct('descrip', ['Summary data loaded from ' pn_fn]); - marsY = marsy(Y, '', s_st); - pref = spm_input('Prefix for region names', '+1', 's', [fn '_']); -end - -% Names -stop_f = 0; -ns = region_name(marsY, [], [], pref); -spm_input('Return name with spaces only to abort entry','+1','d'); -for r = 1:length(ns) - ns{r} = spm_input(... - sprintf('Name for region %d', r),... - '+1', 's', ns{r}); - if all(ns{r}==' '), stop_f = 1; break, end -end -if ~stop_f - marsY = region_name(marsY, [], ns); -end - -mars_arm('set', 'roi_data', marsY); -mars_arm('show_summary', 'roi_data'); -disp(['Data loaded from ' pn_fn]); - -%======================================================================= -case 'export_data' %- exports -%======================================================================= -% marsbar('export_data') -%----------------------------------------------------------------------- -marsY = mars_arm('get', 'roi_data'); -if isempty(marsY), return, end - -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Export data', 0); - -r_f = spm_input('Export what?', '+1', 'm', ... - ['Sample time courses for one region'... - '|Summary time course(s) for region(s)'],... - [1 0], 2); - -Ls = ['Matlab workspace' ... - '|Text file',... - '|Lotus spreadsheet'];,... -Os = {'matlab','txt','wk1'}; - -if ~isempty(which('xlswrite')) - xls_write = 1; -elseif ~isempty(which('xlswrite5')) - xls_write = 2; -else - xls_write = 0; -end - -if xls_write - Ls = [Ls '|Excel spreadsheet']; - Os = [Os {'xls'}]; -end - -src = spm_input('Export to?', '+1', 'm', Ls, Os, 1); - -if r_f - rno = marsbar('get_region', region_name(marsY)); - Y = region_data(marsY, rno); - Y = Y{1}; -else - Y = summary_data(marsY); -end - -switch src{1} - case 'matlab' - str = ''; - while ~mars_utils('is_valid_varname', str) - str = spm_input('Matlab variable name', '+1', 's'); - if isempty(str), return, end - end - assignin('base', str, Y); - fn = ['Matlab variable: ' str]; - case 'txt' - [fn, pn] = mars_uifile('put', ... - {'*.txt;*.dat;*.csv', 'Text files (*.txt, *.dat, *.csv)'; ... - '*.*', 'All Files (*.*)'}, ... - 'Text file name'); - if isequal(fn,0), return, end - save(fullfile(pn,fn), 'Y', '-ascii'); - case 'wk1' - [fn, pn] = mars_uifile('put', ... - {'*.wk1', 'Lotus spreadsheet files (*.wk1)'; ... - '*.*', 'All Files (*.*)'}, ... - 'Lotus spreadsheet file'); - if isequal(fn,0), return, end - wk1write(fullfile(pn,fn), Y); - case 'xls' - [fn, pn] = mars_uifile('put', ... - {'*.xls', 'Excel spreadsheet files (*.xls)'; ... - '*.*', 'All Files (*.*)'}, ... - 'Excel spreadsheet file'); - if isequal(fn,0), return, end - if xls_write == 1 - xlswrite(fullfile(pn,fn), Y); - else - xlswrite5(fullfile(pn,fn), Y); - end - otherwise - error('Strange source'); -end -disp(['Data saved to ' fn]); - -%======================================================================= -case 'split_data' %- splits data into one file per region -%======================================================================= -% marsbar('split_data') -%----------------------------------------------------------------------- -marsY = mars_arm('get', 'roi_data'); -if isempty(marsY), return, end -if n_regions(marsY) == 1 - disp('Only one region in ROI data'); - return -end - -% Setup input window -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Split regions to files', 0); - -d = spm_get([-1 0], '', 'New directory root for files'); -if isempty(d), return, end - -def_f = summary_descrip(marsY); -if ~isempty(def_f) - def_f = mars_utils('str2fname', def_f); -end -f = spm_input('Root filename for regions', '+1', 's', def_f); -f = mars_utils('str2fname', f); -mYarr = split(marsY); -for i = 1:length(mYarr) - fname = fullfile(d, sprintf('%s_region_%d_mdata.mat', f, i)); - savestruct(mYarr(i), fname); - fprintf('Saved region %d as %s\n', i, fname); -end - -%======================================================================= -case 'join_data' %- joins many data files into one object -%======================================================================= -% marsbar('join_data') -%----------------------------------------------------------------------- - -% Check save of current data first -if sf_prev_save('roi_data') == -1, return, end - -P = spm_get([0 Inf], '*_mdata.mat', 'Select data files to join'); - -if isempty(P), return, end -for i = 1:size(P,1) - d_o{i} = marsy(deblank(P(i,:))); -end -marsY = join(d_o{:}); -mars_arm('set', 'roi_data', marsY); -mars_arm('show_summary', 'roi_data'); -disp(P) -disp('Files merged and set as current data') - -%======================================================================= -case 'estimate' %-Estimates design -%======================================================================= -% marsbar('estimate') -%----------------------------------------------------------------------- -% Sequence is bit complex here, as setting the design may clear the ROI -% data, and setting the ROI data may clear the default design, if they -% have different numbers of rows -marsD= mars_arm('get', 'def_design'); -if isempty(marsD), return, end -marsY = mars_arm('get', 'roi_data'); -if isempty(marsY), return, end -if mars_arm('isempty', 'def_design') - error('Need design and data with matching number of rows'); -end -if sf_prev_save('est_design') == -1, return, end -if ~can_mars_estimate(marsD) - marsD = fill(marsD, 'for_estimation'); - mars_arm('update', 'def_design', marsD); -end -marsRes = estimate(marsD, marsY, struct(... - 'redo_covar', 1, 'redo_whitening', 1)); -mars_arm('set', 'est_design', marsRes); -mars_arm('show_summary', 'est_design'); - -%======================================================================= -case 'set_results' %-sets estimated design into global stucture -%======================================================================= -% donef = marsbar('set_results') -%----------------------------------------------------------------------- -% Set results, put results ROI data into roi_data container - -varargout = {0}; - -% Check if there's anything we don't want to write over -if sf_prev_save('est_design') == -1, return, end -if sf_prev_save('roi_data') == -1, return, end - -% Do set -mars_arm('set_ui', 'est_design'); -if mars_arm('isempty', 'est_design'), return, end - -% Get design, set ROI data -marsRes = mars_arm('get', 'est_design'); -mars_arm('set', 'roi_data', get_data(marsRes)); - -% Clear default contrast -if mars_struct('isthere', MARS, 'WORKSPACE', 'default_contrast') - MARS.WORKSPACE.default_contrast = []; - fprintf('Reset of estimated design, cleared default contrast...\n'); -end - -% Report on design -fprintf('%-40s: ','Design reporting'); -ui_report(marsRes, 'DesMtx'); -ui_report(marsRes, 'DesRepUI'); -fprintf('%30s\n','...done'); - -varargout = {1}; -return - -%======================================================================= -case 'plot_residuals' %-plots residuals from estimation -%======================================================================= -% marsbar('plot_residuals') -%----------------------------------------------------------------------- -marsRes = mars_arm('get', 'est_design'); -if isempty(marsRes), return, end -Y = residuals(marsRes); -ns = region_name(Y); -rno = mars_struct('getifthere', MARS, 'WORKSPACE', 'default_region'); -if ~isempty(rno) - fprintf('Using default region: %s\n', ns{rno}); -end -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Plot residuals', 1); -p_type = char(spm_input('Type of plot', '+1', 'm', ... - 'All|Time course|FFT|ACF', ... - {'all','raw','fft','acf'})); -ui_plot(Y, struct('types', p_type, 'r_nos', rno)); - -%======================================================================= -case 'set_defcon' %-set default contrast -%======================================================================= -% Ic = marsbar('set_defcon') -%----------------------------------------------------------------------- -varargout = {[]}; -marsRes = mars_arm('get', 'est_design'); -if isempty(marsRes), return, end - -% Setup input window -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Default contrast', 0); -Ic = mars_struct('getifthere',MARS, 'WORKSPACE', 'default_contrast'); -if isempty(Ic) - cname = '[Not set]'; -else - xCon = get_contrasts(marsRes); - cname = xCon(Ic).name; -end -spm_input(cname, 1, 'd', 'Default contrast'); -opts = {'Quit', 'Set new default'}; -if ~isempty(Ic), opts = [opts {'Clear default contrast'}]; end -switch spm_input('What to do?', '+1', 'm', opts, [1:length(opts)], 1); - case 1 - case 2 - [Ic marsRes changef] = ui_get_contrasts(marsRes, 'T|F',1,... - 'Select default contrast','',1); - if changef - mars_arm('update', 'est_design', marsRes); - end - case 3 - Ic = []; -end -MARS.WORKSPACE.default_contrast = Ic; -varargout = {Ic}; - -%======================================================================= -case 'set_defregion' %-set default region -%======================================================================= -% rno = marsbar('set_defregion') -%----------------------------------------------------------------------- -varargout = {[]}; -marsY = mars_arm('get', 'roi_data'); -if isempty(marsY), return, end -ns = region_name(marsY); -if length(ns) == 1 - disp('Only one region in data'); - MARS.WORKSPACE.default_region = 1; - varargout = {1}; - return -end - -% Setup input window -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Default region', 0); -rno = mars_struct('getifthere',MARS, 'WORKSPACE', 'default_region'); -if isempty(rno), rname = '[Not set]'; else rname = ns{rno}; end -spm_input(rname, 1, 'd', 'Default region:'); -opts = {'Quit', 'Set new default'}; -if ~isempty(rno), opts = [opts {'Clear default region'}]; end -switch spm_input('What to do?', '+1', 'm', opts, [1:length(opts)], 1); - case 1 - case 2 - rno = marsbar('get_region', ns); - disp(['Default region set to: ' ns{rno}]); - case 3 - rno = []; -end -MARS.WORKSPACE.default_region = rno; -varargout = {rno}; - -%======================================================================= -case 'get_region' %-ui to select region -%======================================================================= -% select region from list box / input -% rno = marsbar('get_region', names, prompt) -% names is cell array of strings identifying regions -% prompt is prompt string -%----------------------------------------------------------------------- - -if nargin < 2 - error('Need region names to select from'); -else - names = varargin{2}; -end -if nargin < 3 - prompt = 'Select region'; -else - prompt = varargin{3}; -end - -% maximum no of items in list box -maxlist = 200; -if length(names) > maxlist - % text input, maybe - error('Too many regions'); -end -if length(names) == 1 - rno = 1; -elseif isempty(names) - rno = [] -else - % listbox - rno = spm_input(prompt, '+1', 'm', names); -end -varargout = {rno}; - -%======================================================================= -case 'spm_graph' %-run spm_graph -%======================================================================= -% marsbar('spm_graph') -%----------------------------------------------------------------------- -marsRes = mars_arm('get', 'est_design'); -if isempty(marsRes), return, end - -% Setup input window -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Mars SPM graph', 1); - -ns = region_name(get_data(marsRes)); -rno = mars_struct('getifthere', MARS, 'WORKSPACE', 'default_region'); -if ~isempty(rno) - fprintf('Using default region: %s\n', ns{rno}); -else - rno = marsbar('get_region', ns, 'Select region to plot'); -end - -Ic = mars_struct('getifthere', MARS, 'WORKSPACE', 'default_contrast'); -if ~isempty(Ic) - xCon = get_contrasts(marsRes); - fprintf('Using default contrast: %s\n', xCon(Ic).name); -end - -% Variables returned in field names to allow differences -% in return variables between versions of spm_graph -[r_st marsRes changef] = mars_spm_graph(marsRes, rno, Ic); - -% Dump field names to global workspace as variables -fns = fieldnames(r_st); -for f = 1:length(fns) - assignin('base', fns{f}, getfield(r_st, fns{f})); -end - -% Store if changed -if changef - mars_arm('update', 'est_design', marsRes); -end - -%======================================================================= -case 'stat_table' %-run stat_table -%======================================================================= -% marsbar('stat_table') -%----------------------------------------------------------------------- -marsRes = mars_arm('get', 'est_design'); -if isempty(marsRes), return, end -Ic = mars_struct('getifthere', MARS, 'WORKSPACE', 'default_contrast'); -if ~isempty(Ic) - xCon = get_contrasts(marsRes); - fprintf('Using default contrast: %s\n', xCon(Ic).name); -end -[strs marsS marsRes changef] = ... - stat_table(marsRes, Ic); -disp(char(strs)); -assignin('base', 'marsS', marsS); -if changef - mars_arm('update', 'est_design', marsRes); -end - -%======================================================================= -case 'signal_change' % percent signal change -%======================================================================= -% marsbar('signal_change') -%----------------------------------------------------------------------- -marsRes = mars_arm('get', 'est_design'); -if isempty(marsRes), return, end -if ~is_fmri(marsRes) - fprintf('Need FMRI design for %% signal change\n'); - return -end - -% Setup input window -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Percent signal change', 0); - -[marsRes ic status] = ui_event_types(marsRes); -if (status==0), return, end -if (status>1), mars_arm('update', 'est_design', marsRes); end -if isempty(ic), return, end - -dur = spm_input('Event duration', '+1', 'e', 0); - -% Choose event difference function -diff_func = mars_struct('getifthere', MARS, 'OPTIONS', ... - 'events', 'diff_func'); -if isempty(diff_func), diff_func = 'max abs'; -elseif strcmp(diff_func, 'window') - spm_input('Event signal change window...', '+1','d', mfilename); - times = spm_input('Mean signal between times', ... - '+1', 'r', [4 6], 2, [0 dur+32]); - other_args = {times, bf_dt(marsRes)}; -else - other_args = {}; -end - -ic_len = length(ic); -et = event_types(marsRes); -for i = 1:ic_len - pc(i,:) = event_signal(marsRes, et(ic(i)).e_spec, dur, ... - diff_func, ... - other_args{:}); -end -rns = region_name(get_data(marsRes)); -disp('Sort-of % signal change'); -disp(sprintf('Duration: %3.2f seconds', dur)); -for i = 1:ic_len - disp(['Event: ' et(ic(i)).name]); - for r = 1:length(rns) - disp(sprintf('Region: %40s; %5.3f', rns{r}, pc(i, r))); - end -end -assignin('base', 'pc', pc); - -%======================================================================= -case 'fitted_events' % show fitted event time courses -%======================================================================= -% marsbar('fitted_events') -%----------------------------------------------------------------------- -marsRes = mars_arm('get', 'est_design'); -if isempty(marsRes), return, end -if ~is_fmri(marsRes) - fprintf('Need FMRI design for fitted event time courses\n'); - return -end - -% Setup input window -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Fitted events', 1); - -[marsRes ic status] = ui_event_types(marsRes); -if (status==0), return, end -if (status>1), mars_arm('update', 'est_design', marsRes); end -if isempty(ic), return, end - -dur = spm_input('Event duration', '+1', 'e', 0); -ic_len = length(ic); -et = event_types(marsRes); -for i = 1:ic_len - [tc{i} dt] = event_fitted(marsRes, et(ic(i)).e_spec, dur); -end - -if ic_len > 8 - warning('Too many event types to plot, plotting first 8'); - ic_len = 8; -end - -figure(Fgraph); -if ic_len > 1, p_cols = 2; else p_cols = 1; end -p_rows = ceil(ic_len / p_cols); -last_row_starts = (p_rows-1) * p_cols + 1; -for i = 1:ic_len - t = tc{i}; - secs = ([1:size(t, 1)]-1) * dt; - subplot(p_rows, p_cols, i); - plot(secs, t); - title(et(ic(i)).name); - if i >= last_row_starts, xlabel('Seconds'); end - if rem(i-1, p_cols)==0, ylabel('Signal change'); end -end - -legend(region_name(get_data(marsRes))); - -assignin('base', 'time_courses', tc); -assignin('base', 'dt', dt); - -%======================================================================= -case 'fir_events' % show FIR for events -%======================================================================= -% marsbar('fir_events') -%----------------------------------------------------------------------- -marsRes = mars_arm('get', 'est_design'); -if isempty(marsRes), return, end -if ~is_fmri(marsRes) - fprintf('Need FMRI design for FIR event time courses\n'); - return -end - -% Setup input window -[Finter,Fgraph,CmdLine] = spm('FnUIsetup','FIR for events', 1); - -[marsRes ic status] = ui_event_types(marsRes); -if (status==0), return, end -if (status>1), mars_arm('update', 'est_design', marsRes); end -if isempty(ic), return, end - -et = event_types(marsRes); -ic_len = length(ic); - -% Single or stacked? -% If all the events have zero duration, the model is already single, and -% there is no point in asking. If any of the durations are different -% across events, then the single model is invalid. -d_a = []; opts = []; -for i = 1:ic_len - e_spec = et(ic(i)).e_spec; - for j = 1:size(e_spec, 2) - [o d] = event_onsets(marsRes, e_spec(:, j)); - d_a = [d_a; d]; - end -end -if any(d_a) && ~any(diff(d_a)) - if spm_input('FIR type', '+1','m',... - 'Single|Stacked', [1 0], 1) - opts.single = 1; - end -end -if spm_input('Signal units', '+1','m',... - 'Percent|Beta units', [1 0], 1) - opts.percent = 1; -end - -bin_length = spm_input('Bin length (secs)', '+1', 'e', tr(marsRes)); -def_bin_no = round(25/bin_length); -bin_no = spm_input('No of bins', '+1', 'e', def_bin_no); - -for i = 1:ic_len - tc{i} = event_fitted_fir(marsRes, ... - et(ic(i)).e_spec, ... - bin_length, ... - bin_no, ... - opts); -end - -if ic_len > 8 - warning('Too many event types to plot, plotting first 8'); - ic_len = 8; -end - -figure(Fgraph); -if ic_len > 1, p_cols = 2; else p_cols = 1; end -p_rows = ceil(ic_len / p_cols); -last_row_starts = (p_rows-1) * p_cols + 1; -secs = ([1:bin_no]-1) * bin_length + bin_length/2; -for i = 1:ic_len - t = tc{i}; - subplot(p_rows, p_cols, i); - plot(secs, t); - title(et(ic(i)).name); - if i >= last_row_starts, xlabel('Seconds'); end - if rem(i-1, p_cols)==0, ylabel('Signal change'); end -end -legend(region_name(get_data(marsRes))); - -assignin('base', 'time_courses', tc); -assignin('base', 'bin_length', bin_length); -assignin('base', 'bin_no', bin_no); - -%======================================================================= -case 'add_events_by_name' %-make event types from events with same name -%======================================================================= -% marsbar(''add_events_by_name') -%----------------------------------------------------------------------- -D = mars_arm('get', 'est_design'); -if isempty(D), return, end -if ~is_fmri(D) - disp('Can only add event types to FMRI designs'); - return -end -et = event_types(D); -et = [et event_types_named(D)]; -D = event_types(D, et); -mars_arm('update', 'est_design', D); - -%======================================================================= -case 'merge_contrasts' %-import contrasts -%======================================================================= -% marsbar('merge_contrasts') -%----------------------------------------------------------------------- -D = mars_arm('get', 'est_design'); -if isempty(D), return, end -filter_spec = {... - 'SPM.mat','SPM: SPM.mat';... - '*_mres.mat','MarsBaR: *_mres.mat';... - '*x?on.mat','xCon.mat file'}; -[fn pn] = mars_uifile('get', ... - filter_spec, ... - 'Source design/contrast file...'); -if isequal(fn,0) || isequal(pn,0), return, end -fname = fullfile(pn, fn); -D2 = mardo(fname); - -% has this got contrasts? -if ~has_contrasts(D2) - error(['Cannot find contrasts in design/contrast file ' fname]); -end - -% now try to trap case of contrast only file -if ~is_valid(D2) - D2 = get_contrasts(D2); -end - -[D Ic changef] = add_contrasts(D, D2, 'ui'); -disp('Done'); -if changef - mars_arm('update', 'est_design', D); -end - -%======================================================================= -case 'refresh_contrasts' %-refresh contrasts -%======================================================================= -% marsbar('refresh_contrasts') -%----------------------------------------------------------------------- -D = mars_arm('get', 'est_design'); -if isempty(D), return, end -D = refresh_contrasts(D); -disp('Refreshed contrasts'); -mars_arm('update', 'est_design', D); - -%======================================================================= -case 'add_trial_f' %-add trial-specific F contrasts to design -%======================================================================= -% marsbar('add_trial_f') -%----------------------------------------------------------------------- -D = mars_arm('get', 'est_design'); -if isempty(D), return, end -if ~is_fmri(D) - disp('Can only add trial specific F contrasts for FMRI designs'); - return -end -[D changef] = add_trial_f(D); -disp('Done'); -if changef - mars_arm('update', 'est_design', D); -end - -%======================================================================= -case 'error_log' %- makes file to help debugging errors -%======================================================================= -% fname = marsbar('error_log', fname); -%----------------------------------------------------------------------- -if nargin < 2 - fname = 'error_log.mat'; -else - fname = varargin{2}; -end - -e_log = struct('last_error', lasterr, ... - 'm_ver', marsbar('ver'),... - 'mars', MARS); -savestruct(fname, e_log); -if ~isempty(which('zip')) - zip([fname '.zip'], fname); - fname = [fname '.zip']; -end -disp(['Saved error log as ' fname]); - -%======================================================================= -case 'mars_menu' %-menu selection of marsbar actions -%======================================================================= -% marsbar('mars_menu',tstr,pstr,tasks_str,tasks) -%----------------------------------------------------------------------- - -[tstr pstr optfields optlabs] = deal(varargin{2:5}); -if nargin < 6 - optargs = cell(1, length(optfields)); -else - optargs = varargin{6}; -end - -[Finter,Fgraph,CmdLine] = spm('FnUIsetup',tstr); -of_end = length(optfields)+1; -my_task = spm_input(pstr, '+1', 'm',... - {optlabs{:} 'Quit'},... - [1:of_end],of_end); -if my_task == of_end, return, end -marsbar(optfields{my_task}{:}); - -%======================================================================= -otherwise %-Unknown action string -%======================================================================= -error('Unknown action string') - -%======================================================================= -end -return - -% subfunctions -function sum_func = sf_get_sumfunc(sum_func) -if strcmp(sum_func, 'ask') - sum_func = char(spm_input('Summary function', '+1','m',... - 'Mean|Weighted mean|Median|1st eigenvector',... - {'mean','wtmean','median','eigen1'}, 1)); -end - -function btn = sf_prev_save(obj_name) -btn = mars_arm('save_ui', obj_name, ... - struct('ync', 1, ... - 'no_no_save', 1, ... - 'prompt_prefix', 'previous ')); -% If answer is 'No', then flag that we don't need to save -if btn == 0 - mars_arm('set_param', obj_name, 'has_changed', 0); -end -return diff --git a/lib/marsbar-0.44/release/make_contents.m b/lib/marsbar-0.44/release/make_contents.m deleted file mode 100644 index 3136f39..0000000 --- a/lib/marsbar-0.44/release/make_contents.m +++ /dev/null @@ -1,186 +0,0 @@ -function make_contents(aString, flags, start_dir) -% MAKECONTENTS makes Contents file, usually in current working directory. -% MAKECONTENTS(STRING [FLAGS [START_DIR]]) -% creates a standard "Contents.m" file in the -% current directory by assembling the first comment (H1) line in -% each function found in the current working directory. If a -% "Contents.m" file exists, it is renamed to "Contents.old", before -% a new "Contents.m" file is created. STRING is inserted as the -% first line of the "Contents.m" file; if omitted, a blank line -% is inserted instead. The function changes permission on the -% resultant "Contents.m" file to rw-r--r-- on Unix systems. -% -% FLAGS can contain none or more of -% 'n' - suppress path name at top of Contents file -% 'f' - include first word of first line (excluded by default) -% 'c' - use filename 'contents.m' instead of 'Contents.m' -% 'r' - recursively list subdirectory contents also -% 'i' - include starting directory from file name path list -% 'p' - save contents file in current rather than listed directory -% 'd' - don't make backup of old contents file -% -% START_DIR can be omitted, giving a listing of current working -% directory, or it can specify the directory to list -% -% Updated 29 June 2000. -% Revised to recurse down directories, handle options by -% Matthew Brett; 28 June 2003 -% -% See also CONTENTS. -% -% $Id$ - -% Author(s): L. Bertuccioli -% A. Prasad - -% Based on mkcontents.m by Denis Gilbert - -% Default value of input string -if nargin < 1, - aString =' '; -end -if nargin < 2 - flags = ''; -end -if isempty(flags) - flags = ' '; -end -if nargin < 3 - start_dir = ''; -end -if isempty(start_dir) - start_dir = pwd; -end - -% parse flags -if any(flags == 'c') - cont_file = 'contents.m'; -else - cont_file = 'Contents.m'; -end -if any(flags == 'p') - cont_dir = pwd; -else - cont_dir = start_dir; -end -disp(['Creating "' cont_file '" in ' cont_dir]) -cont_path = fullfile(cont_dir, cont_file); -if ~any(flags == 'd') - if exist(cont_path, 'file') - copyfile(cont_path, ... - fullfile(cont_dir, [cont_file(1:end-1) 'old'])); - delete(cont_path) - end -end - -% Header lines -line1 = ['% ' aString]; -fcontents = fopen(cont_path,'wt'); -if fcontents == -1 - error(['Could not open file: ' cont_path]); -end -fprintf(fcontents,'%s\n',line1); -if ~any(flags == 'n') - line2 = ['% Path -> ' start_dir]; - fprintf(fcontents,'%s\n',line2); -end - -% set first past flag -flags = [flags '1']; - -% do write -do_list(start_dir, fcontents, flags); -fclose(fcontents); - -% Change permissions on Contents.m file -% only valid for Unix systems, no effect in Win32 systems -if isunix - unix(['chmod go+r ' cont_path]); -end -return - -function do_list(dirname, fcontents, flags) -persistent START_DIR ST_D_LEN; -if any(flags == '1') % first pass through - START_DIR = dirname; - ST_D_LEN = length(dirname) + 2; -end - -if any(flags == 'r') - % find directories - dirlist = dir(dirname); - dirnames = {dirlist([dirlist.isdir]).name}; - dirnames = dirnames(~(strcmp('.', dirnames) | strcmp('..', dirnames))); -else - dirnames = {}; -end - -% find m files -files = what(dirname); - -% fix apparent bug in what function -files = files(1); - -% exclude any contents files -files.m = files.m(logical(~strcmpi(files.m,'contents.m'))); -if length(files.m)==0 - warning(['No m-files found in directory ' dirname]) - return -end -fprintf(fcontents,'%%\n'); - -% maybe exclude starting path from listing -if ~any(flags == 'i') - dirlab = dirname(ST_D_LEN:end); - if ~any(flags == '1') % not first pass - dirlab = [dirlab filesep]; - end -else % not excluding starting directory - dirlab = [dirname filesep]; -end - -maxlen = size(char(files.m),2) + length(dirlab); - -% Write first lines to Contents.m if they exist -for i = 1:length(files.m) - fname = fullfile(files.path, files.m{i}); - fid=fopen(fname, 'rt'); - if fid == -1, error(['Error opening file: ' fname]); end - aLine = ''; - while(isempty(aLine) | length(aLine) < 8) - aLine = fgetl(fid); - end - if strcmp(aLine(1:8),'function'), - count_percent = 0; - while count_percent < 1 & feof(fid)==0; - line = fgetl(fid); - if length(line) > 0 - if ~isempty(findstr(line,'%')) - count_percent = count_percent + 1; - rr=line(2:length(line)); - if ~any(flags == 'f') % remove first word - [tt,rr]=strtok(line(2:length(line))); - end - rr = fliplr(deblank(fliplr(rr))); - fn = [dirlab strtok(char(files.m(i)),'.')]; - n = maxlen - length(fn) - 1; - line = ['% ' fn blanks(n) '- ' rr]; - fprintf(fcontents,'%s\n',line); - end % if ~isempty - end % if length - if feof(fid)==1 - fn = [dirlab strtok(char(files.m(i)),'.')]; - n = maxlen - length(fn) - 1; - line = ['% ' fn blanks(n) '- (No help available)']; - fprintf(fcontents,'%s\n',line); - end % if feof - end % while - end % if strcmp - fclose(fid); -end -% recurse down directory tree -flags = flags(flags ~= '1'); % reset first pass flag -for d = 1:length(dirnames) - do_list(fullfile(dirname, dirnames{d}), fcontents, flags); -end -return diff --git a/lib/marsbar-0.44/release/pre_release.m b/lib/marsbar-0.44/release/pre_release.m deleted file mode 100644 index 4824796..0000000 --- a/lib/marsbar-0.44/release/pre_release.m +++ /dev/null @@ -1,62 +0,0 @@ -function pre_release(rname, outdir, proj, proj_descrip, proj_url) -% Runs pre-release export, cleanup -% FORMAT pre_release(rname, outdir, proj, proj_descrip) -% -% Inputs [defaults] -% rname - string to define release version ['-%s'] -% outdir - directory to output release to [pwd] -% proj - project name (and name of main project file) ['marsbar'] -% proj_descrip - short description of project ['MarsBaR ROI toolbox'] -% proj_url - URL from which to clone project -% ['git://github.com/matthew-brett/marsbar.git'] -% -% e.g. pre_release('-devel-%s', '/tmp') -% would output a release called marsbar-devel-0.34.tar.gz (if the marsbar -% version string is '0.34') to the /tmp directory - -if nargin < 1 - rname = ''; -end -if isempty(rname) - rname = '-%s'; -end -if nargin < 2 - outdir = ''; -end -if isempty(outdir) - outdir = pwd; -end -if nargin < 3 - proj = 'marsbar'; -end -if nargin < 4 - proj_descrip = 'MarsBaR ROI toolbox'; -end -if nargin < 5 - proj_url = 'git://github.com/matthew-brett/marsbar.git'; -end - -% project version -V = eval([proj '(''ver'')']); -rname = sprintf(rname, V); - -% Clone from git -cmd = sprintf('git clone %s %s', proj_url, proj); -unix(cmd); - -% make contents file -contents_str = sprintf('Contents of %s version %s', proj_descrip, V); -make_contents(contents_str, 'fncrd', fullfile(pwd, proj, proj)); - -% move directory -full_name = sprintf('%s%s', proj, rname); -unix(sprintf('mv %s/%s %s', proj, proj, full_name)); -% Make archives -unix(sprintf('tar zcvf %s.tar.gz %s', full_name, full_name)); -unix(sprintf('zip -r %s.zip %s', full_name, full_name)); -% Remove traces of checkout -unix(sprintf('rm -rf %s', full_name)); -unix(sprintf('rm -rf %s', proj)); - -fprintf('Created %s release %s\n', proj, full_name); -fprintf('Consider Changelog, e.g git log --pretty=%%s --first-parent\n'); diff --git a/lib/marsbar-0.44/release/test_rig.m b/lib/marsbar-0.44/release/test_rig.m deleted file mode 100644 index 6c3d7e3..0000000 --- a/lib/marsbar-0.44/release/test_rig.m +++ /dev/null @@ -1,123 +0,0 @@ -function res = test_rig(design_paths, params) -% runs tests on MarsBaR using specified designs -% FORMAT res = test(design_paths, params) -% -% Inputs -% design_paths - path(s) to SPM design files -% params - structure giving params to pass to estimate method, -% see help for do_estimate methods for details -% Default is -% params = struct('redo_covar', 0, ... -% 'redo_whitening', 0); -% -% Outputs -% res - 1 if all tests passed, 0 otherwise -% -% The function depends on the SPM design having estimated contrasts to -% play with. It uses these to: -% Get the maximum voxel in the first F and first T contrast -% Records the T/F statistic value -% Makes an ROI out of this voxel -% Estimates in MarsBaR -% Checks the statistic value is that same. -% -% Along the way, it uses much of the MarsBaR machinery -% -% $Id$ - -if nargin < 1 - design_paths = spm_get([0 Inf], 'SPM*.mat', 'Select SPM designs'); -end -if nargin < 2 - params = struct('redo_covar', 0, ... - 'redo_whitening', 0); -end - -n_designs = size(design_paths, 1); -res = zeros(n_designs, 1); -for d = 1:n_designs - d_path = deblank(design_paths(d,:)); - res(d) = sf_test_design(d_path, params); -end -return - -function res = sf_test_design(d_path, params) -% tests one design - -% Check for SPM estimated design, with estimated contrasts -D = mardo(d_path); -if ~is_spm_estimated(D) - error('Need an SPM estimated design'); -end -if ~has_contrasts(D) - error(['Design ' d_path ' does not contain contrasts']); -end -if ~has_images(D) - error(['Design ' d_path ' does not contain images']); -end - -% try to get one F and one T contrast -Swd = fileparts(d_path); -xCon = get_contrasts(D); -stats = [xCon(:).STAT]; -Ic = []; fnames = {}; -for t = 'TF' - for c = fliplr(find(stats == t)) - F = xCon(c).Vspm; - if ~isempty(F) - % SPM99 = filename, SPM2 = vol_struct - if isstruct(F), F = F.fname; end - % SPM5 has full paths for the contrast images - con_pth = fileparts(F); - if isempty(con_pth) - F = fullfile(Swd, F); - end - if exist(F, 'file'), Ic = [Ic c]; fnames{end+1} = F; break, end - end - end -end -if isempty(Ic) - error(['Could not find any contrast images for ' d_path]); -end - -% find maximum voxel coordinate for contrasts and test -res = 1; -for c = 1:length(Ic) - V = spm_vol(fnames{c}); - img = spm_read_vols(V); - [mx(c) i] = max(img(:)); - xyz(:, c) = mars_utils('e2xyz', i, V.dim(1:3)); - mx_roi(c) = maroi_pointlist(struct('XYZ', xyz(:, c), ... - 'mat', V.mat), 'vox'); - Y = get_marsy(mx_roi(c), D, 'mean'); - E = estimate(D, Y, params); - [E n_Ic] = add_contrasts(E, D, Ic(c)); - marsS = compute_contrasts(E, n_Ic); - fprintf('SPM statistic %7.4f; MarsBaR statistic %7.4f\n',... - mx(c), marsS.stat(1)); - st_spm = mx(c); - st_mars = marsS.stat(1); - bad_test = abs(st_mars - st_spm) > 1e-5; - if bad_test % Statistics are different - SPM8 fudge? - spmV = lower(mars_utils('spm_version')); - if any(strcmp(spmV, {'spm8', 'spm12b', 'spm12'})) - xCon = get_contrasts(E); - this_con = xCon(n_Ic); - if this_con.STAT == 'T' & (st_mars > st_spm) - % Probably the fudge factor - fudge = (st_mars / st_spm - 1) / exp(-8); - fprintf('Fudge value was %f\n', fudge); - % fudge should now be max SE across all voxels in the - % estimation block (e.g. slice) / SE for this voxel - if fudge < 10 - bad_test = 0; - end - end - end - end - if bad_test - disp('MarsBaR gives a different result for contrast'); - res = 0; - end -end -return diff --git a/lib/marsbar-0.44/savestruct.m b/lib/marsbar-0.44/savestruct.m deleted file mode 100644 index 45019b5..0000000 --- a/lib/marsbar-0.44/savestruct.m +++ /dev/null @@ -1,21 +0,0 @@ -function savestruct(varargin) -% saves data in structure as variables in .mat file -% FORMAT savestruct(matname, struct) or -% FORMAT savestruct(struct, matname) -% -% $Id$ - -if nargin ~= 2 - error('Need matfile name and structure (only)'); -end -if isstruct(varargin{1}), varargin = varargin([2 1]); end -varargin{3} = fieldnames(varargin{2}); -if any(ismember(varargin{3}, {'wombat_tongue'})) - error('Whoops, unexpected use of wombat_tongue'); -end -for wombat_tongue = 1:length(varargin{3}) - eval([varargin{3}{wombat_tongue} ' = varargin{2}.' varargin{3}{wombat_tongue} ... - ';']); -end -save(varargin{1}, varargin{3}{:}); -return diff --git a/lib/marsbar-0.44/spm2/mars_blob_ui.m b/lib/marsbar-0.44/spm2/mars_blob_ui.m deleted file mode 100644 index c52fa09..0000000 --- a/lib/marsbar-0.44/spm2/mars_blob_ui.m +++ /dev/null @@ -1,49 +0,0 @@ -function mars_blob_ui(action) -% Displays SPM results, and ROI menu in SPM input window -% FORMAT mars_blob_ui(action) -% -% This is the SPM2 version -% -% action - action string; can be -% 'init' - initialise results interface -% 'save_one' - UI to save current cluster -% 'save_many' - UI to save all clusters -% -% This routine does SPM version specific stuff, the main -% work is in mars_blob2roi.m and mars_blobs2rois.m -% -% $Id$ - -if nargin < 1 - action = 'init'; -end - -errstr = sprintf(['''Cannot find xSPM struct in the workspace; '... - 'Please (re)run SPM results GUI''']); - -switch lower(action) - case 'init' - try % and find valid SPM results stuff - evalin('base', 'xSPM;'); - hReg = evalin('base', 'hReg;'); - spm_XYZreg('CleanReg',hReg); - mars_blob_menu; - catch % give up and get a new one - mars_blob_ui('reinit'); - end - case 'reinit' - % Display SPM results - evalin('base', '[hReg,xSPM,SPM] = spm_results_ui;'); - % Menu - mars_blob_menu; - case 'save_one' - xSPM = evalin('base', 'xSPM', ['error(' errstr ')']); - %-Get current location - pt = spm_results_ui('GetCoords'); - mars_blob2roi(xSPM, pt); - case 'save_many' - xSPM = evalin('base', 'xSPM', ['error(' errstr ')']); - mars_blobs2rois(xSPM); - otherwise - error(['Worried by request for ' action]); -end diff --git a/lib/marsbar-0.44/spm2/mars_veropts.m b/lib/marsbar-0.44/spm2/mars_veropts.m deleted file mode 100644 index c1e8923..0000000 --- a/lib/marsbar-0.44/spm2/mars_veropts.m +++ /dev/null @@ -1,41 +0,0 @@ -function varargout = mars_veropts(arg, varargin) -% returns SPM version specific parameters -% FORMAT varargout = mars_veropts(arg, varargin) -% -% This is the SPM 2 version -% -% $Id$ - -if nargin < 1 - varargout = {}; - return -end - -switch lower(arg) - case 'defaults' - global defaults - if isempty(defaults) - spm_defaults; - spm('defaults','FMRI'); - end - varargout = {defaults}; - case 'default_design' - varargout = {mardo_2}; - case 'template_ext' % extension for template images - varargout = {'.mnc'}; - case 'get_img_ext' % default image extension for spm_get - varargout = {'IMAGE'}; - case 'pref_img_out_ext' % preferred extension for writing images - varargout = {'img'}; - case 'des_conf' % filter for configured, not estimated SPM designs - varargout = {'SPM.mat'}; - case 'flip_option' - varargout = {spm_flip_analyze_images}; - case 'design_filter_spec' - varargout = {{... - 'SPM.mat','SPM.mat; 2(all)/99 (estimated: SPM.mat)';... - 'SPMcfg.mat','99 with imgs: SPMcfg.mat';... - 'SPM_fMRIDesMtx.mat','99,FMRI,no imgs: SPM*fMRI*'}}; - otherwise - error(['You asked for ' arg ', which is strange']); -end diff --git a/lib/marsbar-0.44/spm2/spm_create_image.m b/lib/marsbar-0.44/spm2/spm_create_image.m deleted file mode 100644 index 8289d8d..0000000 --- a/lib/marsbar-0.44/spm2/spm_create_image.m +++ /dev/null @@ -1,11 +0,0 @@ -function V = spm_create_image(V) -% Wrapper for spm_create_vol, for compatibility with SPM99 -% FORMAT V = spm_create_image(V) -% -% Actually, MarsBaR itself does not use this function; it's included here -% for compatibility with Phiwave (phiwave.sourceforge.net), that depends -% on MarsBaR for its design interface and such. -% -% $Id$ - -V = spm_create_vol(V); diff --git a/lib/marsbar-0.44/spm5/mars_blob_ui.m b/lib/marsbar-0.44/spm5/mars_blob_ui.m deleted file mode 100644 index aa6d795..0000000 --- a/lib/marsbar-0.44/spm5/mars_blob_ui.m +++ /dev/null @@ -1,49 +0,0 @@ -function mars_blob_ui(action) -% Displays SPM results, and ROI menu in SPM input window -% FORMAT mars_blob_ui(action) -% -% This is the SPM2 / SPM5 version -% -% action - action string; can be -% 'init' - initialise results interface -% 'save_one' - UI to save current cluster -% 'save_many' - UI to save all clusters -% -% This routine does SPM version specific stuff, the main -% work is in mars_blob2roi.m and mars_blobs2rois.m -% -% $Id: mars_blob_ui.m 184 2004-01-18 11:26:08Z matthewbrett $ - -if nargin < 1 - action = 'init'; -end - -errstr = sprintf(['''Cannot find xSPM struct in the workspace; '... - 'Please (re)run SPM results GUI''']); - -switch lower(action) - case 'init' - try % and find valid SPM results stuff - evalin('base', 'xSPM;'); - hReg = evalin('base', 'hReg;'); - spm_XYZreg('CleanReg',hReg); - mars_blob_menu; - catch % give up and get a new one - mars_blob_ui('reinit'); - end - case 'reinit' - % Display SPM results - evalin('base', '[hReg,xSPM,SPM] = spm_results_ui;'); - % Menu - mars_blob_menu; - case 'save_one' - xSPM = evalin('base', 'xSPM', ['error(' errstr ')']); - %-Get current location - pt = spm_results_ui('GetCoords'); - mars_blob2roi(xSPM, pt); - case 'save_many' - xSPM = evalin('base', 'xSPM', ['error(' errstr ')']); - mars_blobs2rois(xSPM); - otherwise - error(['Worried by request for ' action]); -end diff --git a/lib/marsbar-0.44/spm5/mars_veropts.m b/lib/marsbar-0.44/spm5/mars_veropts.m deleted file mode 100644 index 81c78c3..0000000 --- a/lib/marsbar-0.44/spm5/mars_veropts.m +++ /dev/null @@ -1,47 +0,0 @@ -function varargout = mars_veropts(arg, varargin) -% returns SPM version specific parameters -% FORMAT varargout = mars_veropts(arg, varargin) -% -% This is the SPM 5 version -% -% $Id: mars_veropts.m 350 2004-08-12 06:52:18Z matthewbrett $ - -if nargin < 1 - varargout = {}; - return -end - -switch lower(arg) - case 'defaults' - global defaults - if isempty(defaults) - try - % SPM8 likes to return the defaults - defaults = spm('defaults','FMRI'); - catch - % SPM5 does not - spm_defaults; - spm('defaults','FMRI'); - end - end - varargout = {defaults}; - case 'default_design' - varargout = {mardo_5}; - case 'template_ext' % extension for template images - varargout = {'.nii'}; - case 'get_img_ext' % default image extension for spm_get - varargout = {'image'}; - case 'pref_img_out_ext' % preferred extension for writing images - varargout = {'.nii'}; - case 'des_conf' % filter for configured, not estimated SPM designs - varargout = {'SPM.mat'}; - case 'flip_option' - varargout = {spm_flip_analyze_images}; - case 'design_filter_spec' - varargout = {{... - 'SPM.mat','SPM.mat; 5,2 (all)/99 (estimated: SPM.mat)';... - 'SPMcfg.mat','99 with imgs: SPMcfg.mat';... - 'SPM_fMRIDesMtx.mat','99,FMRI,no imgs: SPM*fMRI*'}}; - otherwise - error(['You asked for ' arg ', which is strange']); -end diff --git a/lib/marsbar-0.44/spm5/spm_create_image.m b/lib/marsbar-0.44/spm5/spm_create_image.m deleted file mode 100644 index 34c6af5..0000000 --- a/lib/marsbar-0.44/spm5/spm_create_image.m +++ /dev/null @@ -1,11 +0,0 @@ -function V = spm_create_image(V) -% Wrapper for spm_create_vol, for compatibility with SPM99 -% FORMAT V = spm_create_image(V) -% -% Actually, MarsBaR itself does not use this function; it's included here -% for compatibility with Phiwave (phiwave.sourceforge.net), that depends -% on MarsBaR for its design interface and such. -% -% $Id: spm_create_image.m 510 2004-11-17 01:51:58Z matthewbrett $ - -V = spm_create_vol(V); diff --git a/lib/marsbar-0.44/spm5/spm_get.m b/lib/marsbar-0.44/spm5/spm_get.m deleted file mode 100644 index cef89d4..0000000 --- a/lib/marsbar-0.44/spm5/spm_get.m +++ /dev/null @@ -1,143 +0,0 @@ -function varargout = spm_get(Action, varargin) -% compatibility function to allow spm_get calls with SPM5 -% -% SPM5 uses a function called spm_select to do file selection instead of -% the spm_get of versions 96-2. This breaks a lot of old code; here we -% wrap the most common calls to spm_get so that we can use -% spm_select. I've only wrapped the spm_get calls used in marsbar. -% -% Usually, file / directory selection call is of format: -% FORMAT P = spm_get(N, ext, prompt, newwdir) -% Input -% N - matrix specifying what (file or dir) to select, and how -% many to select. -% ext - the filter for files to select -% prompt - the prompt to display for the selection window -% newwdir - new working directory -% -% Output -% P - a string matrix of file names -% -% First argument can also be action string: -% FORMAT cpath = spm_get('CPath',path,cwd) -% (returns canonical version of file path 'path') -% FORMAT [files,dirs]=spm_select('files',direc,filt) -% (Returns files matching the filter (filt) and directories within dir) -% -% See spm_select from the spm5 distribution, and spm_get from spm2 -% distribution - -nout = max(nargout,1); - -if nargin < 1 - Action=Inf; -end - -% If the first argument is a string, this is an action -if ischar(Action) - switch(lower(Action)) - case 'cpath' - varargout = {spm_select('cpath', varargin{:})}; - case 'files' - if nargin < 2 - Dir = pwd; - else - Dir = varargin{1}; - end - if nargin < 3 - Filt = '.*'; - else - Filt = sf_get_to_select_filt(varargin{2}); - end - varargout = {spm_select('list', Dir, Filt)}; - % The old spm_get returned full file paths - Files = varargout{1}; - varargout{1} = [repmat([Dir filesep], size(Files, 1), 1) Files]; - otherwise - error([Action ': I''m sorry, but I can''t do that']); - end - if strcmp(Action, 'files'), Action='List'; end - - return -end - -% Otherwise, must be file / directory selection -if nargin < 2 - Filt = 'any'; -else - Filt = varargin{1}; - varargin(1) = []; - Filt = sf_get_to_select_filt(Filt); -end -if any(Action < 0) - % Directory select - Action = abs(Action); - Filt = 'dir'; -end -if nargin<3 - Prompt='Select files...'; -else - Prompt = varargin{1}; - varargin(1) = []; -end -if nargin<4 - wd = pwd; -else - wd = varargin{1}; - varargin(1) = []; % pop processed argument -end -if length(varargin) ~= 0 - error('Sorry, we do not handle this call to spm_select'); -end -varargout = {spm_select(Action, Filt, Prompt, {''}, wd)}; -if isempty(varargout), return, end -% Cell array prompt should return cell array of arguments -if iscellstr(Prompt) - if isempty(varargout{1}) - varargout{1} = {}; - else - varargout{1} = cellstr(varargout{1}); - end -end -return - - -% Subfunctions -function F = sf_get_to_select_filt(F) -% Converts filter for old spm_get routine to something for spm_select -if strcmpi(F, 'image'), F = lower(F); return, end -F = sf_shexp_regexp(F); -return - -function new_str = sf_shexp_regexp(old_str) -% Does basic conversion from shell expression to regexp -% Have ignored some quoting issues here: -% http://www.unix.org.ua/orelly/perl/cookbook/ch06_10.htm -% sub glob2pat { -% my $globstr = shift; -% my %patmap = ( -% '*' => '.*', -% '?' => '.', -% '[' => '[', -% ']' => ']', -% ); -% $globstr =~ s{(.)} { $patmap{$1} || "\Q$1" }ge; -% return '^' . $globstr . '$'; -%} - -new_str = '^'; -for c = old_str - switch c - case '*' - nc = '.*'; - case '?' - nc = '.'; - case {'.', '^', '$', '+'} - nc = ['\' c]; - otherwise - nc = c; - end - new_str = [new_str nc]; -end -new_str = [new_str '$']; -return diff --git a/lib/marsbar-0.44/spm99/mars_blob_ui.m b/lib/marsbar-0.44/spm99/mars_blob_ui.m deleted file mode 100644 index ce5f2cd..0000000 --- a/lib/marsbar-0.44/spm99/mars_blob_ui.m +++ /dev/null @@ -1,53 +0,0 @@ -function mars_blob_ui(action) -% Displays SPM results, and ROI menu in SPM input window -% FORMAT mars_blob_ui(action) -% -% This is the SPM99 version -% -% action - action string; can be -% 'init' - initialise results interface -% 'save_one' - UI to save current cluster -% 'save_many' - UI to save all clusters -% -% This routine does SPM version specific stuff, the main -% work is in mars_blob2roi.m and mars_blobs2rois.m -% -% $Id$ - -if nargin < 1 - action = 'init'; -end - -errstr = sprintf(['''Cannot find SPM struct in the workspace; '... - 'Please (re)run SPM results GUI''']); - -switch lower(action) - case 'init' - try % and find valid SPM results stuff - evalin('base', 'SPM;'); - evalin('base', 'VOL.M;'); - hReg = evalin('base', 'hReg;'); - RD = get(hReg,'UserData'); - spm_XYZreg('VReg',RD.Reg,0); - mars_blob_menu; - catch % no good, need a new one - mars_blob_ui('reinit'); - end - case 'reinit' - % Display SPM results - evalin('base','[hReg,SPM,VOL,xX,xCon,xSDM] = spm_results_ui;'); - % and menu - mars_blob_menu; - case 'save_one' - xSPM = evalin('base', 'SPM', ['error(' errstr ')']); - xSPM.M = evalin('base', 'VOL.M', ['error(' errstr ')']); - %-Get current location - pt = spm_results_ui('GetCoords'); - mars_blob2roi(xSPM, pt); - case 'save_many' - xSPM = evalin('base', 'SPM', ['error(' errstr ')']); - xSPM.M = evalin('base', 'VOL.M', ['error(' errstr ')']); - mars_blobs2rois(xSPM); - otherwise - error(['Worried by request for ' action]); -end diff --git a/lib/marsbar-0.44/spm99/mars_veropts.m b/lib/marsbar-0.44/spm99/mars_veropts.m deleted file mode 100644 index 2166519..0000000 --- a/lib/marsbar-0.44/spm99/mars_veropts.m +++ /dev/null @@ -1,36 +0,0 @@ -function varargout = mars_veropts(arg, varargin) -% returns SPM version specific parameters -% FORMAT varargout = mars_veropts(arg, varargin) -% -% This the SPM 99 version -% -% $Id$ - -if nargin < 1 - varargout = {}; - return -end - -switch lower(arg) - case 'defaults' - varargout = {}; - case 'default_design' - varargout = {mardo_99}; - case 'template_ext' % extension for template images - varargout = {'.img'}; - case 'get_img_ext' % default image extension for spm_get - varargout = {'img'}; - case 'pref_img_out_ext' % preferred extension for writing images - varargout = {'img'}; - case 'des_conf' % filter for configured, not estimated SPM designs - varargout = {'SPMcfg.mat'}; - case 'flip_option' - varargout = {0}; - case 'design_filter_spec' - varargout = {{... - 'SPMcfg.mat','99 with imgs: SPMcfg.mat';... - 'SPM.mat','SPM.mat; 2(all)/99 (estimated: SPM.mat)';... - 'SPM_fMRIDesMtx.mat','99,FMRI,no imgs: SPM*fMRI*'}}; - otherwise - error(['You asked for ' arg ', which is strange']); -end diff --git a/lib/marsbar-0.44/spm99/spm_close_vol.m b/lib/marsbar-0.44/spm99/spm_close_vol.m deleted file mode 100644 index 2502235..0000000 --- a/lib/marsbar-0.44/spm99/spm_close_vol.m +++ /dev/null @@ -1,11 +0,0 @@ -function Vo = spm_close_vol(Vi) -% Close image volume - for SPM2 / SPM99 compatibility -% See: spm_create_vol and spm_write_plane. -% -% SPM99 seems to use spm_create_image to close volumes -% -% $Id$ - -for i=1:prod(size(Vi)), - Vo(i) = spm_create_image(Vi(i)); -end diff --git a/lib/marsbar-0.44/spm99/spm_create_vol.m b/lib/marsbar-0.44/spm99/spm_create_vol.m deleted file mode 100644 index da3a80a..0000000 --- a/lib/marsbar-0.44/spm99/spm_create_vol.m +++ /dev/null @@ -1,7 +0,0 @@ -function V = spm_create_vol(V) -% Wrapper for spm_create_image, for compatibility with SPM2 -% FORMAT V = spm_create_vol(V) -% -% $Id$ - -V = spm_create_image(V); diff --git a/lib/marsbar-0.44/spm99/spm_read_hdr.m b/lib/marsbar-0.44/spm99/spm_read_hdr.m deleted file mode 100644 index 76cbec3..0000000 --- a/lib/marsbar-0.44/spm99/spm_read_hdr.m +++ /dev/null @@ -1,140 +0,0 @@ -function [hdr,otherendian] = spm_read_hdr(fname) -% SPM2 routine to read (SPM customised) Analyze header -% (Needed for compatibility with SPM99) -% FORMAT [hdr,otherendian] = spm_read_hdr(fname) -% fname - .hdr filename -% hdr - structure containing Analyze header -% otherendian - byte swapping necessary flag -%_______________________________________________________________________ -% @(#)spm_read_hdr.m 2.2 John Ashburner 03/07/17 -% -% $Id$ - -fid = fopen(fname,'r','native'); -otherendian = 0; -if (fid > 0) - dime = read_dime(fid); - if dime.dim(1)<0 | dime.dim(1)>15, % Appears to be other-endian - % Re-open other-endian - fclose(fid); - if spm_platform('bigend'), fid = fopen(fname,'r','ieee-le'); - else, fid = fopen(fname,'r','ieee-be'); end; - otherendian = 1; - dime = read_dime(fid); - end; - hk = read_hk(fid); - hist = read_hist(fid); - hdr.hk = hk; - hdr.dime = dime; - hdr.hist = hist; - - % SPM specific bit - unused - %if hdr.hk.sizeof_hdr > 348, - % spmf = read_spmf(fid,dime.dim(5)); - % if ~isempty(spmf), - % hdr.spmf = spmf; - % end; - %end; - - fclose(fid); -else, - hdr = []; - otherendian = NaN; - %error(['Problem opening header file (' fopen(fid) ').']); -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function hk = read_hk(fid) -% read (struct) header_key -%----------------------------------------------------------------------- -fseek(fid,0,'bof'); -hk.sizeof_hdr = fread(fid,1,'int32'); -hk.data_type = mysetstr(fread(fid,10,'uchar'))'; -hk.db_name = mysetstr(fread(fid,18,'uchar'))'; -hk.extents = fread(fid,1,'int32'); -hk.session_error = fread(fid,1,'int16'); -hk.regular = mysetstr(fread(fid,1,'uchar'))'; -hk.hkey_un0 = mysetstr(fread(fid,1,'uchar'))'; -if isempty(hk.hkey_un0), error(['Problem reading "hk" of header file (' fopen(fid) ').']); end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function dime = read_dime(fid) -% read (struct) image_dimension -%----------------------------------------------------------------------- -fseek(fid,40,'bof'); -dime.dim = fread(fid,8,'int16')'; -dime.vox_units = mysetstr(fread(fid,4,'uchar'))'; -dime.cal_units = mysetstr(fread(fid,8,'uchar'))'; -dime.unused1 = fread(fid,1,'int16'); -dime.datatype = fread(fid,1,'int16'); -dime.bitpix = fread(fid,1,'int16'); -dime.dim_un0 = fread(fid,1,'int16'); -dime.pixdim = fread(fid,8,'float')'; -dime.vox_offset = fread(fid,1,'float'); -dime.funused1 = fread(fid,1,'float'); -dime.funused2 = fread(fid,1,'float'); -dime.funused3 = fread(fid,1,'float'); -dime.cal_max = fread(fid,1,'float'); -dime.cal_min = fread(fid,1,'float'); -dime.compressed = fread(fid,1,'int32'); -dime.verified = fread(fid,1,'int32'); -dime.glmax = fread(fid,1,'int32'); -dime.glmin = fread(fid,1,'int32'); -if isempty(dime.glmin), error(['Problem reading "dime" of header file (' fopen(fid) ').']); end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function hist = read_hist(fid) -% read (struct) data_history -%----------------------------------------------------------------------- -fseek(fid,148,'bof'); -hist.descrip = mysetstr(fread(fid,80,'uchar'))'; -hist.aux_file = mysetstr(fread(fid,24,'uchar'))'; -hist.orient = fread(fid,1,'uchar'); -hist.origin = fread(fid,5,'int16')'; -hist.generated = mysetstr(fread(fid,10,'uchar'))'; -hist.scannum = mysetstr(fread(fid,10,'uchar'))'; -hist.patient_id = mysetstr(fread(fid,10,'uchar'))'; -hist.exp_date = mysetstr(fread(fid,10,'uchar'))'; -hist.exp_time = mysetstr(fread(fid,10,'uchar'))'; -hist.hist_un0 = mysetstr(fread(fid,3,'uchar'))'; -hist.views = fread(fid,1,'int32'); -hist.vols_added = fread(fid,1,'int32'); -hist.start_field= fread(fid,1,'int32'); -hist.field_skip = fread(fid,1,'int32'); -hist.omax = fread(fid,1,'int32'); -hist.omin = fread(fid,1,'int32'); -hist.smax = fread(fid,1,'int32'); -hist.smin = fread(fid,1,'int32'); -if isempty(hist.smin), error(['Problem reading "hist" of header file (' fopen(fid) ').']); end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function spmf = read_spmf(fid,n) -% Read SPM specific fields -% This bit may be used in the future for extending the Analyze header. - -fseek(fid,348,'bof'); -mgc = fread(fid,1,'int32'); % Magic number -if mgc ~= 20020417, spmf = []; return; end; - -for j=1:n, - spmf(j).mat = fread(fid,16,'double'); % Orientation information - spmf(j).unused = fread(fid,384,'uchar'); % Extra unused stuff - if length(spmf(j).unused)<384, - error(['Problem reading "spmf" of header file (' fopen(fid) ').']); - end; - spmf(j).mat = reshape(spmf(j).mat,[4 4]); -end; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ -function out = mysetstr(in) -tmp = find(in == 0); -tmp = min([min(tmp) length(in)]); -out = setstr([in(1:tmp)' zeros(1,length(in)-(tmp))])'; -return; -%_______________________________________________________________________ -%_______________________________________________________________________ diff --git a/lib/marsbar-0.44/spm99/spm_write_plane.m b/lib/marsbar-0.44/spm99/spm_write_plane.m deleted file mode 100644 index e20230c..0000000 --- a/lib/marsbar-0.44/spm99/spm_write_plane.m +++ /dev/null @@ -1,121 +0,0 @@ -function V = spm_write_plane(V,A,p) -% Write a transverse plane of image data. -% FORMAT V = spm_write_plane(V,A,p) -% V - data structure containing image information. -% - see spm_vol for a description. -% A - the two dimensional image to write. -% p - the plane number (beginning from 1). -% -% VO - (possibly) modified data structure containing image information. -% It is possible that future versions of spm_write_plane may -% modify scalefactors (for example). -% -%_______________________________________________________________________ -% @(#)spm_write_plane.m 2.19 John Ashburner 03/07/16 - -if any(V.dim(1:2) ~= size(A)), error('Incompatible image dimensions'); end; -if p>V.dim(3), error('Plane number too high'); end; - -% Write Analyze image by default -V = write_analyze_plane(V,A,p); -return; -%_______________________________________________________________________ - -%_______________________________________________________________________ -function V = write_analyze_plane(V,A,p) - -types = [ 2 4 8 16 64 130 132 136, 512 1024 2048 4096 16384 33280 33792 34816]; -maxval = [2^8-1 2^15-1 2^31-1 Inf Inf 2^7-1 2^16-1 2^32-1, 2^8-1 2^15-1 2^31-1 Inf Inf 2^8-1 2^16-1 2^32-1]; -minval = [ 0 -2^15 -2^31 -Inf -Inf -2^7 0 0, 0 -2^15 -2^31 -Inf -Inf -2^7 0 0]; -intt = [ 1 1 1 0 0 1 1 1, 1 1 1 0 0 1 1 1]; -prec = str2mat('uint8','int16','int32','float','double','int8','uint16','uint32','uint8','int16','int32','float','double','int8','uint16','uint32'); -swapped = [ 0 0 0 0 0 0 0 0, 1 1 1 1 1 1 1 1]; -bits = [ 8 16 32 32 64 8 16 32, 8 16 32 32 64 8 16 32]; - -dt = find(types==V.dim(4)); -if isempty(dt), error('Unknown datatype'); end; - -A = double(A); - -% Rescale to fit appropriate range -if intt(dt), - A(isnan(A)) = 0; - mxv = maxval(dt); - mnv = minval(dt); - A = round(A*(1/V.pinfo(1)) - V.pinfo(2)); - A(A > mxv) = mxv; - A(A < mnv) = mnv; -end; - -if ~isfield(V,'private') | ~isfield(V.private,'fid') | isempty(V.private.fid), - mach = 'native'; - if swapped(dt), - if spm_platform('bigend'), mach = 'ieee-le'; else, mach = 'ieee-be'; end; - end; - [pth,nam,ext] = fileparts(V.fname); - fname = fullfile(pth,[nam, '.img']); - fid = fopen(fname,'r+',mach); - if fid == -1, - fid = fopen(fname,'w',mach); - if fid == -1, - error(['Error opening ' fname '. Check that you have write permission.']); - end; - end; -else, - if isempty(fopen(V.private.fid)), - mach = 'native'; - if swapped(dt), - if spm_platform('bigend'), mach = 'ieee-le'; else, mach = 'ieee-be'; end; - end; - V.private.fid = fopen(fname,'r+',mach); - if V.private.fid == -1, - error(['Error opening ' fname '. Check that you have write permission.']); - end; - end; - fid = V.private.fid; -end; - -% Seek to the appropriate offset -datasize = bits(dt)/8; -off = (p-1)*datasize*prod(V.dim(1:2)) + V.pinfo(3,1); -fseek(fid,0,'bof'); % A bug in Matlab 6.5 means that a rewind is needed -if fseek(fid,off,'bof')==-1, - % Need this because fseek in Matlab does not seek past the EOF - fseek(fid,0,'bof'); % A bug in Matlab 6.5 means that a rewind is needed - fseek(fid,0,'eof'); - curr_off = ftell(fid); - blanks = zeros(off-curr_off,1); - if fwrite(fid,blanks,'uchar') ~= prod(size(blanks)), - write_error_message(V.fname); - error(['Error writing ' V.fname '.']); - end; - fseek(fid,0,'bof'); % A bug in Matlab 6.5 means that a rewind is needed - if fseek(fid,off,'bof') == -1, - write_error_message(V.fname); - error(['Error writing ' V.fname '.']); - return; - end; -end; - -if fwrite(fid,A,deblank(prec(dt,:))) ~= prod(size(A)), - write_error_message(V.fname); - error(['Error writing ' V.fname '.']); -end; - -if ~isfield(V,'private') | ~isfield(V.private,'fid') | isempty(V.private.fid), fclose(fid); end; - -return; -%_______________________________________________________________________ - -%_______________________________________________________________________ -function write_error_message(q) -str = {... - 'Error writing:',... - ' ',... - [' ',spm_str_manip(q,'k40d')],... - ' ',... - 'Check disk space / disk quota.'}; -spm('alert*',str,mfilename,sqrt(-1)); - -return; -%_______________________________________________________________________ diff --git a/lib/marsbar-0.44/spm99/spm_write_vol.m b/lib/marsbar-0.44/spm99/spm_write_vol.m deleted file mode 100644 index 06d0e11..0000000 --- a/lib/marsbar-0.44/spm99/spm_write_vol.m +++ /dev/null @@ -1,80 +0,0 @@ -function V = spm_write_vol(V,Y) -% Write an image volume to disk, setting scales and offsets as appropriate -% FORMAT V = spm_write_vol(V,Y) -% V (input) - a structure containing image volume information (see spm_vol) -% Y - a one, two or three dimensional matrix containing the image voxels -% V (output) - data structure after modification for writing. -%_______________________________________________________________________ -% @(#)spm_write_vol.m 2.9 John Ashburner 03/02/26 - -if ndims(Y)>3, error('Can only handle a maximum of 3 dimensions.'), end - -if ~isfield(V,'pinfo'), V.pinfo = [1,0,0]'; end - -dim = [size(Y) 1 1 1]; -if ~all(dim(1:3) == V.dim(1:3)) | (size(V.pinfo,2)~=1 & size(V.pinfo,2)~=dim(3)), - error('Incompatible dimensions.'); -end - - -% Set scalefactors and offsets -%----------------------------------------------------------------------- -dt = V.dim(4); if dt>256, dt = dt/256; end; -if any(dt == [128+2 128+4 128+8]), - % Convert to a form that Analyze will support - dt = dt - 128; -end; -s = find(dt == [2 4 8 128+2 128+4 128+8]); -dmnmx = [0 -2^15 -2^31 -2^7 0 0 ; 2^8-1 2^15-1 2^31-1 2^7-1 2^16 2^32]; -dmnmx = dmnmx(:,s); -V.pinfo(1,:) = 1; -V.pinfo(2,:) = 0; -mxs = zeros(dim(3),1)+NaN; -mns = zeros(dim(3),1)+NaN; -if ~isempty(s), - for p=1:dim(3), - tmp = double(Y(:,:,p)); - tmp = tmp(isfinite(tmp)); - if ~isempty(tmp), - mxs(p) = max(tmp); - mns(p) = min(tmp); - end; - end; - - if size(V.pinfo,2) ~= 1, - for p=1:dim(3), - mx = mxs(p); - mn = mns(p); - if ~isfinite(mx), mx = 0; end; - if ~isfinite(mn), mn = 0; end; - if mx~=mn, - V.pinfo(1,p) = (mx-mn)/(dmnmx(2)-dmnmx(1)); - V.pinfo(2,p) = ... - (dmnmx(2)*mn-dmnmx(1)*mx)/(dmnmx(2)-dmnmx(1)); - else, - V.pinfo(1,p) = 0; - V.pinfo(2,p) = mx; - end; - end; - else, - mx = max(mxs(isfinite(mxs))); - mn = min(mns(isfinite(mns))); - if isempty(mx), mx = 0; end; - if isempty(mn), mn = 0; end; - if mx~=mn, - V.pinfo(1,1) = (mx-mn)/(dmnmx(2)-dmnmx(1)); - V.pinfo(2,1) = (dmnmx(2)*mn-dmnmx(1)*mx)/(dmnmx(2)-dmnmx(1)); - else, - V.pinfo(1,1) = 0; - V.pinfo(2,1) = mx; - end; - end; -end; - -%-Create and write image -%----------------------------------------------------------------------- -V = spm_create_vol(V); -for p=1:V.dim(3), - V = spm_write_plane(V,Y(:,:,p),p); -end; -V = spm_close_vol(V); diff --git a/lib/marsbar-0.44/todo.txt b/lib/marsbar-0.44/todo.txt deleted file mode 100644 index b491157..0000000 --- a/lib/marsbar-0.44/todo.txt +++ /dev/null @@ -1,6 +0,0 @@ -To do list ----------- - -Odd EoI + subset contrast error in MV routine. -Random effects structure, with import / export etc -Simple means store for event signal plotting (in case of estimation failure) From ff7d52c26c2dde06739beaf4ddcdc5bee985277e Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Wed, 2 Nov 2022 12:22:36 +0100 Subject: [PATCH 11/12] update marsbar path --- .github/workflows/run_tests_matlab.yml | 2 +- initCppRoi.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_tests_matlab.yml b/.github/workflows/run_tests_matlab.yml index 1645c64..44d984c 100644 --- a/.github/workflows/run_tests_matlab.yml +++ b/.github/workflows/run_tests_matlab.yml @@ -57,4 +57,4 @@ jobs: file: coverage.xml # optional flags: unittests # optional name: codecov-umbrella # optional - fail_ci_if_error: true # optional (default = false) + fail_ci_if_error: false # optional (default = false) diff --git a/initCppRoi.m b/initCppRoi.m index b3230cb..b8b3087 100644 --- a/initCppRoi.m +++ b/initCppRoi.m @@ -17,7 +17,7 @@ function initCppRoi() % we add all the subfunctions that are in the sub directories CPP_ROI_PATHS = genpath(fullfile(thisDirectory, 'src')); CPP_ROI_PATHS = cat(2, CPP_ROI_PATHS, pathSep, ... - fullfile(thisDirectory, 'lib', 'marsbar')); + fullfile(thisDirectory, 'lib', 'marsbar', 'marsbar')); CPP_ROI_PATHS = cat(2, CPP_ROI_PATHS, pathSep, ... fullfile(thisDirectory, 'atlas')); addpath(CPP_ROI_PATHS, '-begin'); From 2d8bebb5ac8c0cc4d229eaa5a3eacdb2cd74a728 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Wed, 2 Nov 2022 12:27:08 +0100 Subject: [PATCH 12/12] update version --- .readthedocs copy.yml | 26 -------------------------- CITATION.cff | 2 +- Makefile | 2 +- version.txt | 2 +- 4 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 .readthedocs copy.yml diff --git a/.readthedocs copy.yml b/.readthedocs copy.yml deleted file mode 100644 index 4ede163..0000000 --- a/.readthedocs copy.yml +++ /dev/null @@ -1,26 +0,0 @@ -# .readthedocs.yml -# Read the Docs configuration file -# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details - -# Required -version: 2 - -# Build documentation in the docs/ directory with Sphinx -sphinx: - configuration: docs/source/conf.py - builder: html - fail_on_warning: true - -# Build documentation with MkDocs -#mkdocs: -# configuration: mkdocs.yml - -# Optionally build your docs in additional formats such as PDF -formats: - - pdf - -# Optionally set the version of Python and requirements required to build your docs -python: - version: 3.7 - install: - - requirements: requirements.txt diff --git a/CITATION.cff b/CITATION.cff index 44b26c9..084a4d8 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -2,7 +2,7 @@ cff-version: 1.2.0 title: "CPP ROI" -version: 0.3.0 +version: 0.3.1 abstract: Set of Octave and Matlab functions, demos and scripts to help manage ROIs and to play nice with BIDS datasets. diff --git a/Makefile b/Makefile index 80d5dff..c6299cc 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: clean install_dev +.PHONY: clean install_dev version.txt clean: clean_lib rm -rf coverage* diff --git a/version.txt b/version.txt index 268b033..937cd78 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v0.3.0 +v0.3.1