Skip to content

Instantly share code, notes, and snippets.

View dangom's full-sized avatar

Daniel Gomez dangom

  • Cambridge, MA
View GitHub Profile
@dangom
dangom / registration.sh
Created August 31, 2022 21:01
Registration example
#!/usr/bin/env bash
fixedfile=$1
movingfile=$2
output=$3
antsRegistration --dimensionality 3 --float 0 --verbose 1 \
--output [$output,${output}.nii.gz] \
--interpolation LanczosWindowedSinc \
--winsorize-image-intensities [0.005,0.995] \
;;; to download all abstracts:
;;; parallel wget --no-clobber --no-parent -r "https://submissions.mirasmart.com/ISMRM2022/Itinerary/Files/PDFFiles/{}.html" ::: $(seq -f "%04g" 00 10000)
;;; Make a simple index so I can search through abstracts in emacs
;;; So that other people can use it, I have put this into an index.html and use a js search framework that mimics completing-read.
;;; See for example https://cheatcode.co/tutorials/how-to-implement-client-side-search-with-fuse-js
;;;
;; List and open any file on eww
(defvar ismrm-abstract-dir "/Users/dg/ismrm2022/PROGRAM/")
(defun ismrm--find-abstract-file ()
@dangom
dangom / scanner.sh
Created April 19, 2022 15:26 — forked from andyrbell/scanner.sh
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@dangom
dangom / org-roam-weeklies.el
Created February 4, 2021 03:43
Weekly notes for org-roam
;;; org-roam-weeklies.el --- Weekly-notes for Org-roam -*- coding: utf-8; lexical-binding: t; -*-
;;;
;; Copyright © 2020 Jethro Kuan <[email protected]>
;; Copyright © 2020 Leo Vivier <[email protected]>
;; Author: Jethro Kuan <[email protected]>
;; Leo Vivier <[email protected]>
;; URL: https://github.com/org-roam/org-roam
;; Keywords: org-mode, roam, convenience
;; Version: 1.2.3
@dangom
dangom / mecombine.py
Last active March 10, 2024 03:20
Optimal echo combination accounting for motion correction
""" Echo combination.
1. Motion correction
2. Compute weights on motion corrected data
3. Apply inverse transform on weights
4. Apply weights on original data to minimize interpolation.
Methods:
For the echo combination, the first echo was motion corrected using ANTs for
rigid transformation. The transforms were subsequently applied to the later
echoes. The mean images of the motion corrected echoes were subsequently used
for estimating a T2star map. Weights for each echo were computed from the T2star
@dangom
dangom / mm
Created October 24, 2018 13:27
values for ica output
0.016043 0.002221 -0.035477 0.002108 0.021356 0.007767 -0.000762 -0.007581 0.001191 0.021943
0.009563 0.020156 -0.035227 -0.003960 0.010329 -0.036748 0.010542 0.000222 0.001448 0.021009
0.009083 -0.004882 -0.043019 -0.008569 0.005001 0.007674 -0.006975 -0.001861 0.008550 0.019023
0.004607 -0.002042 -0.044749 -0.005607 0.008006 0.018350 -0.005890 -0.004179 0.001811 0.019777
0.000673 -0.005753 -0.045365 -0.001488 0.016821 0.000359 -0.005611 -0.013906 -0.000032 0.027898
-0.006095 -0.003364 -0.043093 -0.007743 0.022372 0.007518 -0.005686 -0.004445 -0.004046 0.024409
-0.001820 0.015352 -0.037703 0.004821 0.020568 -0.028915 0.006992 -0.009169 -0.020281 0.016134
0.003075 -0.002990 -0.048372 0.012588 0.003329 0.007372 -0.015720 -0.007468 0.001225 0.016118
0.008469 0.001528 -0.051274 0.008134 0.033441 0.006119 -0.000766 -0.009467 0.003871 0.014437
0.005616 -0.000346 -0.047836 -0.002901 0.021321 -0.002379 -0.000779 -0.022400 -0.007
@dangom
dangom / foo.json
Created October 22, 2018 11:53
foo
{
"links": [
{
"source": 0,
"target": 3,
"value": 13
},
{
"source": 0,
"target": 6,
@dangom
dangom / discrete_cmap.py
Created July 31, 2018 14:57 — forked from jakevdp/discrete_cmap.py
Small utility to create a discrete matplotlib colormap
# By Jake VanderPlas
# License: BSD-style
import matplotlib.pyplot as plt
import numpy as np
def discrete_cmap(N, base_cmap=None):
"""Create an N-bin discrete colormap from the specified input map"""
import subprocess
import io
import pandas as pd
# The fslcc binary to use
FSLCC = '/opt/fsl/5.0.11/bin/fslcc'
# Parameters for the command line. No thresholding, report 4 digits.
FSLCC_PARAMS = ['-t', '0', '-p', '4']
@dangom
dangom / jq-insert-var.sh
Created April 13, 2018 15:47 — forked from joar/jq-insert-var.sh
Add a field to an object with JQ
# Add field
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}'
# {
# "hello": "world",
# "foo": "bar"
# }
# Override field value
echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}'
{