def setReslicedGM(self, rgm): """ Sets the resliced gray matter segmentation file (rc1_....nii if SPM was used) :param rgm: string, path to the resliced GM segmentation file """ self.rgm = checkFileExists( rgm, 'resliced WM segmentation map (rc1_filename.nii)')
def setMovementParameterFile(self, rp_file): """ Sets the movement parameters across the functional run (rp_....txt file if SPM was used) :param rp_file: string, path to the estimated movement parameters """ self.movementParamFile = checkFileExists( rp_file, 'Estimated movement (rp_filename.txt)')
def setReslicedCSF(self, rcsf): """ Sets the resliced cerebrospinal fluid segmentation file (rc3_....nii if SPM was used) :param rcsf: string, path to the resliced CSF segmentation file """ self.rcsf = checkFileExists( rcsf, 'resliced CSF segmentation map (rc3_filename.nii)')
def setReslicedWM(self, rwm): """ Sets the resliced white matter segmentation file (rc2_....nii if SPM was used) :param rwm: string, path to the resliced WM segmentation file """ self.rwm = checkFileExists( rwm, 'resliced WM segmentation map (rc2_filename.nii)')
def setFunctionalFileToDisplay(self, fn_file): """ Sets the functional nifti filename (.nii or.nii.gz) used to display on the figure :param fn_file: str, path to the 4D functional file """ self.functional_fn = nib.load( checkFileExists(fn_file, 'Functional run (functional_filename.nii)')) # Sets the raw data directly in class attribute self.f_img = self.functional_fn.get_data() self.Nt = self.f_img.shape[-1]
def setFunctionalData(self, fn_file): """ Sets the path to nifti (.nii or .nii.gz) functional 4D file. Loads the file with nibabel and sets the data into self.f_img :param fn_file: string, path to the functional file """ self.functional_fn = checkFileExists( fn_file, 'Functional run (functional_filename.nii)') # Load file directly f = nib.load(self.functional_fn) self.f_hdr = f.get_header() self.f_aff = f.get_affine() # Sets the raw data directly in class attribute self.f_img = f.get_data() # (Ni,Nj,Nk) = number of voxels in the (X,Y,Z) dimension # Nt = number of fMRI timepoints (=number of volumes) self.fn_shape = [self.Ni, self.Nj, self.Nk, self.Nt] = self.f_img.shape #Sets the default slice index for generating the plot self.setDefaultSliceIndex()