Exemple #1
0
    def _run_interface(self, runtime):
        sxfmout = self.inputs.sxfmout
        hemi = self.inputs.hemi

        data = nb.load(sxfmout).get_data()
        origdata = data.shape
        affine = None
        data.resize(data.shape[0]*data.shape[2],1,1,data.shape[3]) #in case of fsaverage, where nifti splits large dim

        sourcemask = np.zeros(origdata, dtype=np.int)
        targetmask = np.zeros(origdata, dtype=np.int)

        #define which vertices are in the ROI
        source_vertices = get_vertices(self.inputs.hemi, self.inputs.freesurferdir, self.inputs.fs, self.inputs.sourcelabels)
        target_vertices = get_vertices(self.inputs.hemi, self.inputs.freesurferdir, self.inputs.fs, self.inputs.targetlabels)

        #create masks for source and target vertices
        sourcemask[source_vertices] = 1
        targetmask[target_vertices] = 1

        targetmask.resize(origdata)
        targetmaskImg = nb.Nifti1Image(targetmask, affine)
        nb.save(targetmaskImg, os.path.abspath('surfacemask.nii'))

        ## make new input data with source mask
        sourcedata = np.where(sourcemask,data,0)
        sourcedata.resize(origdata)
        sourcedataImg = nb.Nifti1Image(sourcedata, affine)
        nb.save(sourcedataImg, os.path.abspath('surfacedata.nii'))

        return runtime
Exemple #2
0
    #'0115321',  '0122844',  '0132717',  '0141860',  '0153790',  '0163508',  '0171391',  '0182376',  '0194956'
]

exclude_subjects = ["0021001", "0172228"]  # 0021001- strange morphometry, 0172228- no 1400
subjects = list(set(subjects) - set(exclude_subjects))

sessions = ["mx_645", "mx_1400", "std_2500"]

##ROI LABELS##

# Volume Data#
volume_sourcelabels = [
    -1
]  # -1 means No Volume #Example: [12114, 12113] #ctx_rh_G_front_inf-Triangul, ctx_rh_G_front_inf-Orbital
volume_targetlabels = [-1]

# Surface Data#
surface_sourcelabels = []  # empty set [] means all surface vertices
surface_targetlabels = [1, 5, 13, 14, 15, 16, 24, 31, 32, 39, 40, 53, 54, 55, 63, 64, 65, 71]  # preFrontal Cortex
lhsource = get_vertices("lh", freesurferdir, surface_sourcelabels)
rhsource = get_vertices("rh", freesurferdir, surface_sourcelabels)
lhvertices = get_vertices("lh", freesurferdir, surface_targetlabels)
rhvertices = get_vertices("rh", freesurferdir, surface_targetlabels)

# Analysis Parameters#
hemispheres = ["lh", "rh"]
similarity_types = ["temp", "eta2", "spat"]
cluster_types = ["hiercluster", "kmeans", "spectral", "dbscan"]
n_clusters = [6]  # [2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22]
epsilon = 0.03