spm-python 25.1a1.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spm/__init__.py +828 -0
- spm/__wrapper__.py +343 -0
- spm/_spm/_spm.ctf +0 -0
- spm/file_array.py +529 -0
- spm/gifti.py +570 -0
- spm/meeg.py +1198 -0
- spm/nifti.py +412 -0
- spm/slover.py +597 -0
- spm/spm.py +63 -0
- spm/spm_ADEM.py +57 -0
- spm/spm_ADEM_M_set.py +53 -0
- spm/spm_ADEM_diff.py +27 -0
- spm/spm_ADEM_set.py +20 -0
- spm/spm_ADEM_update.py +25 -0
- spm/spm_ALAP.py +159 -0
- spm/spm_A_reduce.py +26 -0
- spm/spm_BIDS.py +29 -0
- spm/spm_BMS.py +43 -0
- spm/spm_BMS_F.py +28 -0
- spm/spm_BMS_F_smpl.py +21 -0
- spm/spm_BMS_bor.py +28 -0
- spm/spm_BMS_gibbs.py +29 -0
- spm/spm_Bcdf.py +56 -0
- spm/spm_Bpdf.py +56 -0
- spm/spm_Ce.py +34 -0
- spm/spm_DEM.py +100 -0
- spm/spm_DEM_F.py +22 -0
- spm/spm_DEM_M_set.py +58 -0
- spm/spm_DEM_R.py +28 -0
- spm/spm_DEM_diff.py +27 -0
- spm/spm_DEM_embed.py +23 -0
- spm/spm_DEM_eval.py +48 -0
- spm/spm_DEM_eval_diff.py +27 -0
- spm/spm_DEM_generate.py +36 -0
- spm/spm_DEM_int.py +27 -0
- spm/spm_DEM_qH.py +25 -0
- spm/spm_DEM_qP.py +20 -0
- spm/spm_DEM_qU.py +23 -0
- spm/spm_DEM_set.py +20 -0
- spm/spm_DEM_z.py +24 -0
- spm/spm_DFP.py +87 -0
- spm/spm_DFP_plot.py +19 -0
- spm/spm_DesMtx.py +213 -0
- spm/spm_DesRep.py +128 -0
- spm/spm_DisplayTimeSeries.py +67 -0
- spm/spm_Dpdf.py +32 -0
- spm/spm_ECdensity.py +18 -0
- spm/spm_FcUtil.py +136 -0
- spm/spm_Fcdf.py +72 -0
- spm/spm_Fpdf.py +65 -0
- spm/spm_GDEM.py +117 -0
- spm/spm_Gcdf.py +71 -0
- spm/spm_Gpdf.py +63 -0
- spm/spm_Icdf.py +78 -0
- spm/spm_Ipdf.py +76 -0
- spm/spm_KL_cat.py +23 -0
- spm/spm_KL_dir.py +26 -0
- spm/spm_LAP.py +99 -0
- spm/spm_LAPF.py +77 -0
- spm/spm_LAPS.py +77 -0
- spm/spm_LAP_F.py +24 -0
- spm/spm_LAP_eval.py +26 -0
- spm/spm_LAP_iS.py +21 -0
- spm/spm_LAP_pg.py +19 -0
- spm/spm_LAP_ph.py +19 -0
- spm/spm_Laplace.py +32 -0
- spm/spm_MB_col.py +16 -0
- spm/spm_MDP_MI.py +26 -0
- spm/spm_MDP_da.py +18 -0
- spm/spm_MH.py +28 -0
- spm/spm_MH_reml.py +28 -0
- spm/spm_MH_reml_likelihood.py +20 -0
- spm/spm_Markov_blanket.py +30 -0
- spm/spm_Menu.py +24 -0
- spm/spm_NESS_F.py +35 -0
- spm/spm_NESS_ds.py +35 -0
- spm/spm_NESS_gen.py +48 -0
- spm/spm_NESS_gen_lap.py +44 -0
- spm/spm_Ncdf.py +61 -0
- spm/spm_Ncdf_jdw.py +32 -0
- spm/spm_Npdf.py +52 -0
- spm/spm_P.py +41 -0
- spm/spm_PEB.py +68 -0
- spm/spm_P_Bonf.py +35 -0
- spm/spm_P_FDR.py +87 -0
- spm/spm_P_RF.py +59 -0
- spm/spm_P_clusterFDR.py +26 -0
- spm/spm_P_peakFDR.py +38 -0
- spm/spm_Pcdf.py +69 -0
- spm/spm_Pec_resels.py +21 -0
- spm/spm_Ppdf.py +63 -0
- spm/spm_Q.py +31 -0
- spm/spm_Q_perm.py +15 -0
- spm/spm_ROI.py +30 -0
- spm/spm_SpUtil.py +266 -0
- spm/spm_Tcdf.py +71 -0
- spm/spm_Tpdf.py +56 -0
- spm/spm_VBX.py +45 -0
- spm/spm_VOI.py +63 -0
- spm/spm_Volt_W.py +17 -0
- spm/spm_Volterra.py +33 -0
- spm/spm_Welcome.py +16 -0
- spm/spm_XYZreg.py +177 -0
- spm/spm_XYZreg_Ex2.py +44 -0
- spm/spm_Xcdf.py +60 -0
- spm/spm_Xpdf.py +57 -0
- spm/spm_affine_priors.py +17 -0
- spm/spm_ancova.py +35 -0
- spm/spm_api_bmc.py +25 -0
- spm/spm_ar_reml.py +30 -0
- spm/spm_argmax.py +26 -0
- spm/spm_atlas.py +27 -0
- spm/spm_authors.py +17 -0
- spm/spm_axis.py +13 -0
- spm/spm_barh.py +18 -0
- spm/spm_bayes2_logbf.py +20 -0
- spm/spm_beta_compare.py +27 -0
- spm/spm_betaln.py +24 -0
- spm/spm_bilinear.py +36 -0
- spm/spm_bilinear_condition.py +16 -0
- spm/spm_bireduce.py +46 -0
- spm/spm_bms_against_null.py +20 -0
- spm/spm_bms_anova.py +31 -0
- spm/spm_bms_anova_img.py +21 -0
- spm/spm_bms_compare_groups.py +26 -0
- spm/spm_bms_display.py +22 -0
- spm/spm_bms_display_ROI.py +20 -0
- spm/spm_bms_display_vox.py +18 -0
- spm/spm_bms_partition.py +22 -0
- spm/spm_bms_test_null.py +20 -0
- spm/spm_bms_ttest.py +31 -0
- spm/spm_browser.py +21 -0
- spm/spm_bsplinc.py +43 -0
- spm/spm_bsplins.py +49 -0
- spm/spm_bwlabel.py +30 -0
- spm/spm_cat.py +31 -0
- spm/spm_cat_struct.py +15 -0
- spm/spm_cell_swap.py +16 -0
- spm/spm_changepath.py +28 -0
- spm/spm_check_filename.py +17 -0
- spm/spm_check_installation.py +26 -0
- spm/spm_check_orientations.py +22 -0
- spm/spm_check_registration.py +22 -0
- spm/spm_check_results.py +19 -0
- spm/spm_check_version.py +75 -0
- spm/spm_circularGraph.py +23 -0
- spm/spm_clf.py +27 -0
- spm/spm_cli.py +14 -0
- spm/spm_clusters.py +25 -0
- spm/spm_colourmap.py +46 -0
- spm/spm_combinations.py +18 -0
- spm/spm_compact_svd.py +18 -0
- spm/spm_compare_families.py +54 -0
- spm/spm_cond_units.py +17 -0
- spm/spm_conman.py +247 -0
- spm/spm_contrasts.py +21 -0
- spm/spm_conv.py +25 -0
- spm/spm_conv_full.py +24 -0
- spm/spm_conv_vol.py +41 -0
- spm/spm_convmtx.py +27 -0
- spm/spm_copy.py +25 -0
- spm/spm_coreg.py +57 -0
- spm/spm_cov2corr.py +15 -0
- spm/spm_create_vol.py +16 -0
- spm/spm_cross.py +23 -0
- spm/spm_csd_fmri_gu.py +21 -0
- spm/spm_csd_fmri_mar.py +34 -0
- spm/spm_csd_fmri_mtf.py +36 -0
- spm/spm_cva.py +77 -0
- spm/spm_cva_ui.py +92 -0
- spm/spm_dartel_integrate.py +30 -0
- spm/spm_data_hdr_read.py +18 -0
- spm/spm_data_hdr_write.py +16 -0
- spm/spm_data_id.py +17 -0
- spm/spm_data_read.py +32 -0
- spm/spm_data_write.py +22 -0
- spm/spm_dcm_HMM.py +58 -0
- spm/spm_dcm_HMM_plot.py +30 -0
- spm/spm_dcm_J.py +78 -0
- spm/spm_dcm_KL.py +21 -0
- spm/spm_dcm_U.py +33 -0
- spm/spm_dcm_average.py +42 -0
- spm/spm_dcm_bdc.py +55 -0
- spm/spm_dcm_bma.py +98 -0
- spm/spm_dcm_bma_results.py +17 -0
- spm/spm_dcm_bmc.py +45 -0
- spm/spm_dcm_bmc_peb.py +80 -0
- spm/spm_dcm_bmr.py +49 -0
- spm/spm_dcm_bmr_all.py +78 -0
- spm/spm_dcm_bpa.py +53 -0
- spm/spm_dcm_check_stability.py +23 -0
- spm/spm_dcm_compare.py +17 -0
- spm/spm_dcm_connectivity_ui.py +26 -0
- spm/spm_dcm_contrasts.py +20 -0
- spm/spm_dcm_create.py +33 -0
- spm/spm_dcm_csd_Q.py +43 -0
- spm/spm_dcm_delay.py +38 -0
- spm/spm_dcm_diagnose.py +44 -0
- spm/spm_dcm_display.py +20 -0
- spm/spm_dcm_estimate.py +65 -0
- spm/spm_dcm_evidence.py +26 -0
- spm/spm_dcm_fit.py +29 -0
- spm/spm_dcm_fmri_check.py +57 -0
- spm/spm_dcm_fmri_csd.py +50 -0
- spm/spm_dcm_fmri_csd_DEM.py +50 -0
- spm/spm_dcm_fmri_csd_data.py +25 -0
- spm/spm_dcm_fmri_csd_gen.py +21 -0
- spm/spm_dcm_fmri_csd_results.py +31 -0
- spm/spm_dcm_fmri_graph_gen.py +19 -0
- spm/spm_dcm_fmri_image.py +17 -0
- spm/spm_dcm_fmri_mar.py +47 -0
- spm/spm_dcm_fmri_mode.py +23 -0
- spm/spm_dcm_fmri_mode_gen.py +23 -0
- spm/spm_dcm_fmri_nmm.py +61 -0
- spm/spm_dcm_fmri_priors.py +38 -0
- spm/spm_dcm_generate.py +32 -0
- spm/spm_dcm_graph.py +18 -0
- spm/spm_dcm_graph_functional.py +21 -0
- spm/spm_dcm_identify.py +18 -0
- spm/spm_dcm_load.py +23 -0
- spm/spm_dcm_loo.py +43 -0
- spm/spm_dcm_mdp.py +44 -0
- spm/spm_dcm_mtf.py +35 -0
- spm/spm_dcm_optimise.py +36 -0
- spm/spm_dcm_peb.py +108 -0
- spm/spm_dcm_peb_bmc.py +108 -0
- spm/spm_dcm_peb_bmc_fam.py +50 -0
- spm/spm_dcm_peb_con.py +53 -0
- spm/spm_dcm_peb_fit.py +82 -0
- spm/spm_dcm_peb_full.py +83 -0
- spm/spm_dcm_peb_review.py +20 -0
- spm/spm_dcm_peb_rnd.py +51 -0
- spm/spm_dcm_peb_rnd_search.py +51 -0
- spm/spm_dcm_peb_test.py +56 -0
- spm/spm_dcm_peb_to_gcm.py +61 -0
- spm/spm_dcm_post_hoc.py +85 -0
- spm/spm_dcm_post_hoc_old.py +79 -0
- spm/spm_dcm_ppd.py +48 -0
- spm/spm_dcm_reduce.py +15 -0
- spm/spm_dcm_review.py +29 -0
- spm/spm_dcm_search.py +44 -0
- spm/spm_dcm_sessions.py +36 -0
- spm/spm_dcm_simulate.py +42 -0
- spm/spm_dcm_sparse.py +51 -0
- spm/spm_dcm_sparse_priors.py +23 -0
- spm/spm_dcm_specify.py +107 -0
- spm/spm_dcm_specify_ui.py +40 -0
- spm/spm_dcm_ui.py +77 -0
- spm/spm_dcm_voi.py +25 -0
- spm/spm_dctmtx.py +39 -0
- spm/spm_ddiff.py +38 -0
- spm/spm_deface.py +21 -0
- spm/spm_defaults.py +33 -0
- spm/spm_deformations.py +21 -0
- spm/spm_dem2dcm.py +29 -0
- spm/spm_design_contrasts.py +29 -0
- spm/spm_design_factorial.py +23 -0
- spm/spm_design_flexible.py +23 -0
- spm/spm_design_within_subject.py +21 -0
- spm/spm_detrend.py +23 -0
- spm/spm_dftmtx.py +25 -0
- spm/spm_diag.py +17 -0
- spm/spm_diag_array.py +17 -0
- spm/spm_dicom_convert.py +46 -0
- spm/spm_dicom_essentials.py +21 -0
- spm/spm_dicom_header.py +35 -0
- spm/spm_dicom_headers.py +25 -0
- spm/spm_dicom_metadata.py +24 -0
- spm/spm_dicom_text_to_dict.py +30 -0
- spm/spm_diff.py +38 -0
- spm/spm_diff_dx.py +23 -0
- spm/spm_diffeo.py +464 -0
- spm/spm_dilate.py +40 -0
- spm/spm_dir_MI.py +24 -0
- spm/spm_dir_norm.py +19 -0
- spm/spm_dir_sort.py +21 -0
- spm/spm_dirichlet_exceedance.py +32 -0
- spm/spm_dot.py +32 -0
- spm/spm_dwtmtx.py +24 -0
- spm/spm_dx.py +57 -0
- spm/spm_dx_eig.py +57 -0
- spm/spm_ecat2nifti.py +19 -0
- spm/spm_eeg_artefact.py +50 -0
- spm/spm_eeg_artefact_events.py +27 -0
- spm/spm_eeg_artefact_eyeblink.py +28 -0
- spm/spm_eeg_artefact_flat.py +27 -0
- spm/spm_eeg_artefact_heartbeat.py +29 -0
- spm/spm_eeg_artefact_jump.py +27 -0
- spm/spm_eeg_artefact_nans.py +27 -0
- spm/spm_eeg_artefact_peak2peak.py +27 -0
- spm/spm_eeg_artefact_saccade.py +33 -0
- spm/spm_eeg_artefact_threshchan.py +27 -0
- spm/spm_eeg_artefact_zscore.py +27 -0
- spm/spm_eeg_artefact_zscorediff.py +27 -0
- spm/spm_eeg_assemble_priors.py +19 -0
- spm/spm_eeg_average.py +29 -0
- spm/spm_eeg_average_TF.py +30 -0
- spm/spm_eeg_avgfreq.py +24 -0
- spm/spm_eeg_avgtime.py +26 -0
- spm/spm_eeg_bc.py +30 -0
- spm/spm_eeg_cfc.py +30 -0
- spm/spm_eeg_collapse_timefreq.py +24 -0
- spm/spm_eeg_combineplanar.py +31 -0
- spm/spm_eeg_contrast.py +37 -0
- spm/spm_eeg_convert.py +59 -0
- spm/spm_eeg_convert2images.py +43 -0
- spm/spm_eeg_convert_ui.py +17 -0
- spm/spm_eeg_copy.py +22 -0
- spm/spm_eeg_correct_sensor_data.py +28 -0
- spm/spm_eeg_crop.py +26 -0
- spm/spm_eeg_definetrial.py +32 -0
- spm/spm_eeg_dipoles_ui.py +15 -0
- spm/spm_eeg_displayECD.py +30 -0
- spm/spm_eeg_display_tf.py +17 -0
- spm/spm_eeg_downsample.py +30 -0
- spm/spm_eeg_epochs.py +59 -0
- spm/spm_eeg_filter.py +35 -0
- spm/spm_eeg_firstlevel.py +21 -0
- spm/spm_eeg_fixpnt.py +15 -0
- spm/spm_eeg_ft2spm.py +15 -0
- spm/spm_eeg_fuse.py +25 -0
- spm/spm_eeg_grandmean.py +36 -0
- spm/spm_eeg_history.py +32 -0
- spm/spm_eeg_inv_Mesh2Voxels.py +38 -0
- spm/spm_eeg_inv_check.py +23 -0
- spm/spm_eeg_inv_checkdatareg.py +17 -0
- spm/spm_eeg_inv_checkforward.py +15 -0
- spm/spm_eeg_inv_checkmeshes.py +21 -0
- spm/spm_eeg_inv_custom_ui.py +31 -0
- spm/spm_eeg_inv_datareg.py +43 -0
- spm/spm_eeg_inv_datareg_ui.py +22 -0
- spm/spm_eeg_inv_extract.py +25 -0
- spm/spm_eeg_inv_extract_ui.py +19 -0
- spm/spm_eeg_inv_fmripriors.py +40 -0
- spm/spm_eeg_inv_forward.py +22 -0
- spm/spm_eeg_inv_forward_ui.py +23 -0
- spm/spm_eeg_inv_get_vol_sens.py +23 -0
- spm/spm_eeg_inv_group.py +38 -0
- spm/spm_eeg_inv_headcoordinates.py +24 -0
- spm/spm_eeg_inv_icp.py +41 -0
- spm/spm_eeg_inv_imag_api.py +17 -0
- spm/spm_eeg_inv_image_display.py +18 -0
- spm/spm_eeg_inv_mesh.py +23 -0
- spm/spm_eeg_inv_mesh_spherify.py +28 -0
- spm/spm_eeg_inv_mesh_ui.py +26 -0
- spm/spm_eeg_inv_prep_modes_xval.py +35 -0
- spm/spm_eeg_inv_results.py +24 -0
- spm/spm_eeg_inv_results_display.py +15 -0
- spm/spm_eeg_inv_results_ui.py +19 -0
- spm/spm_eeg_inv_rigidreg.py +22 -0
- spm/spm_eeg_inv_spatnorm.py +23 -0
- spm/spm_eeg_inv_transform_mesh.py +18 -0
- spm/spm_eeg_inv_transform_points.py +15 -0
- spm/spm_eeg_inv_vb_ecd_gui.py +49 -0
- spm/spm_eeg_inv_vbecd.py +41 -0
- spm/spm_eeg_inv_vbecd_disp.py +22 -0
- spm/spm_eeg_inv_vbecd_getLF.py +28 -0
- spm/spm_eeg_inv_vbecd_gui.py +18 -0
- spm/spm_eeg_inv_vbecd_mom.py +40 -0
- spm/spm_eeg_inv_visu3D_api.py +20 -0
- spm/spm_eeg_invert.py +132 -0
- spm/spm_eeg_invert_EBoptimise.py +31 -0
- spm/spm_eeg_invert_bma.py +20 -0
- spm/spm_eeg_invert_classic.py +73 -0
- spm/spm_eeg_invert_classic_mix.py +28 -0
- spm/spm_eeg_invert_classic_volumetric.py +78 -0
- spm/spm_eeg_invert_display.py +22 -0
- spm/spm_eeg_invert_prepro.py +35 -0
- spm/spm_eeg_invert_setuppatches.py +28 -0
- spm/spm_eeg_invert_ui.py +26 -0
- spm/spm_eeg_invertiter.py +23 -0
- spm/spm_eeg_lapmtx.py +20 -0
- spm/spm_eeg_layout3D.py +16 -0
- spm/spm_eeg_lgainmat.py +19 -0
- spm/spm_eeg_load.py +22 -0
- spm/spm_eeg_locate_channels.py +29 -0
- spm/spm_eeg_mask.py +22 -0
- spm/spm_eeg_mask2channels.py +22 -0
- spm/spm_eeg_merge.py +68 -0
- spm/spm_eeg_meshnative2mni.py +19 -0
- spm/spm_eeg_modality_ui.py +24 -0
- spm/spm_eeg_montage.py +62 -0
- spm/spm_eeg_montage_ui.py +22 -0
- spm/spm_eeg_morlet.py +36 -0
- spm/spm_eeg_planarchannelset.py +18 -0
- spm/spm_eeg_plotScalpData.py +30 -0
- spm/spm_eeg_prep.py +27 -0
- spm/spm_eeg_prep_ui.py +16 -0
- spm/spm_eeg_project3D.py +16 -0
- spm/spm_eeg_read_bsa.py +18 -0
- spm/spm_eeg_reduce.py +35 -0
- spm/spm_eeg_reduce_cva.py +26 -0
- spm/spm_eeg_reduce_imagcsd.py +27 -0
- spm/spm_eeg_reduce_pca.py +26 -0
- spm/spm_eeg_reduce_pca_adapt.py +26 -0
- spm/spm_eeg_reduce_whiten.py +26 -0
- spm/spm_eeg_regressors.py +28 -0
- spm/spm_eeg_regressors_chandata.py +25 -0
- spm/spm_eeg_regressors_movement_ctf.py +25 -0
- spm/spm_eeg_regressors_tfphase.py +25 -0
- spm/spm_eeg_regressors_tfpower.py +25 -0
- spm/spm_eeg_remove_bad_trials.py +27 -0
- spm/spm_eeg_render.py +43 -0
- spm/spm_eeg_review.py +21 -0
- spm/spm_eeg_review_callbacks.py +14 -0
- spm/spm_eeg_review_switchDisplay.py +14 -0
- spm/spm_eeg_review_uis.py +14 -0
- spm/spm_eeg_robust_averaget.py +19 -0
- spm/spm_eeg_select_event_ui.py +15 -0
- spm/spm_eeg_simulate.py +29 -0
- spm/spm_eeg_simulate_frominv.py +22 -0
- spm/spm_eeg_smoothmesh_mm.py +18 -0
- spm/spm_eeg_spatial_confounds.py +21 -0
- spm/spm_eeg_specest_hilbert.py +33 -0
- spm/spm_eeg_specest_morlet.py +34 -0
- spm/spm_eeg_specest_mtmconvol.py +36 -0
- spm/spm_eeg_specest_mtmfft.py +33 -0
- spm/spm_eeg_spmft_chan_dictionary.py +15 -0
- spm/spm_eeg_tf.py +54 -0
- spm/spm_eeg_tf_rescale.py +37 -0
- spm/spm_eeg_wrap_dipfit_vbecd.py +24 -0
- spm/spm_eeg_wrap_momfit_vbecd.py +25 -0
- spm/spm_ekf.py +35 -0
- spm/spm_en.py +21 -0
- spm/spm_epharm.py +24 -0
- spm/spm_erode.py +40 -0
- spm/spm_est_V.py +19 -0
- spm/spm_est_non_sphericity.py +40 -0
- spm/spm_est_smoothness.py +63 -0
- spm/spm_existfile.py +24 -0
- spm/spm_expm.py +23 -0
- spm/spm_extract_files.py +16 -0
- spm/spm_extrapolate_def.py +21 -0
- spm/spm_fMRI_design.py +176 -0
- spm/spm_field.py +136 -0
- spm/spm_fieldindices.py +25 -0
- spm/spm_figure.py +55 -0
- spm/spm_file.py +64 -0
- spm/spm_file_ext.py +23 -0
- spm/spm_file_merge.py +28 -0
- spm/spm_file_split.py +19 -0
- spm/spm_fileparts.py +21 -0
- spm/spm_filter.py +36 -0
- spm/spm_find_pC.py +30 -0
- spm/spm_flip_analyze_images.py +19 -0
- spm/spm_fmin.py +34 -0
- spm/spm_fmri_concatenate.py +32 -0
- spm/spm_fmri_spm_ui.py +182 -0
- spm/spm_fn_reml.py +32 -0
- spm/spm_fp.py +35 -0
- spm/spm_fp_display_density.py +21 -0
- spm/spm_fp_display_nullclines.py +20 -0
- spm/spm_fp_fmin.py +25 -0
- spm/spm_fp_fun.py +25 -0
- spm/spm_fs_fmri_csd.py +23 -0
- spm/spm_funcheck.py +18 -0
- spm/spm_funfun.py +21 -0
- spm/spm_fx_fmri.py +44 -0
- spm/spm_fx_fmri_linear.py +40 -0
- spm/spm_fx_hdm.py +37 -0
- spm/spm_fx_lz.py +18 -0
- spm/spm_fx_poly.py +20 -0
- spm/spm_gamrnd.py +29 -0
- spm/spm_gen_fmri.py +40 -0
- spm/spm_getSPM.py +192 -0
- spm/spm_get_anatomical_layout.py +90 -0
- spm/spm_get_bbox.py +23 -0
- spm/spm_get_bf.py +39 -0
- spm/spm_get_closest_affine.py +34 -0
- spm/spm_get_data.py +23 -0
- spm/spm_get_dataset.py +19 -0
- spm/spm_get_defaults.py +29 -0
- spm/spm_get_lm.py +31 -0
- spm/spm_get_matdim.py +30 -0
- spm/spm_get_ons.py +48 -0
- spm/spm_get_space.py +18 -0
- spm/spm_get_vc.py +37 -0
- spm/spm_get_volumes.py +17 -0
- spm/spm_glass.py +31 -0
- spm/spm_global.py +24 -0
- spm/spm_gn_fmin.py +26 -0
- spm/spm_graph.py +34 -0
- spm/spm_graph_ui.py +78 -0
- spm/spm_grid.py +21 -0
- spm/spm_gx_fmri.py +25 -0
- spm/spm_gx_fmri_linear.py +25 -0
- spm/spm_gx_hdm.py +24 -0
- spm/spm_gx_state_fmri.py +26 -0
- spm/spm_hanning.py +17 -0
- spm/spm_hdm_priors.py +34 -0
- spm/spm_hdm_ui.py +25 -0
- spm/spm_help.py +66 -0
- spm/spm_hilbert.py +18 -0
- spm/spm_hist.py +17 -0
- spm/spm_hist2.py +29 -0
- spm/spm_hist_smooth.py +17 -0
- spm/spm_hrf.py +42 -0
- spm/spm_image.py +58 -0
- spm/spm_imatrix.py +20 -0
- spm/spm_imcalc.py +92 -0
- spm/spm_ind2sub.py +31 -0
- spm/spm_inline2func.py +15 -0
- spm/spm_input.py +181 -0
- spm/spm_int.py +65 -0
- spm/spm_int_B.py +69 -0
- spm/spm_int_D.py +67 -0
- spm/spm_int_E.py +68 -0
- spm/spm_int_J.py +71 -0
- spm/spm_int_L.py +70 -0
- spm/spm_int_ode.py +70 -0
- spm/spm_int_sde.py +71 -0
- spm/spm_interp.py +17 -0
- spm/spm_inv.py +22 -0
- spm/spm_invBcdf.py +60 -0
- spm/spm_invFcdf.py +71 -0
- spm/spm_invGcdf.py +64 -0
- spm/spm_invIcdf.py +57 -0
- spm/spm_invNcdf.py +72 -0
- spm/spm_invPcdf.py +56 -0
- spm/spm_invTcdf.py +74 -0
- spm/spm_invXcdf.py +56 -0
- spm/spm_inv_phi.py +17 -0
- spm/spm_inv_spd.py +20 -0
- spm/spm_ipharm.py +24 -0
- spm/spm_iwft.py +19 -0
- spm/spm_jobman.py +66 -0
- spm/spm_jsonread.py +28 -0
- spm/spm_jsonwrite.py +34 -0
- spm/spm_kernels.py +44 -0
- spm/spm_kl_dirichlet.py +23 -0
- spm/spm_kl_gamma.py +20 -0
- spm/spm_kl_normal.py +22 -0
- spm/spm_kl_normald.py +24 -0
- spm/spm_kl_wishart.py +21 -0
- spm/spm_kron.py +27 -0
- spm/spm_krutil.py +57 -0
- spm/spm_large_dcm_reduce.py +27 -0
- spm/spm_length.py +23 -0
- spm/spm_lg_gamma.py +23 -0
- spm/spm_list.py +124 -0
- spm/spm_load.py +21 -0
- spm/spm_load_priors8.py +22 -0
- spm/spm_log.py +15 -0
- spm/spm_log_evidence.py +39 -0
- spm/spm_log_evidence_reduce.py +34 -0
- spm/spm_logdet.py +20 -0
- spm/spm_lorenz_k.py +20 -0
- spm/spm_lotka_volterra.py +28 -0
- spm/spm_maff8.py +30 -0
- spm/spm_make_contrasts.py +36 -0
- spm/spm_marginal.py +20 -0
- spm/spm_mask.py +31 -0
- spm/spm_match_str.py +21 -0
- spm/spm_matrix.py +54 -0
- spm/spm_max.py +33 -0
- spm/spm_mb_ui.py +135 -0
- spm/spm_meanby.py +28 -0
- spm/spm_mesh.py +17 -0
- spm/spm_mesh_adjacency.py +18 -0
- spm/spm_mesh_area.py +25 -0
- spm/spm_mesh_borders.py +19 -0
- spm/spm_mesh_bounding_volume.py +22 -0
- spm/spm_mesh_calc.py +23 -0
- spm/spm_mesh_clusters.py +20 -0
- spm/spm_mesh_contour.py +35 -0
- spm/spm_mesh_cube.py +20 -0
- spm/spm_mesh_curvature.py +18 -0
- spm/spm_mesh_detect.py +17 -0
- spm/spm_mesh_dist.py +26 -0
- spm/spm_mesh_distmtx.py +21 -0
- spm/spm_mesh_edges.py +20 -0
- spm/spm_mesh_euler.py +26 -0
- spm/spm_mesh_geodesic.py +34 -0
- spm/spm_mesh_get_lm.py +20 -0
- spm/spm_mesh_inflate.py +20 -0
- spm/spm_mesh_inside.py +41 -0
- spm/spm_mesh_isoline.py +38 -0
- spm/spm_mesh_isosurface.py +23 -0
- spm/spm_mesh_join.py +21 -0
- spm/spm_mesh_label.py +22 -0
- spm/spm_mesh_laplacian.py +23 -0
- spm/spm_mesh_mass_matrix.py +17 -0
- spm/spm_mesh_max.py +27 -0
- spm/spm_mesh_neighbours.py +21 -0
- spm/spm_mesh_normals.py +20 -0
- spm/spm_mesh_polyhedron.py +22 -0
- spm/spm_mesh_project.py +26 -0
- spm/spm_mesh_ray_intersect.py +40 -0
- spm/spm_mesh_ray_triangle.py +32 -0
- spm/spm_mesh_reduce.py +35 -0
- spm/spm_mesh_refine.py +25 -0
- spm/spm_mesh_render.py +49 -0
- spm/spm_mesh_resels.py +31 -0
- spm/spm_mesh_sdf.py +43 -0
- spm/spm_mesh_select.py +20 -0
- spm/spm_mesh_smooth.py +22 -0
- spm/spm_mesh_sphere.py +22 -0
- spm/spm_mesh_split.py +20 -0
- spm/spm_mesh_to_grid.py +20 -0
- spm/spm_mesh_transform.py +18 -0
- spm/spm_mesh_utils.py +26 -0
- spm/spm_mesh_volume.py +18 -0
- spm/spm_mesh_voxelise.py +30 -0
- spm/spm_mfx.py +88 -0
- spm/spm_minmax.py +23 -0
- spm/spm_mip.py +46 -0
- spm/spm_mip_ui.py +79 -0
- spm/spm_mkdir.py +19 -0
- spm/spm_mldivide.py +25 -0
- spm/spm_mnc2nifti.py +26 -0
- spm/spm_morlet.py +25 -0
- spm/spm_morlet_conv.py +26 -0
- spm/spm_mrdivide.py +25 -0
- spm/spm_mrf.py +54 -0
- spm/spm_mtx_cos.py +19 -0
- spm/spm_multrnd.py +20 -0
- spm/spm_mvNpdf.py +34 -0
- spm/spm_mvb.py +79 -0
- spm/spm_mvb_G.py +48 -0
- spm/spm_mvb_R2.py +18 -0
- spm/spm_mvb_U.py +29 -0
- spm/spm_mvb_bmc.py +20 -0
- spm/spm_mvb_cvk.py +26 -0
- spm/spm_mvb_cvk2.py +27 -0
- spm/spm_mvb_cvk_display.py +16 -0
- spm/spm_mvb_display.py +16 -0
- spm/spm_mvb_estimate.py +77 -0
- spm/spm_mvb_p.py +25 -0
- spm/spm_mvb_ui.py +87 -0
- spm/spm_nCr.py +70 -0
- spm/spm_ncFcdf.py +22 -0
- spm/spm_ncFpdf.py +27 -0
- spm/spm_ncTcdf.py +26 -0
- spm/spm_ncTpdf.py +27 -0
- spm/spm_ndgrid.py +21 -0
- spm/spm_ness.py +43 -0
- spm/spm_ness_GN.py +37 -0
- spm/spm_ness_J.py +15 -0
- spm/spm_ness_Lap.py +37 -0
- spm/spm_ness_N2Sp.py +18 -0
- spm/spm_ness_Sp2N.py +22 -0
- spm/spm_ness_Sp2p.py +21 -0
- spm/spm_ness_U.py +39 -0
- spm/spm_ness_cond.py +25 -0
- spm/spm_ness_flows.py +21 -0
- spm/spm_ness_hd.py +37 -0
- spm/spm_ness_m2S.py +20 -0
- spm/spm_ness_p2Sp.py +21 -0
- spm/spm_nlsi.py +99 -0
- spm/spm_nlsi_AI.py +94 -0
- spm/spm_nlsi_GN.py +106 -0
- spm/spm_nlsi_GN_H.py +69 -0
- spm/spm_nlsi_LS.py +95 -0
- spm/spm_nlsi_N.py +94 -0
- spm/spm_nlsi_Newton.py +56 -0
- spm/spm_non_sphericity.py +67 -0
- spm/spm_normrnd.py +21 -0
- spm/spm_opm_amm.py +28 -0
- spm/spm_orientations.py +57 -0
- spm/spm_orth.py +25 -0
- spm/spm_orthpoly.py +21 -0
- spm/spm_orthviews.py +161 -0
- spm/spm_padarray.py +24 -0
- spm/spm_parrec2nifti.py +21 -0
- spm/spm_pca_get_transforms.py +12 -0
- spm/spm_pca_project_velocity.py +18 -0
- spm/spm_pca_sample_brains.py +24 -0
- spm/spm_pca_sample_deformation.py +17 -0
- spm/spm_pca_transform_mesh.py +23 -0
- spm/spm_pca_transform_volume.py +20 -0
- spm/spm_pca_warps.py +26 -0
- spm/spm_peb_ppi.py +57 -0
- spm/spm_percentile.py +26 -0
- spm/spm_perm_mtx.py +20 -0
- spm/spm_permute_kron.py +18 -0
- spm/spm_pf.py +37 -0
- spm/spm_phase_shuffle.py +17 -0
- spm/spm_phi.py +17 -0
- spm/spm_phi_dot.py +16 -0
- spm/spm_pinv.py +19 -0
- spm/spm_platform.py +51 -0
- spm/spm_plot_ci.py +37 -0
- spm/spm_plot_convergence.py +22 -0
- spm/spm_polymtx.py +29 -0
- spm/spm_powell.py +28 -0
- spm/spm_preproc.py +27 -0
- spm/spm_preproc8.py +82 -0
- spm/spm_preproc_run.py +38 -0
- spm/spm_preproc_write8.py +15 -0
- spm/spm_print.py +22 -0
- spm/spm_progress_bar.py +30 -0
- spm/spm_project.py +31 -0
- spm/spm_psi.py +21 -0
- spm/spm_rand_mar.py +20 -0
- spm/spm_rand_power_law.py +24 -0
- spm/spm_read_netcdf.py +19 -0
- spm/spm_read_vols.py +25 -0
- spm/spm_realign.py +96 -0
- spm/spm_regions.py +60 -0
- spm/spm_reml.py +47 -0
- spm/spm_reml_A.py +45 -0
- spm/spm_reml_ancova.py +41 -0
- spm/spm_reml_sc.py +54 -0
- spm/spm_render.py +43 -0
- spm/spm_render_vol.py +39 -0
- spm/spm_reorder_contrasts.py +19 -0
- spm/spm_resels.py +35 -0
- spm/spm_resels_vol.py +31 -0
- spm/spm_reslice.py +69 -0
- spm/spm_results_nidm.py +33 -0
- spm/spm_results_ui.py +134 -0
- spm/spm_rmpath.py +27 -0
- spm/spm_robust_average.py +20 -0
- spm/spm_robust_glm.py +28 -0
- spm/spm_s2csd.py +20 -0
- spm/spm_sample_priors8.py +25 -0
- spm/spm_sample_vol.py +38 -0
- spm/spm_save.py +18 -0
- spm/spm_sde_dx.py +39 -0
- spm/spm_sdot.py +26 -0
- spm/spm_searchlight.py +44 -0
- spm/spm_sections.py +24 -0
- spm/spm_select.py +71 -0
- spm/spm_sepmul3d.py +27 -0
- spm/spm_shp_get_model.py +21 -0
- spm/spm_shp_get_transforms.py +32 -0
- spm/spm_shp_install.py +16 -0
- spm/spm_shp_project_velocity.py +24 -0
- spm/spm_shp_sample_brains.py +43 -0
- spm/spm_shp_sample_deformation.py +27 -0
- spm/spm_shp_transform_mesh.py +30 -0
- spm/spm_shp_transform_volume.py +26 -0
- spm/spm_shp_warps.py +27 -0
- spm/spm_sixel.py +27 -0
- spm/spm_slice_timing.py +99 -0
- spm/spm_slice_vol.py +35 -0
- spm/spm_slm.py +24 -0
- spm/spm_smohist.py +27 -0
- spm/spm_smooth.py +32 -0
- spm/spm_smoothkern.py +35 -0
- spm/spm_smoothto8bit.py +19 -0
- spm/spm_softmax.py +23 -0
- spm/spm_soreduce.py +42 -0
- spm/spm_sp.py +189 -0
- spm/spm_sp_reml.py +44 -0
- spm/spm_sparse_regression.py +33 -0
- spm/spm_speye.py +20 -0
- spm/spm_spm.py +278 -0
- spm/spm_spm_Bayes.py +75 -0
- spm/spm_spm_Bayes_CY.py +23 -0
- spm/spm_spm_Bayes_specify.py +30 -0
- spm/spm_sptop.py +30 -0
- spm/spm_spy.py +18 -0
- spm/spm_sqrtm.py +19 -0
- spm/spm_squeeze.py +15 -0
- spm/spm_ssm2s.py +24 -0
- spm/spm_standalone.py +21 -0
- spm/spm_str_manip.py +58 -0
- spm/spm_subfun.py +20 -0
- spm/spm_sum.py +17 -0
- spm/spm_summarise.py +35 -0
- spm/spm_surf.py +63 -0
- spm/spm_svd.py +22 -0
- spm/spm_swarp.py +24 -0
- spm/spm_t2z.py +63 -0
- spm/spm_tests.py +26 -0
- spm/spm_timeseries_resample.py +23 -0
- spm/spm_trace.py +17 -0
- spm/spm_transverse.py +45 -0
- spm/spm_type.py +34 -0
- spm/spm_u.py +29 -0
- spm/spm_uc.py +33 -0
- spm/spm_uc_Bonf.py +32 -0
- spm/spm_uc_FDR.py +89 -0
- spm/spm_uc_RF.py +32 -0
- spm/spm_uc_clusterFDR.py +47 -0
- spm/spm_uc_peakFDR.py +45 -0
- spm/spm_uitab.py +35 -0
- spm/spm_uncat.py +21 -0
- spm/spm_unlink.py +17 -0
- spm/spm_unvec.py +22 -0
- spm/spm_update.py +31 -0
- spm/spm_uw_apply.py +128 -0
- spm/spm_uw_estimate.py +90 -0
- spm/spm_uw_get_image_def.py +46 -0
- spm/spm_uw_show.py +20 -0
- spm/spm_vb_F.py +25 -0
- spm/spm_vb_Fn.py +27 -0
- spm/spm_vb_a.py +18 -0
- spm/spm_vb_adjacency.py +22 -0
- spm/spm_vb_alpha.py +18 -0
- spm/spm_vb_beta.py +18 -0
- spm/spm_vb_contrasts.py +23 -0
- spm/spm_vb_edgeweights.py +20 -0
- spm/spm_vb_gamma.py +18 -0
- spm/spm_vb_get_Ab.py +24 -0
- spm/spm_vb_get_Gn.py +19 -0
- spm/spm_vb_get_R.py +19 -0
- spm/spm_vb_glmar.py +85 -0
- spm/spm_vb_graphcut.py +35 -0
- spm/spm_vb_incidence.py +23 -0
- spm/spm_vb_init_block.py +18 -0
- spm/spm_vb_lambda.py +18 -0
- spm/spm_vb_logbf.py +20 -0
- spm/spm_vb_models.py +22 -0
- spm/spm_vb_neighbors.py +27 -0
- spm/spm_vb_ppm_anova.py +39 -0
- spm/spm_vb_regionF.py +34 -0
- spm/spm_vb_robust.py +26 -0
- spm/spm_vb_roi_anova.py +28 -0
- spm/spm_vb_roi_basis.py +57 -0
- spm/spm_vb_set_priors.py +41 -0
- spm/spm_vb_spatial_precision.py +22 -0
- spm/spm_vb_taylor_R.py +20 -0
- spm/spm_vb_w.py +18 -0
- spm/spm_vec.py +23 -0
- spm/spm_vecfun.py +20 -0
- spm/spm_vol.py +41 -0
- spm/spm_vol_nifti.py +19 -0
- spm/spm_voronoi.py +29 -0
- spm/spm_wft.py +19 -0
- spm/spm_write_filtered.py +34 -0
- spm/spm_write_plane.py +24 -0
- spm/spm_write_residuals.py +20 -0
- spm/spm_write_vol.py +22 -0
- spm/spm_z2p.py +26 -0
- spm/spm_zeros.py +16 -0
- spm/xmltree.py +619 -0
- spm_python-25.1a1.dev1.dist-info/AUTHORS.txt +53 -0
- spm_python-25.1a1.dev1.dist-info/LICENCE +339 -0
- spm_python-25.1a1.dev1.dist-info/METADATA +151 -0
- spm_python-25.1a1.dev1.dist-info/RECORD +834 -0
- spm_python-25.1a1.dev1.dist-info/WHEEL +5 -0
- spm_python-25.1a1.dev1.dist-info/top_level.txt +1 -0
spm/spm_sp.py
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_sp(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
Orthogonal (design) matrix space setting & manipulation
|
|
7
|
+
FORMAT varargout = spm_spc(action,varargin)
|
|
8
|
+
|
|
9
|
+
This function computes the different projectors related to the row
|
|
10
|
+
and column spaces X. It should be used to avoid redundant computation
|
|
11
|
+
of svd on large X matrix. It is divided into actions that set up the
|
|
12
|
+
space, (Create,Set,...) and actions that compute projections (pinv,
|
|
13
|
+
pinvXpX, pinvXXp, ...) This is motivated by the problem of rounding
|
|
14
|
+
errors that can invalidate some computation and is a tool to work
|
|
15
|
+
with spaces.
|
|
16
|
+
|
|
17
|
+
The only thing that is not easily computed is the null space of
|
|
18
|
+
the line of X (assuming size(X,1) > size(X,2)).
|
|
19
|
+
To get this space (a basis of it or a projector on it) use spm_sp on X'.
|
|
20
|
+
|
|
21
|
+
The only restriction on the use of the space structure is when X is
|
|
22
|
+
so big that you cannot fit X and its svd in memory at the same time.
|
|
23
|
+
Otherwise, the use of spm_sp will generally speed up computations and
|
|
24
|
+
optimise memory use.
|
|
25
|
+
|
|
26
|
+
Note that since the design matrix is stored in the space structure,
|
|
27
|
+
there is no need to keep a separate copy of it.
|
|
28
|
+
|
|
29
|
+
----------------
|
|
30
|
+
|
|
31
|
+
The structure is:
|
|
32
|
+
x = struct(...
|
|
33
|
+
'X', [],... % Mtx
|
|
34
|
+
'tol', [],... % tolerance
|
|
35
|
+
'ds', [],... % vectors of singular values
|
|
36
|
+
'u', [],... % u as in X = u*diag(ds)*v'
|
|
37
|
+
'v', [],... % v as in X = u*diag(ds)*v'
|
|
38
|
+
'rk', [],... % rank
|
|
39
|
+
'oP', [],... % orthogonal projector on X
|
|
40
|
+
'oPp', [],... % orthogonal projector on X'
|
|
41
|
+
'ups', [],... % space in which this one is embedded
|
|
42
|
+
'sus', []); % subspace
|
|
43
|
+
|
|
44
|
+
The basic required fields are X, tol, ds, u, v, rk.
|
|
45
|
+
|
|
46
|
+
=========================================================================
|
|
47
|
+
|
|
48
|
+
FORMAT x = spm_sp('Set',X)
|
|
49
|
+
Set up space structure, storing matrix, singular values, rank & tolerance
|
|
50
|
+
X - a (design) matrix (2D)
|
|
51
|
+
x - the corresponding space structure, with basic fields filled in
|
|
52
|
+
The SVD is an "economy size" svd, using MatLab's svd(X,0)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
FORMAT r = spm_sp('oP',x[,Y])
|
|
56
|
+
FORMAT r = spm_sp('oPp',x[,Y])
|
|
57
|
+
Return orthogonal projectors, or orthogonal projection of data Y (if passed)
|
|
58
|
+
x - space structure of matrix X
|
|
59
|
+
r - ('oP' usage) ortho. projection matrix projecting into column space of x.X
|
|
60
|
+
- ('oPp' usage) ortho. projection matrix projecting into row space of x.X
|
|
61
|
+
Y - data (optional)
|
|
62
|
+
- If data are specified then the corresponding projection of data is
|
|
63
|
+
returned. This is usually more efficient that computing and applying
|
|
64
|
+
the projection matrix directly.
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
FORMAT pX = spm_sp('pinv',x)
|
|
68
|
+
Returns a pseudo-inverse of X - pinv(X) - computed efficiently
|
|
69
|
+
x - space structure of matrix X
|
|
70
|
+
pX - pseudo-inverse of X
|
|
71
|
+
This is the same as MatLab's pinv - the Moore-Penrose pseudoinverse
|
|
72
|
+
( Note that because size(pinv(X)) == size(X'), it is not generally )
|
|
73
|
+
( useful to compute pinv(X)*Data sequentially (as is the case for )
|
|
74
|
+
( 'res' or 'oP') )
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
FORMAT pXpX = spm_sp('pinvxpx',x)
|
|
78
|
+
Returns a pseudo-inverse of X'X - pinv(X'*X) - computed efficiently
|
|
79
|
+
x - space structure of matrix X
|
|
80
|
+
pXpX - pseudo-inverse of (X'X)
|
|
81
|
+
( Note that because size(pinv(X'*X)) == [size(X,2) size(X,2)], )
|
|
82
|
+
( it is not useful to compute pinv(X'X)*Data sequentially unless )
|
|
83
|
+
( size(X,1) < size(X,2) )
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
FORMAT XpX = spm_sp('xpx',x)
|
|
87
|
+
Returns (X'X) - computed efficiently
|
|
88
|
+
x - space structure of matrix X
|
|
89
|
+
XpX - (X'X)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
FORMAT pXXp = spm_sp('pinvxxp',x)
|
|
93
|
+
Returns a pseudo-inverse of XX' - pinv(X*X') - computed efficiently
|
|
94
|
+
x - space structure of matrix X
|
|
95
|
+
pXXp - pseudo-inverse of (XX')
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
FORMAT XXp = spm_sp('xxp',x)
|
|
99
|
+
Returns (XX') - computed efficiently
|
|
100
|
+
x - space structure of matrix X
|
|
101
|
+
XXp - (XX')
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
FORMAT b = spm_sp('isinsp',x,c[,tol])
|
|
105
|
+
FORMAT b = spm_sp('isinspp',x,c[,tol])
|
|
106
|
+
Check whether vectors c are in the column/row space of X
|
|
107
|
+
x - space structure of matrix X
|
|
108
|
+
c - vector(s) (Multiple vectors passed as a matrix)
|
|
109
|
+
tol - (optional) tolerance (for rounding error)
|
|
110
|
+
[defaults to tolerance specified in space structure: x.tol]
|
|
111
|
+
b - ('isinsp' usage) true if c is in the column space of X
|
|
112
|
+
- ('isinspp' usage) true if c is in the column space of X
|
|
113
|
+
|
|
114
|
+
FORMAT b = spm_sp('eachinsp',x,c[,tol])
|
|
115
|
+
FORMAT b = spm_sp('eachinspp',x,c[,tol])
|
|
116
|
+
Same as 'isinsp' and 'isinspp' but returns a logical row vector of
|
|
117
|
+
length size(c,2).
|
|
118
|
+
|
|
119
|
+
FORMAT N = spm_sp('n',x)
|
|
120
|
+
Simply returns the null space of matrix X (same as matlab NULL)
|
|
121
|
+
(Null space = vectors associated with zero eigenvalues)
|
|
122
|
+
x - space structure of matrix X
|
|
123
|
+
N - null space
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
FORMAT r = spm_sp('nop',x[,Y])
|
|
127
|
+
Orthogonal projector onto null space of X, or projection of data Y (if passed)
|
|
128
|
+
x - space structure of matrix X
|
|
129
|
+
Y - (optional) data
|
|
130
|
+
r - (if no Y passed) orthogonal projection matrix into the null space of X
|
|
131
|
+
- (if Y passed ) orthogonal projection of data into the null space of X
|
|
132
|
+
( Note that if xp = spm_sp('set',x.X'), we have: )
|
|
133
|
+
( spm_sp('nop',x) == spm_sp('res',xp) )
|
|
134
|
+
( or, equivalently: )
|
|
135
|
+
( spm_sp('nop',x) + spm_sp('oP',xp) == eye(size(xp.X,1)); )
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
FORMAT r = spm_sp('res',x[,Y])
|
|
139
|
+
Returns residual formaing matrix wirit column space of X, or residuals (if Y)
|
|
140
|
+
x - space structure of matrix X
|
|
141
|
+
Y - (optional) data
|
|
142
|
+
r - (if no Y passed) residual forming matrix for design matrix X
|
|
143
|
+
- (if Y passed ) residuals, i.e. residual forming matrix times data
|
|
144
|
+
( This will be more efficient than
|
|
145
|
+
( spm_sp('res',x)*Data, when size(X,1) > size(X,2)
|
|
146
|
+
Note that this can also be seen as the orthogonal projector onto the
|
|
147
|
+
null space of x.X' (which is not generally computed in svd, unless
|
|
148
|
+
size(X,1) < size(X,2)).
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
FORMAT oX = spm_sp('ox', x)
|
|
152
|
+
FORMAT oXp = spm_sp('oxp',x)
|
|
153
|
+
Returns an orthonormal basis for X ('ox' usage) or X' ('oxp' usage)
|
|
154
|
+
x - space structure of matrix X
|
|
155
|
+
oX - orthonormal basis for X - same as orth(x.X)
|
|
156
|
+
xOp - *an* orthonormal for X' (but not the same as orth(x.X'))
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
FORMAT b = spm_sp('isspc',x)
|
|
160
|
+
Check a variable is a structure with the right fields for a space structure
|
|
161
|
+
x - candidate variable
|
|
162
|
+
b - true if x is a structure with fieldnames corresponding to spm_sp('create')
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
FORMAT [b,e] = spm_sp('issetspc',x)
|
|
166
|
+
Test whether a variable is a space structure with the basic fields set
|
|
167
|
+
x - candidate variable
|
|
168
|
+
b - true is x is a structure with fieldnames corresponding to
|
|
169
|
+
spm_sp('Create'), which has it's basic fields filled in.
|
|
170
|
+
e - string describing why x fails the issetspc test (if it does)
|
|
171
|
+
This is simply a gateway function combining spm_sp('isspc',x) with
|
|
172
|
+
the internal subfunction sf_isset, which checks that the basic fields
|
|
173
|
+
are not empty. See sf_isset (below).
|
|
174
|
+
|
|
175
|
+
--------------------------------------------------------------------------
|
|
176
|
+
SUBFUNCTIONS:
|
|
177
|
+
|
|
178
|
+
FORMAT b = sf_isset(x)
|
|
179
|
+
Checks that the basic fields are non-empty (doesn't check they're right!)
|
|
180
|
+
x - space structure
|
|
181
|
+
b - true if the basic fields are non-empty
|
|
182
|
+
__________________________________________________________________________
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_sp.m )
|
|
186
|
+
|
|
187
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
188
|
+
"""
|
|
189
|
+
return Runtime.call("spm_sp", *args, **kwargs)
|
spm/spm_sp_reml.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_sp_reml(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
ReML estimation of covariance components from y*y' (for sparse patterns)
|
|
7
|
+
FORMAT [C,h,Ph,F,Fa,Fc] = spm_sp_reml(YY,X,Q,N);
|
|
8
|
+
|
|
9
|
+
YY - (m x m) sample covariance matrix Y*Y' {Y = (m x N) data matrix}
|
|
10
|
+
X - (m x p) design matrix
|
|
11
|
+
Q - {1 x q} components Q.q = eigenvectors; Q.v = eigenvalues
|
|
12
|
+
or (m x n) matrix of n basis functions
|
|
13
|
+
N - number of samples
|
|
14
|
+
|
|
15
|
+
C - (m x m) estimated errors = h(1)*Q{1} + h(2)*Q{2} + ...
|
|
16
|
+
h - (q x 1) ReML hyperparameters h
|
|
17
|
+
Ph - (q x q) conditional precision of log(h)
|
|
18
|
+
|
|
19
|
+
F - [-ve] free energy F = log evidence = p(Y|X,Q) = ReML objective
|
|
20
|
+
|
|
21
|
+
Fa - accuracy
|
|
22
|
+
Fc - complexity (F = Fa - Fc)
|
|
23
|
+
|
|
24
|
+
Performs a Fisher-Scoring ascent on F to find ReML variance parameter
|
|
25
|
+
estimates, using uninformative hyperpriors (this is effectively an ARD
|
|
26
|
+
scheme). The specification of components differs from spm_reml and
|
|
27
|
+
spm_reml_sc.
|
|
28
|
+
|
|
29
|
+
__________________________________________________________________________
|
|
30
|
+
|
|
31
|
+
SPM ReML routines:
|
|
32
|
+
|
|
33
|
+
spm_reml: no positivity constraints on covariance parameters
|
|
34
|
+
spm_reml_sc: positivity constraints on covariance parameters
|
|
35
|
+
spm_sp_reml: for sparse patterns (c.f., ARD)
|
|
36
|
+
|
|
37
|
+
__________________________________________________________________________
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_sp_reml.m )
|
|
41
|
+
|
|
42
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
43
|
+
"""
|
|
44
|
+
return Runtime.call("spm_sp_reml", *args, **kwargs)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_sparse_regression(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
Sparse (logistic) regression using Bayesian model reduction
|
|
7
|
+
FORMAT RCM = spm_sparse_regression(y,X,X0)
|
|
8
|
+
y - univariate response variable
|
|
9
|
+
X - design matrix of explanatory variables
|
|
10
|
+
X0 - confounds
|
|
11
|
+
|
|
12
|
+
RCM - reduced causal model structure
|
|
13
|
+
RCM.M - GLM
|
|
14
|
+
RCM.Pp - Model posterior (with and without each parameter)
|
|
15
|
+
RCM.Ep - Bayesian parameter mean under reduced model
|
|
16
|
+
RCM.Cp - Bayesian parameter covariance under reduced model
|
|
17
|
+
RCM.Vp - Bayesian parameter variance under selected model
|
|
18
|
+
__________________________________________________________________________
|
|
19
|
+
|
|
20
|
+
spm_sparse_regression performs a sparse regression using priors on the
|
|
21
|
+
parameters of a GLM and hyperpriors on the noise precision to recover a
|
|
22
|
+
sparse set of explanatory variables. The implicit Bayesian model
|
|
23
|
+
reduction (i.e., elimination of redundant parameters) uses post-hoc
|
|
24
|
+
optimisation. If the response variable is in the range [0 1] then a logit
|
|
25
|
+
transform is applied to produce sparse logistic regression.
|
|
26
|
+
__________________________________________________________________________
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_sparse_regression.m )
|
|
30
|
+
|
|
31
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
32
|
+
"""
|
|
33
|
+
return Runtime.call("spm_sparse_regression", *args, **kwargs)
|
spm/spm_speye.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_speye(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
Sparse leading diagonal matrix
|
|
7
|
+
FORMAT [D] = spm_speye(m,n,k,c)
|
|
8
|
+
|
|
9
|
+
returns an m x n matrix with ones along the k-th leading diagonal. If
|
|
10
|
+
called with an optional fourth argument c = 1, a wraparound sparse matrix
|
|
11
|
+
is returned. If c = 2, then empty rows or columns are filled in on the
|
|
12
|
+
leading diagonal.
|
|
13
|
+
__________________________________________________________________________
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_speye.m )
|
|
17
|
+
|
|
18
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
19
|
+
"""
|
|
20
|
+
return Runtime.call("spm_speye", *args, **kwargs)
|
spm/spm_spm.py
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_spm(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
[Re]ML Estimation of a General Linear Model
|
|
7
|
+
FORMAT SPM = spm_spm(SPM)
|
|
8
|
+
|
|
9
|
+
Required fields of SPM:
|
|
10
|
+
|
|
11
|
+
xY.VY - nScan x 1 struct array of image handles (see spm_vol)
|
|
12
|
+
Images must have the same orientation, voxel size and data type
|
|
13
|
+
- Any scaling should have already been applied via the image handle
|
|
14
|
+
scalefactors.
|
|
15
|
+
|
|
16
|
+
xX - Structure containing design matrix information
|
|
17
|
+
- Required fields are:
|
|
18
|
+
xX.X - Design matrix (raw, not temporally smoothed)
|
|
19
|
+
xX.name - cellstr of parameter names corresponding to columns
|
|
20
|
+
of design matrix
|
|
21
|
+
- Optional fields are:
|
|
22
|
+
xX.K - cell of session-specific structures (see spm_filter)
|
|
23
|
+
- Design & data are pre-multiplied by K
|
|
24
|
+
(K*Y = K*X*beta + K*e)
|
|
25
|
+
- Note that K should not smooth across block boundaries
|
|
26
|
+
- defaults to speye(size(xX.X,1))
|
|
27
|
+
xX.W - Optional whitening/weighting matrix used to give
|
|
28
|
+
weighted least squares estimates (WLS). If not
|
|
29
|
+
specified spm_spm will set this to whiten the data
|
|
30
|
+
and render the OLS estimates maximum likelihood
|
|
31
|
+
i.e. W*W' = inv(xVi.V).
|
|
32
|
+
|
|
33
|
+
xVi - Structure describing intrinsic temporal non-sphericity
|
|
34
|
+
- Required fields are:
|
|
35
|
+
xVi.Vi - array of non-sphericity components
|
|
36
|
+
- defaults to {speye(size(xX.X,1))} - i.i.d.
|
|
37
|
+
- specifying a cell array of constraints (Qi)
|
|
38
|
+
These constraints invoke spm_reml to estimate
|
|
39
|
+
hyperparameters assuming V is constant over voxels.
|
|
40
|
+
that provide a high precise estimate of xX.V
|
|
41
|
+
- Optional fields are:
|
|
42
|
+
xX.V - Optional non-sphericity matrix. Cov(e) = sigma^2*V
|
|
43
|
+
If not specified spm_spm will compute this using
|
|
44
|
+
a 1st pass to identify significant voxels over which
|
|
45
|
+
to estimate V. A 2nd pass is then used to re-estimate
|
|
46
|
+
the parameters with WLS and save the ML estimates
|
|
47
|
+
(unless xX.W is already specified).
|
|
48
|
+
|
|
49
|
+
xM - Structure containing masking information, or a simple column vector
|
|
50
|
+
of thresholds corresponding to the images in VY [default: -Inf]
|
|
51
|
+
- If a structure, the required fields are:
|
|
52
|
+
xM.TH - nVar x nScan matrix of analysis thresholds, one per image
|
|
53
|
+
xM.I - Implicit masking (0=>none, 1 => implicit zero/NaN mask)
|
|
54
|
+
xM.VM - struct array of explicit mask image handles
|
|
55
|
+
- (empty if no explicit masks)
|
|
56
|
+
- Explicit mask images are >0 for valid voxels to assess.
|
|
57
|
+
- Mask images can have any orientation, voxel size or data
|
|
58
|
+
type. They are interpolated using nearest neighbour
|
|
59
|
+
interpolation to the voxel locations of the data Y.
|
|
60
|
+
- Note that voxels with constant data (i.e. the same value across
|
|
61
|
+
scans) are also automatically masked out.
|
|
62
|
+
|
|
63
|
+
swd - Directory where the output files will be saved [default: pwd]
|
|
64
|
+
If exists, it becomes the current working directory.
|
|
65
|
+
|
|
66
|
+
In addition, global SPM "defaults" variable is used (see spm_defaults):
|
|
67
|
+
|
|
68
|
+
stats.<modality>.UFp - critical F-threshold for selecting voxels over
|
|
69
|
+
which the non-sphericity is estimated (if
|
|
70
|
+
required) [default: 0.001]
|
|
71
|
+
|
|
72
|
+
stats.maxres - maximum number of residual images for smoothness
|
|
73
|
+
estimation
|
|
74
|
+
|
|
75
|
+
stats.maxmem - maximum amount of data processed at a time (in bytes)
|
|
76
|
+
|
|
77
|
+
modality - SPM modality {'PET','FMRI','EEG'}
|
|
78
|
+
|
|
79
|
+
__________________________________________________________________________
|
|
80
|
+
|
|
81
|
+
spm_spm is the heart of the SPM package. Given image files and a
|
|
82
|
+
General Linear Model, it estimates the model parameters, variance
|
|
83
|
+
hyperparameters, and smoothness of standardised residual fields, writing
|
|
84
|
+
these out to disk in the current working directory for later
|
|
85
|
+
interrogation in the results section. (NB: Existing analyses in the
|
|
86
|
+
current working directory are overwritten). This directory
|
|
87
|
+
now becomes the working directory for this analysis and all saved
|
|
88
|
+
images are relative to this directory.
|
|
89
|
+
|
|
90
|
+
The model is expressed via the design matrix (xX.X). The basic model
|
|
91
|
+
at each voxel is of the form is Y = X*B + e, for data Y, design
|
|
92
|
+
matrix X, (unknown) parameters B and residual errors e. The errors
|
|
93
|
+
are assumed to have a normal distribution.
|
|
94
|
+
|
|
95
|
+
Sometimes confounds (e.g. drift terms in fMRI) are necessary. These
|
|
96
|
+
can be specified directly in the design matrix or implicitly, in terms
|
|
97
|
+
of a residual forming matrix K to give a generalised linear model
|
|
98
|
+
K*Y = K*X*B + K*e. In fact K can be any matrix (e.g. a convolution
|
|
99
|
+
matrix).
|
|
100
|
+
|
|
101
|
+
In some instances i.i.d. assumptions about errors do not hold. For
|
|
102
|
+
example, with serially correlated (fMRI) data or correlations among the
|
|
103
|
+
levels of a factor in repeated measures designs. This non-sphericity
|
|
104
|
+
can be specified in terms of components (SPM.xVi.Vi{i}). If specified
|
|
105
|
+
these covariance components will then be estimated with ReML (restricted
|
|
106
|
+
maximum likelihood) hyperparameters. This estimation assumes the same
|
|
107
|
+
non-sphericity for voxels that exceed the global F-threshold. The ReML
|
|
108
|
+
estimates can then be used to whiten the data giving maximum likelihood
|
|
109
|
+
(ML) or Gauss-Markov estimators. This entails a second pass of the data
|
|
110
|
+
with an augmented model K*W*Y = K*W*X*B + K*W*e where W*W' = inv(xVi.V).
|
|
111
|
+
xVi.V is the non-sphericity based on the hyperparameter estimates.
|
|
112
|
+
W is stored in xX.W and cov(K*W*e) in xX.V. The covariance of the
|
|
113
|
+
parameter estimates is then xX.Bcov = pinv(K*W*X)*xX.V*pinv(K*W*X)'.
|
|
114
|
+
|
|
115
|
+
If you do not want ML estimates but want to use ordinary least squares
|
|
116
|
+
(OLS) then simply set SPM.xX.W to the identity matrix. Any non-sphericity
|
|
117
|
+
V will still be estimated but will be used to adjust the degrees of freedom
|
|
118
|
+
of the ensuing statistics using the Satterthwaite approximation (c.f.
|
|
119
|
+
the Greenhouse-Geisser corrections).
|
|
120
|
+
|
|
121
|
+
If [non-spherical] variance components Vi are not specified xVi.Vi and
|
|
122
|
+
xVi.V default to the identity matrix (i.e. i.i.d). The parameters are
|
|
123
|
+
then estimated by OLS. In this instance the OLS and ML estimates are
|
|
124
|
+
the same.
|
|
125
|
+
|
|
126
|
+
Note that only a single voxel-specific hyperparameter (i.e. variance
|
|
127
|
+
component) is estimated, even if V is not i.i.d. This means spm_spm
|
|
128
|
+
always implements a fixed-effects model.
|
|
129
|
+
Random effects models can be emulated using a multi-stage procedure:
|
|
130
|
+
This entails summarising the data with contrasts such that the fixed
|
|
131
|
+
effects in a second model on the summary data are those effects of
|
|
132
|
+
interest (i.e. the population effects). This means contrasts are
|
|
133
|
+
re-entered into spm_spm to make an inference (SPM) at the next
|
|
134
|
+
level. At this higher hierarchical level the residual variance for the
|
|
135
|
+
model contains the appropriate variance components from lower levels.
|
|
136
|
+
|
|
137
|
+
Under the additional assumption that the standardised error fields
|
|
138
|
+
are non-stationary standard Gaussian random fields, results from
|
|
139
|
+
Random field theory can be applied to estimate the significance
|
|
140
|
+
statistic images (SPM's) adjusting p values for the multiple tests
|
|
141
|
+
at all voxels in the search volume. The parameters required for
|
|
142
|
+
this random field correction are the volume, and Lambda, the covariance
|
|
143
|
+
matrix of partial derivatives of the standardised error fields, estimated
|
|
144
|
+
by spm_est_smoothness.
|
|
145
|
+
|
|
146
|
+
----------------
|
|
147
|
+
|
|
148
|
+
The volume analysed is the intersection of the threshold masks,
|
|
149
|
+
explicit masks and implicit masks. See spm_spm_ui for further details
|
|
150
|
+
on masking options.
|
|
151
|
+
__________________________________________________________________________
|
|
152
|
+
|
|
153
|
+
The output of spm_spm takes the form of an SPM.mat file of the analysis
|
|
154
|
+
parameters, and 'float' flat-file images of the parameter and variance
|
|
155
|
+
[hyperparameter] estimates. An 8bit zero-one mask image indicating the
|
|
156
|
+
voxels assessed is also written out, with zero indicating voxels outside
|
|
157
|
+
the analysed volume.
|
|
158
|
+
|
|
159
|
+
----------------
|
|
160
|
+
|
|
161
|
+
The following SPM.fields are set by spm_spm (unless specified)
|
|
162
|
+
|
|
163
|
+
xVi.V - estimated non-sphericity trace(V) = rank(V)
|
|
164
|
+
xVi.h - hyperparameters xVi.V = xVi.h(1)*xVi.Vi{1} + ...
|
|
165
|
+
xVi.Cy - spatially whitened <Y*Y'> (used by ReML to estimate h)
|
|
166
|
+
|
|
167
|
+
----------------
|
|
168
|
+
|
|
169
|
+
Vbeta - struct array of beta image handles (relative)
|
|
170
|
+
VResMS - file struct of ResMS image handle (relative)
|
|
171
|
+
VM - file struct of Mask image handle (relative)
|
|
172
|
+
|
|
173
|
+
----------------
|
|
174
|
+
|
|
175
|
+
xX.W - if not specified W*W' = inv(x.Vi.V)
|
|
176
|
+
xX.V - V matrix (K*W*Vi*W'*K') = correlations after K*W is applied
|
|
177
|
+
xX.xKXs - space structure for K*W*X, the 'filtered and whitened'
|
|
178
|
+
design matrix
|
|
179
|
+
- given as spm_sp('Set',xX.K*xX.W*xX.X) - see spm_sp
|
|
180
|
+
xX.pKX - pseudoinverse of K*W*X, computed by spm_sp
|
|
181
|
+
xX.Bcov - xX.pKX*xX.V*xX.pKX - variance-covariance matrix of
|
|
182
|
+
parameter estimates
|
|
183
|
+
(when multiplied by the voxel-specific hyperparameter ResMS
|
|
184
|
+
of the parameter estimates (ResSS/xX.trRV = ResMS) )
|
|
185
|
+
xX.trRV - trace of R*V
|
|
186
|
+
xX.trRVRV - trace of RVRV
|
|
187
|
+
xX.erdf - effective residual degrees of freedom (trRV^2/trRVRV)
|
|
188
|
+
xX.nKX - design matrix (xX.xKXs.X) scaled for display
|
|
189
|
+
(see spm_DesMtx('sca',... for details)
|
|
190
|
+
|
|
191
|
+
----------------
|
|
192
|
+
|
|
193
|
+
xVol.M - 4x4 voxel->mm transformation matrix
|
|
194
|
+
xVol.iM - 4x4 mm->voxel transformation matrix
|
|
195
|
+
xVol.DIM - image dimensions - column vector (in voxels)
|
|
196
|
+
xVol.XYZ - 3 x S vector of in-mask voxel coordinates
|
|
197
|
+
xVol.S - Lebesgue measure or volume (in voxels)
|
|
198
|
+
xVol.R - vector of resel counts (in resels)
|
|
199
|
+
xVol.FWHM - Smoothness of components - FWHM, (in voxels)
|
|
200
|
+
|
|
201
|
+
----------------
|
|
202
|
+
|
|
203
|
+
xCon - Contrast structure (created by spm_FcUtil.m)
|
|
204
|
+
xCon.name - Name of contrast
|
|
205
|
+
xCon.STAT - 'F', 'T' or 'P' - for F/T-contrast ('P' for PPMs)
|
|
206
|
+
xCon.c - (F) Contrast weights
|
|
207
|
+
xCon.X0 - Reduced design matrix (spans design space under Ho)
|
|
208
|
+
It is in the form of a matrix (spm99b) or the
|
|
209
|
+
coordinates of this matrix in the orthogonal basis
|
|
210
|
+
of xX.X defined in spm_sp.
|
|
211
|
+
xCon.iX0 - Indicates how contrast was specified:
|
|
212
|
+
If by columns for reduced design matrix then iX0 contains
|
|
213
|
+
the column indices. Otherwise, it's a string containing
|
|
214
|
+
the spm_FcUtil 'Set' action: Usually one of {'c','c+','X0'}
|
|
215
|
+
(Usually this is the input argument F_iX0.)
|
|
216
|
+
xCon.X1o - Remaining design space (orthogonal to X0).
|
|
217
|
+
It is in the form of the coordinates of this matrix in
|
|
218
|
+
the orthogonal basis of xX.X defined in spm_sp.
|
|
219
|
+
xCon.eidf - Effective interest degrees of freedom (numerator df)
|
|
220
|
+
xCon.Vcon - ...for handle of contrast/ESS image (empty at this stage)
|
|
221
|
+
xCon.Vspm - ...for handle of SPM image (empty at this stage)
|
|
222
|
+
__________________________________________________________________________
|
|
223
|
+
|
|
224
|
+
The following images are written to disk:
|
|
225
|
+
|
|
226
|
+
mask.<ext> - analysis mask image
|
|
227
|
+
8-bit (uint8) image of zero-s & one's indicating which voxels were
|
|
228
|
+
included in the analysis. This mask image is the intersection of the
|
|
229
|
+
explicit, implicit and threshold masks specified in the xM argument.
|
|
230
|
+
The XYZ matrix contains the voxel coordinates of all voxels in the
|
|
231
|
+
analysis mask. The mask image is included for reference, but is not
|
|
232
|
+
explicitly used by the results section.
|
|
233
|
+
|
|
234
|
+
----------------
|
|
235
|
+
|
|
236
|
+
beta_????.<ext> - parameter images
|
|
237
|
+
These are 32-bit (float32) images of the parameter estimates. The image
|
|
238
|
+
files are numbered according to the corresponding column of the
|
|
239
|
+
design matrix. Voxels outside the analysis mask (mask.<ext>) are given
|
|
240
|
+
value NaN.
|
|
241
|
+
|
|
242
|
+
----------------
|
|
243
|
+
|
|
244
|
+
ResMS.<ext> - estimated residual variance image
|
|
245
|
+
This is a 64-bit (float64) image of the residual variance estimate.
|
|
246
|
+
Voxels outside the analysis mask are given value NaN.
|
|
247
|
+
|
|
248
|
+
----------------
|
|
249
|
+
|
|
250
|
+
RPV.<ext> - estimated resels per voxel image
|
|
251
|
+
This is a 64-bit (float64) image of the RESELs per voxel estimate.
|
|
252
|
+
Voxels outside the analysis mask are given value 0. These images
|
|
253
|
+
reflect the nonstationary aspects the spatial autocorrelations.
|
|
254
|
+
|
|
255
|
+
----------------
|
|
256
|
+
|
|
257
|
+
ResI_????.<ext> - standardised residual (temporary) images
|
|
258
|
+
These are 64-bit (float64) images of standardised residuals. At most
|
|
259
|
+
maxres images will be saved and used by spm_est_smoothness, after which
|
|
260
|
+
they will be deleted.
|
|
261
|
+
__________________________________________________________________________
|
|
262
|
+
|
|
263
|
+
References:
|
|
264
|
+
|
|
265
|
+
Statistical Parametric Maps in Functional Imaging: A General Linear
|
|
266
|
+
Approach. Friston KJ, Holmes AP, Worsley KJ, Poline JB, Frith CD,
|
|
267
|
+
Frackowiak RSJ. (1995) Human Brain Mapping 2:189-210.
|
|
268
|
+
|
|
269
|
+
Analysis of fMRI Time-Series Revisited - Again. Worsley KJ, Friston KJ.
|
|
270
|
+
(1995) NeuroImage 2:173-181.
|
|
271
|
+
__________________________________________________________________________
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_spm.m )
|
|
275
|
+
|
|
276
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
277
|
+
"""
|
|
278
|
+
return Runtime.call("spm_spm", *args, **kwargs)
|
spm/spm_spm_Bayes.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_spm_Bayes(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
Conditional parameter estimation of a General Linear Model
|
|
7
|
+
FORMAT [SPM] = spm_spm_Bayes(SPM)
|
|
8
|
+
__________________________________________________________________________
|
|
9
|
+
|
|
10
|
+
spm_spm_Bayes returns to voxels identified by spm_spm (ML parameter
|
|
11
|
+
estimation) to get conditional parameter estimates and ReML hyper-
|
|
12
|
+
parameter estimates. These estimates use prior covariances, on the
|
|
13
|
+
parameters, from empirical Bayes. These PEB prior variances come from
|
|
14
|
+
the hierarchical model that obtains by considering voxels as providing a
|
|
15
|
+
second level. Put simply, the variance in parameters, over voxels, is
|
|
16
|
+
used as a prior variance from the point of view of any one voxel. The
|
|
17
|
+
error covariance hyperparameters are re-estimated in the light of these
|
|
18
|
+
priors. The approach adopted is essentially a fully Bayesian analysis at
|
|
19
|
+
each voxel, using empirical Bayesian prior variance estimators over
|
|
20
|
+
voxels.
|
|
21
|
+
|
|
22
|
+
Each separable partition (i.e. session) is assigned its own
|
|
23
|
+
hyperparameter but within session covariance components are lumped
|
|
24
|
+
together, using their relative expectations over voxels. This makes
|
|
25
|
+
things much more computationally efficient and avoids inefficient
|
|
26
|
+
voxel-specific multiple hyperparameter estimates.
|
|
27
|
+
|
|
28
|
+
spm_spm_Bayes adds the following fields to SPM:
|
|
29
|
+
|
|
30
|
+
----------------
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
SPM.PPM.l = session-specific hyperparameter means
|
|
34
|
+
SPM.PPM.Cb = empirical prior parameter covariances
|
|
35
|
+
SPM.PPM.C = conditional covariances of parameters
|
|
36
|
+
SPM.PPM.dC{i} = dC/dl;
|
|
37
|
+
SPM.PPM.ddC{i} = ddC/dldl
|
|
38
|
+
|
|
39
|
+
The derivatives are used to compute the conditional variance of various
|
|
40
|
+
contrasts in spm_getSPM, using a Taylor expansion about the hyperparameter
|
|
41
|
+
means.
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
----------------
|
|
45
|
+
|
|
46
|
+
SPM.VCbeta - Handles of conditional parameter estimates
|
|
47
|
+
SPM.VHp - Handles of hyperparameter estimates
|
|
48
|
+
|
|
49
|
+
----------------
|
|
50
|
+
|
|
51
|
+
Cbeta_????.<ext> - conditional parameter images
|
|
52
|
+
These are 32-bit (float) images of the conditional estimates. The image
|
|
53
|
+
files are numbered according to the corresponding column of the
|
|
54
|
+
design matrix. Voxels outside the analysis mask (mask.<ext>) are given
|
|
55
|
+
value NaN.
|
|
56
|
+
|
|
57
|
+
----------------
|
|
58
|
+
|
|
59
|
+
CHp_????.<ext> - error covariance hyperparameter images
|
|
60
|
+
This is a 64-bit (double) image of the ReML error variance estimate.
|
|
61
|
+
for each separable partition (Session). Voxels outside the analysis
|
|
62
|
+
mask are given value NaN.
|
|
63
|
+
__________________________________________________________________________
|
|
64
|
+
|
|
65
|
+
For single subject fMRI analysis there is an alternative function
|
|
66
|
+
using voxel-wise GLM-AR models that are spatially regularised
|
|
67
|
+
using the VB framework. This is implemented using spm_spm_vb.m.
|
|
68
|
+
__________________________________________________________________________
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_spm_Bayes.m )
|
|
72
|
+
|
|
73
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
74
|
+
"""
|
|
75
|
+
return Runtime.call("spm_spm_Bayes", *args, **kwargs)
|
spm/spm_spm_Bayes_CY.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_spm_Bayes_CY(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
Estimation of the average sample covariance of whole-brain data.
|
|
7
|
+
|
|
8
|
+
SPM - Structure (see spm_spm.m)
|
|
9
|
+
CY - Matrix of dimension [P x P] where P is the number of volumes
|
|
10
|
+
__________________________________________________________________________
|
|
11
|
+
|
|
12
|
+
Normalisation (and where appropriate, temporal pre-whitening) are
|
|
13
|
+
performed prior to estimation. Voxels are included that exceed a liberal
|
|
14
|
+
statistical threshold, by default p < 0.001 uncorrected for effects of
|
|
15
|
+
interest. The resulting matrix is used in spm_spm_Bayes.m.
|
|
16
|
+
__________________________________________________________________________
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_spm_Bayes_CY.m )
|
|
20
|
+
|
|
21
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
22
|
+
"""
|
|
23
|
+
return Runtime.call("spm_spm_Bayes_CY", *args, **kwargs)
|