Skip to content

Instantly share code, notes, and snippets.

View karchie's full-sized avatar

Kevin Archie karchie

  • NOUS Imaging
  • Longmont, CO
View GitHub Profile
@karchie
karchie / gist:8ec1bec97a7c3d7b7c2a
Created July 29, 2014 05:47
Python commands to use AWS EC2 to run Freesurfer analyses on XNAT data
# Get a connection to the XNAT server
import pyxnat
xnat = pyxnat.Interface('https://my-xnat.org','username','password')
# Request a list of all MR scans, keeping only those with RAGE in the scan type (e.g., MPRAGE, MP-RAGE)
import scans
mprage_sessions = scans.get_sessions(x, 'MYPROJECT', lambda t : 'RAGE' in t)
# Break the scans list into groups of 32
chunks32 = [g for g in scans.partition(32, mprage_sessions.iteritems())]
@karchie
karchie / UnivariatePolygenic.vm
Created April 23, 2014 21:29
Solar Eclipse from JavaScript via XNAT-Docker
<script type="text/javascript">
jQuery(window).load(function(){
var s = jQuery('#solar-submit');
s.click(function(event){
var trait = jQuery('#trait').find(":selected").text();
var covars = jQuery('#covars').val();
jQuery.ajax({
url:'$content.getURI("/spring/script/application/SolarEclipse-univ-polygenic?keep=true")',
type:'POST',
data: 'TRAIT='+trait+'\nCOVARS='+covars+'\n',
@karchie
karchie / session-data-factory.xml
Created July 16, 2013 21:33
This element should be added to the dicom-import-session.xml (replacing any existing sessionDataFactoryClasses element) to disable XNAT from creating PET-MR sessions. Studies with both PET and MR data will map to PET sessions instead.
<bean name="sessionDataFactoryClasses" class="java.util.ArrayList">
<constructor-arg>
<list>
<value type="java.lang.Class">
org.nrg.dcm.xnat.SOPMapXnatImagesessiondataBeanFactory
</value>
<value type="java.lang.Class">
org.nrg.dcm.xnat.ModalityMapXnatImagesessiondataBeanFactory
</value>
</list>
@karchie
karchie / hotgym.py
Created June 27, 2013 12:36
Scott Purdy's hotgym example driver, modified to use ipython and pylab to graph prediction and errors. A good deal of library installation and reconfiguration is needed to make this work; read the comment at the top of the file and contact me if you can't get it working.
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
@karchie
karchie / xnat-graph.html
Created June 29, 2012 15:42
Using d3 to plot results from an XNAT stored search
<!DOCTYPE html>
<html>
<head>
<title>xnat dynamic graph</title>
<script type="text/javascript" src="http://d3js.org/d3.v2.js"></script>
<script type="text/javascript">
var xnat_data, plotsvg
var base_url = 'https://central.xnat.org'
var stored_search = 'ALL_OASIS_MR_DATA_1_1_1'
var url = base_url + '/REST/search/saved/' + stored_search +
@karchie
karchie / dicom-import-context.xml
Created February 19, 2012 06:30
Custom XNAT DICOM identifier config with multiple AE titles
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<bean name="dicomObjectIdentifier" class="org.nrg.dcm.id.ClassicDicomObjectIdentifier">
<property name="userProvider" ref="receivedFileUserProvider" />