Package mvpa :: Package misc :: Package fsl :: Module melodic

[hide private]
[frames] | no frames]

# Source Code for Module mvpa.misc.fsl.melodic

     1  # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
     2  # vi: set ft=python sts=4 ts=4 sw=4 et:
     3  ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
     4  #
     5  #   See COPYING file distributed along with the PyMVPA package for the
     6  #   copyright and license terms.
     7  #
     8  ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
     9  """Wrapper around the output of MELODIC (part of FSL)"""
    10
    11  __docformat__ = 'restructuredtext'
    12
    13  import os
    14  import numpy as N
    15
    16  from mvpa.base import externals
    17  if externals.exists('nifti', raiseException=True):
    18      import nifti
    19
    20
    21 -class MelodicResults( object ):
    22      """Easy access to MELODIC output.
    23
    24      Only important information is available (important as judged by the
    25      author).
    26      """
    27 -    def __init__( self, path ):
    28          """Reads all information from the given MELODIC output path.
    29          """
    30          self.__outputpath = path
    31          self.__icapath = os.path.join( path, 'filtered_func_data.ica' )
    32          self.__ic = \
    33              nifti.NiftiImage( os.path.join( self.__icapath,
    34                                              'melodic_IC' ) )
    35          self.__funcdata = \
    36              nifti.NiftiImage( os.path.join( self.__outputpath,
    37                                              'filtered_func_data' ) )
    38          self.__tmodes = N.fromfile( os.path.join( self.__icapath,
    39                                                    'melodic_Tmodes' ),
    40                                      sep = ' ' ).reshape( self.tr, self.nic )
    41          self.__smodes = N.fromfile( os.path.join( self.__icapath,
    42                                                    'melodic_Smodes' ),
    43                                      sep = ' ' )
    44          self.__icstats = N.fromfile( os.path.join( self.__icapath,
    45                                                     'melodic_ICstats' ),
    46                                       sep = ' ' ).reshape( self.nic, 4 )
    47
    48      # properties
    49      path     = property( fget=lambda self: self.__respath )
    50      ic       = property( fget=lambda self: self.__ic )
    51      nic      = property( fget=lambda self: self.ic.extent[3] )
    52      funcdata = property( fget=lambda self: self.__funcdata )
    53      tr       = property( fget=lambda self: self.funcdata.extent[3] )
    54      tmodes   = property( fget=lambda self: self.__tmodes )
    55      smodes   = property( fget=lambda self: self.__smodes )
    56      icastats = property( fget=lambda self: self.__icstats )
    57      relvar_per_ic  = property( fget=lambda self: self.__icstats[:, 0] )
    58      truevar_per_ic = property( fget=lambda self: self.__icstats[:, 1] )
    59