Skip to content

Instantly share code, notes, and snippets.

View jefferis's full-sized avatar

Gregory Jefferis jefferis

View GitHub Profile
#' Release an R package to our local repository on ourserver
#'
#' from where it can then be installed (without this package) by
#' install.packages(pkg,repos='http://ourserver.com/R',type='source')
#'
#' Modified from release function in devtools.
#' @param pkg package description see \link[devtools]{release}
#' @param check if TRUE, run checking, otherwise omit it. This is useful if
#' you've just checked your package and you're ready to release it.
#' @param user defaults to myuser
@jefferis
jefferis / decomposecomposebug.sh
Created November 25, 2013 00:59
Test possible round trip bug in CMTK Compose/Decompose methods exposed by dof2mat/mat2dof
#!/usr/bin/env bash
# The idea of this script is to do a round trip test on a CMTK affine
# registration using the dof2mat/mat2dof tools
mkdir -p testinit.list
cat <<EOF > testinit.list/registration
! TYPEDSTREAM 1.1
registration {
@jefferis
jefferis / cmtk_bspline_example.sh
Last active January 2, 2016 03:49
Trying to use CMTK fit_spline_xform to fit the inverse of an existing transform
#!/bin/bash
# Setup
mkdir images
mkdir refbrain
curl -o images/A.nrrd http://flybrain.mrc-lmb.cam.ac.uk/cmtk/A.nrrd
curl -o refbrain/B.nrrd http://flybrain.mrc-lmb.cam.ac.uk/cmtk/B.nrrd
AREG="B_A_9dof.list"
REG="B_A_warp.list"
@jefferis
jefferis / reformatted.JFRC2_brightest_slices.txt
Created March 7, 2014 13:16
Marta and I wrote something to calculate the brightest slice for each stack in the flycircuit set in response to Douglas' suggestion. Spreadsheet and summary histogram attached.
This file has been truncated, but you can view the full file.
ff brightest
reformatted.JFRC2/JFRC2_FCWB_5HT1bMARCM-F000001_seg001_03_warp_m0g80c8e1e-1x26r4.nrrd 156
reformatted.JFRC2/JFRC2_FCWB_5HT1bMARCM-F000002_seg001_03_warp_m0g80c8e1e-1x26r4.nrrd 58
reformatted.JFRC2/JFRC2_FCWB_5HT1bMARCM-F000003_seg001_03_warp_m0g80c8e1e-1x26r4.nrrd 23
reformatted.JFRC2/JFRC2_FCWB_5HT1bMARCM-F000004_seg001_03_warp_m0g80c8e1e-1x26r4.nrrd 93
reformatted.JFRC2/JFRC2_FCWB_5HT1bMARCM-F000005_seg001_03_warp_m0g80c8e1e-1x26r4.nrrd 51
reformatted.JFRC2/JFRC2_FCWB_5HT1bMARCM-F000006_seg001_03_warp_m0g80c8e1e-1x26r4.nrrd 63
reformatted.JFRC2/JFRC2_FCWB_5HT1bMARCM-F000007_seg001_03_warp_m0g80c8e1e-1x26r4.nrrd 52
reformatted.JFRC2/JFRC2_FCWB_5HT1bMARCM-F000007_seg002_03_warp_m0g80c8e1e-1x26r4.nrrd 48
reformatted.JFRC2/JFRC2_FCWB_5HT1bMARCM-F000008_seg001_03_warp_m0g80c8e1e-1x26r4.nrrd 45
@jefferis
jefferis / fc_good_images.txt
Last active August 29, 2015 13:57
Preprocessed and registered images based on raw data from http://flycircuit.tw (16229 images. ids can be translated using R code/data at https://github.com/jefferis/flycircuit
FruMARCM-M002262_seg001
FruMARCM-M002262_seg002
FruMARCM-M002278_seg001
FruMARCM-M002287_seg001
FruMARCM-M002507_seg001
FruMARCM-M002522_seg001
FruMARCM-M002578_seg001
FruMARCM-M002578_seg002
FruMARCM-M002579_seg001
FruMARCM-M002579_seg002
@jefferis
jefferis / gist:a7a9de4d058866368940
Created July 16, 2014 16:43
Sample winbuilder output for 05349fd57c
R Under development (unstable) (2014-07-14 r66149) -- "Unsuffered Consequences"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
@jefferis
jefferis / install_all_nat.R
Last active December 4, 2015 21:27
Install all neuroanatomy toolbox (nat) R packages
devtools::install_github("jefferis/nat")
# dependencies = TRUE should install the suggested package git2r as well
devtools::install_github("jefferislab/nat.templatebrains", dependencies=TRUE)
devtools::install_github(paste0("jefferislab/", c("nat.nblast", "nat.flybrains")))
# download our standard set of registrations
nat.flybrains::download_jefferislab_registrations()
devtools::install_github("jefferis/flycircuit")
devtools::install_github("jefferis/vfbr")
@jefferis
jefferis / Install_all_rappdirs.R
Created September 3, 2014 14:37
install nat code using rappdirs to locate downloaded data
devtools::install_github("jefferis/nat")
devtools::install_github(c("nat.nblast","nat.templatebrains","nat.flybrains"), username="jefferislab")
devtools::install_github("rappdirs")
devtools::install_github("jefferis/flycircuit", ref="feature/rappdirs")
@jefferis
jefferis / jekyll_post-update.sh
Last active August 29, 2015 14:16
jekyll on flybrain
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
# Jekyll update code
# always runs in .git dir
@jefferis
jefferis / readObj.R
Created April 3, 2015 18:35
rgl::readOBJ (still not available on osx due to unrelated errors with latest rgl package)
# straight from:
# https://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/rgl/R/obj.R?revision=1197&root=rgl
# see:
# https://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/rgl/DESCRIPTION?revision=1234&root=rgl
# for authorship/license information
readOBJ <- function(con, ...) {
lines <- readLines(con)
instrs <- sub(" .*", "", lines)
vertices <- read.table(textConnection(lines[instrs == "v"]),
col.names = c("instr", "x", "y", "z"),