Skip to content

Instantly share code, notes, and snippets.

View xgrg's full-sized avatar
🤖
gradient decent

Greg Operto xgrg

🤖
gradient decent
View GitHub Profile
@xgrg
xgrg / bullseye.ipynb
Last active April 9, 2021 19:57
Bullseye's representation of cerebral white matter hyperintensities
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xgrg
xgrg / plot_freesurfer.py
Created December 16, 2020 15:27
Create a snapshot from FreeSurfer results
from nisnap import snap
from nisnap.utils import aseg
import sys
aparc_fp, bg, snap_fp = sys.argv[1:]
filepaths = aseg.__preproc_aseg__(aparc_fp, bg)
axes = 'x'
figsize = {'x': (23, 15)}
rowsize = {'x': 8}
@xgrg
xgrg / qc_reg.py
Last active November 17, 2020 11:56
Generating animated snapshots for Quality Control of coregistration
#! /usr/bin/env python
# Usage: python qc_reg.py path_to_T1 path_to_T2 path_to_GIF
import sys
t1_fp, t2_fp, gif_fp = sys.argv[1:]
def ants_snapshot(t1w_fp, coreg_fp):
""" Create 2 sets of snapshots, one with the background (T1) image,
one with the overlay. Both along the 3 axes (axial, coronal and sagittal).
@xgrg
xgrg / nisnap.py
Last active June 9, 2020 13:18
Nisnap SPM_SEGMENT (Carles/Jordi)
import pyxnat
from nisnap import xnat, snap
from glob import glob
import os.path as op
methods = ['T1', 'T1_FLAIR', 'T1_T2', 'T1_maskT1T2']
x = pyxnat.Interface(config='/home/grg/.xnat_goperto_ci.cfg')
dd = '/mnt/projects/Segmentation_ALFA_PLUS_IRENE'
subjects2 = sorted([int(e.split('/')[-1]) for e in glob(op.join(dd, 'segmentacions_T1', '*'))])
subjects = sorted([int(e['subject_label']) for e in x.array.experiments(project_id='ALFA_PLUS',
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xgrg
xgrg / roivalues.ipynb
Last active February 7, 2020 09:35
Collecting ROI values from random brain maps (using github.com/xgrg/roistats)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xgrg
xgrg / snapshots.ipynb
Last active January 22, 2019 18:59
Generating snapshots from XNAT resources
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xgrg
xgrg / Collecting Freesurfer6 features from XNAT.py
Last active January 21, 2019 15:42
Collecting Freesurfer6 features from XNAT
import json
import pandas as pd
import pyxnat
c = pyxnat.Interface(config='/home/grg/.xnat_bsc.cfg')
# Collect experiments
experiments = json.load(open('/home/grg/Downloads/mri_list.json'))
# Querying FreeSurfer resource -if any- from each experiment