Skip to content

Instantly share code, notes, and snippets.

View satra's full-sized avatar

Satrajit Ghosh satra

View GitHub Profile
@satra
satra / joinnode.ipynb
Last active August 29, 2015 14:06
Nipype JoinNode Example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@satra
satra / ro.ttl
Last active August 29, 2015 13:58
RO and prov:Bundle
@prefix daniel: <http://mayor2.dia.fi.upm.es/oeg-upm/files/dgarijo/motifAnalysis/> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ro: <http://purl.org/wf4ever/ro#> .
@prefix schema: <http://schema.org/> .
@prefix xhv: <http://www.w3.org/1999/xhtml/vocab#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@satra
satra / laplacians.py
Created February 25, 2014 01:58
variance laplacians
def _laplacian_dense2(graph, normalization=None, return_diag=False,
max_iters=100, tol=1e-5):
"""Compute different graph Laplacians
"""
dd = np.sum(graph, axis=0)
dd_idx = np.nonzero(dd)[0]
dd_inv = dd
dd_inv[dd_idx] = np.power(dd_inv[dd_idx], -1.)
@satra
satra / DICOMCONVERT_README.md
Last active January 24, 2017 18:58
A dicom converter that uses dcmstack to embed metadata and nipype to track provenance.

This gist describes a flexible dicom converter for organizing brain imaging data into structured directory layouts.

  • it allows customizable directory layouts and naming schemes through heuristic file
  • it only converts the necessary dicoms, not everything in a directory
  • you can keep links to dicom files in the participant layout
  • it's faster than parsesdicomdir or mri_convert if you use dcm2nii option
  • it tracks the provenance of the conversion from dicom to nifti in w3c prov format
  • the example shows a conversion to openfmri layout structure

outputs:

@satra
satra / anstreg.sh
Last active January 18, 2021 08:56
ants registration parameters
antsRegistration --float --collapse-linear-transforms-to-fixed-image-header 0 --collapse-output-transforms 1 --dimensionality 3 --initial-moving-transform [ $FIXED, $MOVING, 1 ] --interpolation Linear --output [ output_, output_warped_image.nii.gz ] --transform Rigid[ 0.1 ] --metric Mattes[ $FIXED, $MOVING, 1, 32, Regular, 0.3 ] --convergence [ 10000x111110x11110, 1e-08, 20 ] --smoothing-sigmas 4.0x2.0x1.0vox --shrink-factors 3x2x1 --use-estimate-learning-rate-once 1 --use-histogram-matching 0 --transform Affine[ 0.1 ] --metric Mattes[ $FIXED, $MOVING, 1, 32, Regular, 0.3 ] --convergence [ 10000x111110x11110, 1e-08, 20 ] --smoothing-sigmas 4.0x2.0x1.0vox --shrink-factors 3x2x1 --use-estimate-learning-rate-once 1 --use-histogram-matching 0 --transform SyN[ 0.2, 3.0, 0.0 ] --metric Mattes[ $FIXED, $MOVING, 0.5, 32 ] --metric CC[ $FIXED, $MOVING, 0.5, 4 ] --convergence [ 100x50x30, -0.01, 5 ] --smoothing-sigmas 1.0x0.5x0.0vox --shrink-factors 4x2x1 --use-estimate-learning-rate-once 1 --use-histogram-matching 1 -
@satra
satra / embed_into_nifti.py
Created September 25, 2013 14:25
Embed dicom metadata into a nifti file
from copy import deepcopy
from dcmstack import DcmMetaExtension
import nibabel as nb
def embed_nifti(dcmfiles, niftifile, force=False):
stack = ds.parse_and_stack(dcmfiles, force=force).values()
if len(stack) > 1:
raise ValueError('Found multiple series')
stack = stack[0]
@satra
satra / twohemi.py
Created July 9, 2013 20:21
show two hemispheres with pysurfer
from surfer import Brain
lh = Brain('fs404', 'lh', 'pial')
rh = Brain('fs404', 'rh', 'pial', figure=lh._f)
lh.add_annotation('aparc', borders=False, alpha=0)
rh.add_annotation('aparc', borders=False, alpha=0.5)
"""
lh._geo_surf.actor.property.opacity = 0.3
rh._geo_surf.actor.property.opacity = 0.3
lh._geo_surf.contour.contours = [0.5]
lh._geo_surf.actor.mapper.progress = 1.0
@satra
satra / bedpostx.py
Created July 7, 2013 15:48
BespostX using Nipype
import argparse
import os
from nipype.pipeline.engine import Workflow, Node, MapNode
from nipype.interfaces.utility import IdentityInterface
from nipype.interfaces.fsl.utils import ImageMaths
from nipype.interfaces.fsl.utils import Split
from nipype.interfaces.fsl.dti import XFibres
from nipype.interfaces.fsl.utils import Merge
from nipype.interfaces.fsl.dti import MakeDyadicVectors
@satra
satra / recon-all-output.txt
Created July 5, 2013 13:47
recon-all T2 pial refinement fails
Step 0: recon-all -subjid H0351.1015 -all -i /data/allen/H0351.1015/T1.nii.gz -openmp 8 -notalairach
Step 1: recon-all -subjid H0351.1015 -T2 /data/allen/H0351.1015/T2.nii.gz -openmp 8
Step 2: recon-all -subjid H0351.1015 -T2pial -openmp 8
WARNING: tcsh v6.17.06 has an exit code bug! Please update tcsh!
Subject Stamp: freesurfer-Linux-centos6_x86_64-stable-pub-v5.3.0
Current Stamp: freesurfer-Linux-centos6_x86_64-stable-pub-v5.3.0
@satra
satra / test.ipynb
Created June 12, 2013 16:22
testing slideshow mode with markdown code
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.