#NEWLINE# def _check_size( self , mask ) : #NEWLINE# #INDENT# self . raw = ( self . data . dtype == np . uint8 ) #NEWLINE# if ( self . data . ndim == 5 ) : #NEWLINE# #INDENT# if ( not self . raw ) : #NEWLINE# #INDENT# raise ValueError ( 'Invalid data shape' ) #NEWLINE# #UNINDENT# self . linear = False #NEWLINE# self . movie = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . data . ndim == 4 ) : #NEWLINE# #INDENT# self . linear = False #NEWLINE# self . movie = ( not self . raw ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . data . ndim == 3 ) : #NEWLINE# #INDENT# self . linear = self . movie = self . raw #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . data . ndim == 2 ) : #NEWLINE# #INDENT# self . linear = True #NEWLINE# self . movie = ( not self . raw ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . data . ndim == 1 ) : #NEWLINE# #INDENT# self . linear = True #NEWLINE# self . movie = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'Invalid data shape' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if self . linear : #NEWLINE# #INDENT# if ( mask is None ) : #NEWLINE# #INDENT# nvox = self . data . shape [ ( ( - 2 ) if self . raw else ( - 1 ) ) ] #NEWLINE# if self . raw : #NEWLINE# #INDENT# nvox = self . data . shape [ ( - 2 ) ] #NEWLINE# #UNINDENT# ( self . masktype , self . mask ) = _find_mask ( nvox , self . subject , self . xfmname ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( mask , str ) : #NEWLINE# #INDENT# self . mask = surfs . getMask ( self . subject , self . xfmname , mask ) #NEWLINE# self . masktype = mask #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( mask , np . ndarray ) : #NEWLINE# #INDENT# self . mask = mask #NEWLINE# self . masktype = 'user-supplied' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . shape = self . mask . shape #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# shape = self . data . shape #NEWLINE# if self . movie : #NEWLINE# #INDENT# shape = shape [ 1 : ] #NEWLINE# #UNINDENT# if self . raw : #NEWLINE# #INDENT# shape = shape [ : ( - 1 ) ] #NEWLINE# #UNINDENT# xfm = surfs . getXfm ( self . subject , self . xfmname ) #NEWLINE# if ( xfm . shape != shape ) : #NEWLINE# #INDENT# raise ValueError ( 'Volumetric data must be same shape as reference for transform' ) #NEWLINE# #UNINDENT# self . shape = shape