1
2
3
4
5
6
7
8
9 """Wrapper around the output of MELODIC (part of FSL)"""
10
11 __docformat__ = 'restructuredtext'
12
13 import numpy as N
14 import nifti
15 import os
16
18 """Easy access to MELODIC output.
19
20 Only important information is available (important as judged by the
21 author).
22 """
24 """Reads all information from the given MELODIC output path.
25 """
26 self.__outputpath = path
27 self.__icapath = os.path.join( path, 'filtered_func_data.ica' )
28 self.__ic = \
29 nifti.NiftiImage( os.path.join( self.__icapath,
30 'melodic_IC' ) )
31 self.__funcdata = \
32 nifti.NiftiImage( os.path.join( self.__outputpath,
33 'filtered_func_data' ) )
34 self.__tmodes = N.fromfile( os.path.join( self.__icapath,
35 'melodic_Tmodes' ),
36 sep = ' ' ).reshape( self.tr, self.nic )
37 self.__smodes = N.fromfile( os.path.join( self.__icapath,
38 'melodic_Smodes' ),
39 sep = ' ' )
40 self.__icstats = N.fromfile( os.path.join( self.__icapath,
41 'melodic_ICstats' ),
42 sep = ' ' ).reshape( self.nic, 4 )
43
44
45 path = property( fget=lambda self: self.__respath )
46 ic = property( fget=lambda self: self.__ic )
47 nic = property( fget=lambda self: self.ic.extent[3] )
48 funcdata = property( fget=lambda self: self.__funcdata )
49 tr = property( fget=lambda self: self.funcdata.extent[3] )
50 tmodes = property( fget=lambda self: self.__tmodes )
51 smodes = property( fget=lambda self: self.__smodes )
52 icastats = property( fget=lambda self: self.__icstats )
53 relvar_per_ic = property( fget=lambda self: self.__icstats[:, 0] )
54 truevar_per_ic = property( fget=lambda self: self.__icstats[:, 1] )
55