项目作者: chris-langfield

项目描述 :
Python library for setting up FEAT analyses (FSL)
高级语言: Python
项目地址: git://github.com/chris-langfield/fslfeatsetup.git
创建时间: 2021-06-02T22:46:53Z
项目社区:https://github.com/chris-langfield/fslfeatsetup

开源协议:Other

下载


devstatus pypi_badge

NOT currently maintained. Use at own risk.

fslfeatsetup

Python functions to create an FSL FEAT configuration file (.fsf)

Can be run from python command line/REPL or incorporated into a script

Alpha version available on PyPI

pip install fslfeatsetup

Feel free to contribute

DOCUMENTATION generated by pydoc-markdown

On Python Package Index

Overview

The .fsf file is represented by the class FeatSettings, which is constructed with the analysis level and analysis type options.

featoptions

Each panel of the FEAT GUI is represented by a separate class, taking the initial FeatSettings object as its argument. Each of these objects has a Configure() function taking keyword arguments specifying the options available in that panel of the GUI. These are the MiscOptions, DataOptions, PreStatsOptions, RegOptions, StatsOptions, and PostStatsOptions classes.

For example the checkboxes and inputs on the Misc Options GUI panel correspond to the key-word arguments in the MiscOptions.Configure() function.

MiscOptions.Configure(brainThreshold=10, noiseLevel=0.66, temporalSmoothness=0.05, zThreshold=5.3, cleanupFirstLevel=False, overwriteOriginalPostStats = False, estimateNoiseFromData=False)

(Some of these options pertain only to higher-level analyses)

featmisc

Dropdown lists are represented by enum-like classes:

PreStatsOptions.Configure(st = FeatSliceTiming.REGULAR_UP)

PreStatsOptions.Configure(st = FeatSliceTiming.TIMING_FILE, sliceTimingFile = "path/to/file")

featdropdown

First-level analysis example

  1. from fslfeatsetup.FSF import *
  2. from fslfeatsetup.EVs import *
  3. from fslfeatsetup.FSFLabels import *
  4. SubjectFMRI = [ ... ]
  5. SubjectStructurals = [ ... ]
  6. for i in range(len(SubjectFMRI)):
  7. # initialize the FeatSettings object
  8. FSF = FeatSettings(FeatLevel.FIRST_LEVEL, FeatAnalysis.FULL_ANALYSIS)
  9. # Configure the Data options
  10. Data = DataOptions(FSF)
  11. # The only required inputs are the output FEAT directory, and the list of
  12. # FMRI files (or lower-level feats, see Higher Level Analysis example
  13. Data.Configure("path/to/output/subject_i",[SubjectFMRI[i]])
  14. # Configure the Miscellaneous options
  15. Misc = MiscOptions(FSF)
  16. # There are NO required inputs. Using the defaults specified in my FSL installation.
  17. # If fslfeatsetup needs an option that is not in the defaults, it will let you know
  18. Misc.Configure()
  19. # Configure Registration options
  20. Reg = RegOptions(FSF)
  21. # I can specify a standard to use, or I can go with the default 2mm MNI152, as I am here
  22. Reg.ConfigureStandardSpace()
  23. # The only required argument
  24. Reg.ConfigureMainStructural([SubjectStructurals[i]])
  25. # If I don't want to use expanded functional data, I simply don't configure it
  26. # Reg.ConfigureExpandedFunctional([ this would be a list of your expanded functional images ])
  27. # Configure Pre-Stats options
  28. PreStats = PreStatsOptions(FSF)
  29. # The library has built-in enum-like structures that hardcode the FEAT options
  30. PreStats.Configure(sliceTiming=FeatSliceTiming.TIMING_FILE,
  31. sliceTimingFile="path/to/slice/timing/file",
  32. bet=True)
  33. # Configure Stats options
  34. Stats = StatsOptions(FSF)
  35. # using all defaults, so I don't need to specify keyword arguments
  36. Stats.Configure()
  37. # Add EVs from custom 3 column text formats.
  38. # Note that ONLY the 3-column text file format is currently supported
  39. # specify the parameters of the convolution function, or use defaults
  40. Stats.AddFirstLevelEV("myEV1","path/to/my/EV1",Gamma(phase=0, stdev=3, lag=6))
  41. Stats.AddFirstLevelEV("myEV2","path/to/my/EV2",Gamma())
  42. Stats.AddFirstLevelEV("myEV3","path/to/my/EV3",Gamma())
  43. # orthogonalize
  44. # The argument is a pythonic matrix (list of lists)
  45. # the size of this matrix will be one larger than the number of EVs
  46. Stats.OrthogonalizeEVs([ [ 0 for x in range(4)] for y in range(4)])
  47. # Configure Post-Stats options
  48. PostStats = PostStatsOptions(FSF)
  49. # using all defaults except for min and max Z-threshold for rendering
  50. PostStats.Configure(zmin = 2, zmax= 8)
  51. # write to .fsf file
  52. FSF.write("path/to/subject_i/fsf")

Higher-level analysis steps

todo

Changelog

PyPI version Description
0.3.4 fixes related to the Issues page. No methods or classes are different
0.2.8 Generated an .fsf accepted by FEAT. There are a bunch of hard-coded defaults that still need to be fixed
0.2.5 Fixed gammadelay being blank and FSLDIR not found
0.2.3 Patch: quotations for custom EV files
0.2.1 Patched a silly bug
0.2.0 first “complete” version, with post-stats options and auto generated comments. still very much a work in progress
0.1.2 first stable version - package still a work in progress