Download instructions

Get the code and example data

For the impatient

  • To verify that the CoSMoMVPA configuration is set properly and the tutorial dataset can be found by cosmo config, run the following in Matlab / Octave:

    config=cosmo_config();
    data_path=fullfile(config.tutorial_data_path,'ak6','s01');
    ds=cosmo_fmri_dataset(fullfile(data_path,'vt_mask.nii'),'mask',true);
    cosmo_map2fmri(ds,fullfile(config.output_data_path,'test.nii'));
    

    If no errors are raised and a file test.nii is created in the output_data_path, then you are good to go.

For the patient

The Matlab / Octave code (in mvpa/) is required for analyses in CoSMoMVPA; the tutorial data is required to run the exercises and the demos, which are included in the examples/ directory.

  • Installation of CoSMoMVPA:

    • Users on a Unix-like (Linux, OSX) platform using the command line:

      git clone https://github.com/CoSMoMVPA/CoSMoMVPA.git
      make -C CoSMoMVPA install
      
    • Manually:

      • Download the zip archive.

      • Add the source code directories to the Matlab / Octave path, by changing the directory to the CoSMoMVPA /mvpa directory, then run:

        cosmo_set_path
        

        (alternatively, add the mvpa and external directories, and their subdirectories to the path, using addpath).

        Then run

        savepath
        

        to store the new path permanently.

    To check that things are working, run:

    cosmo_wtf
    

    which should provide a report of available system information.

  • (Matlab users can skip this step) For users of Octave, some additional packages from Octave-Force are required. First run the following from the Octave prompt:

    pkg install -forge io
    pkg install -forge nan
    pkg install -forge statistics
    pkg install -forge general
    pkg install -forge miscellaneous
    

    To activate these packages, run the following commands:

    pkg load io
    pkg load nan
    pkg load statistics
    pkg load general
    pkg load miscellaneous
    

    To load these packages automatically when Octave is started, it is recommended to add the following at the end of the .octaverc file (which is typically located in the user’s home directory). Note that the first command switches off the more program for viewing output, so that all output is show directly in the command window:

    more off
    pkg load io
    pkg unload nan
    pkg load nan
    pkg load statistics
    pkg load miscellaneous
    pkg load general
    
  • Set the location of the tutorial data in a text file named .cosmomvpa.cfg (in a directory that is in the matlab path), as described in the Notes section of cosmo config hdr.

    • Use cosmo_wizard_set_config in CoSMoMVPA’s examples/ directory, if you prefer a simple-to-use graphical user interface.

    • To do so manually:

      • If you do not know where to store the file, just close and start Matlab afresh (so that it starts in a location that is in the Matlab path), and run

        edit .cosmomvpa.cfg
        

        Alternatively, go to CoSMoMVPA’s mvpa/ directory and store the .cosmomvpa.cfg file there (the disadvantage of this location is that the file may be lost if code is updated by downloading an updated .zip-file).

      • Note for Windows users: when creating a new file, Windows may add (but hide) a .txt extension. It may be better to edit the file from Matlab.

      • Note for Unix (OSX, Linux) users: the file can be stored in the users’ $HOME directory.

      • Note for Unix (OSX, Linux) users: the file will not be shown in the terminal when using ls, because the leading dot in the filename makes it hidden. To show hidden files, use ls -a.

      • Add the lines for tutorial_data_path and output_data_path, and save the file.

      • For example, on Apple OSX .cosmomvpa.cfg could be stored in the /Users/karen home directory (for a user named karen), and contain the following:

        tutorial_data_path=/Users/karen/datasets/CoSMoMVPA/datadb/tutorial_data
        output_data_path=/Users/karen/tmp/CoSMoMVPA_output
        

      You can choose in which directory you would like to store the output for from running the examples and demonstrations; just make sture that the output_data_path directory exists. You can create a new directory for the output if you want.

  • To verify that the CoSMoMVPA configuration is set properly and the tutorial dataset can be found by cosmo config, run the following in Matlab / Octave:

    config=cosmo_config();
    data_path=fullfile(config.tutorial_data_path,'ak6','s01');
    ds=cosmo_fmri_dataset(fullfile(data_path,'vt_mask.nii'),'mask',true);
    cosmo_map2fmri(ds,fullfile(config.output_data_path,'test.nii'));
    

    If no errors are raised and a file test.nii is created in the output_data_path, then you are good to go.

Keep your code up to date

CoSMoMVPA code may change rapidly. To stay up to date:

  • git users (assuming you followed the instructions to get the code):

    git checkout master
    git pull origin master
    
  • everybody else: you would have to re-download the zip archive and update your local .m files. (At the moment we do not provide automatic detection of code that is out of date.)

External dependencies

Certain functionality require certain external toolboxes:

For operations that require external toolboxes, CoSMoMVPA will check their presence. If a required external toolbox is not available, an error message is given with download instructions.

Developers

Contributions are welcomed! Please see Information for contributors.

We use a build system for generating documentation. This build system only supports Unix-like systems, and dependencies include Sphinx, Python, and sphinxcontrib-matlabdomain. For details see Setting up the documentation build system.

Unit tests require either the xUnit or MOxUnit toolbox and run on both Matlab and Octave. Doc tests are currently only supported for xUnit, which only runs on Matlab (not on Octave). MOxUnit does not support doc tests because Octave does not support the evalc command.