Skip to content

Instantly share code, notes, and snippets.

View swederik's full-sized avatar

Erik Ziegler swederik

  • Yunu
  • Rotterdam, The Netherlands
View GitHub Profile
@swederik
swederik / index.html
Last active January 26, 2019 16:08
Static site usage of react-viewerbase
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<title>react-viewerbase</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
const dicomParser = require('dicom-parser');
function parseAndInsertFile(content, url) {
return new Promise(function(resolve, reject) {
const dataSet = dicomParser.parseDicom(content);
const fileJSON = {};
fileJSON['transactionId'] = 'img';
fileJSON['fileDate'] = dataSet.string('x00080012');
fileJSON['fileTime'] = dataSet.string('x00080013');
<!DOCTYPE HTML>
<html>
<head>
<!-- support for mobile touch devices -->
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
<!-- twitter bootstrap CSS stylesheet - not required by cornerstoneTools -->
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<link href="../cornerstone.min.css" rel="stylesheet">
/*
Display image loading progress bar across bottom of image.
Display % loaded while image is loading.
*/
(function($, cornerstone, cornerstoneTools) {
"use strict";
var scrollBarHeight = 6;
var progressData = {};
@swederik
swederik / cost.py
Created January 12, 2015 16:35
Calculate network wiring cost based on a position network using Python and NetworkX
# -*- coding: utf-8 -*-
import networkx as nx
import numpy as np
__author__ = """\n""".join(['Erik Ziegler <erik.ziegler@ulg.ac.be>'])
__all__ = ['cost']
def cost(G, edge_key='weight', position_key='dn_position', H=None, minimum_weight=0):
if G.is_multigraph() or G.is_directed():
raise Exception('network cost is not implemented for ',
@swederik
swederik / conn_vproject.m
Created June 11, 2014 10:08
CONN functional connectivity toolbox ROI-to-voxel stats exporting on Mac OSX (conn_vproject.m)
function [dataplot,infoplot,data1plot]=conn_vproject(a,b,c,d,views,projection,thres,res,box,select,mat,threshold,data1plot,spmfile,voxeltovoxel)
%%%%%
% Slight modification to CONN functional connectivity toolbox to fix stats exporting on Mac OSX
% uicontextmenu appears broken on OSX. May be due to resolution issues on retina macbooks?
%%%%%
%CONN_VPROJECT Volume display
%
if numel(a)==1 && ishandle(a), % callbacks from UI objects
init=0;
GCF=gcf;
%%% Slightly modified science.bst to stop the author list at the first author
%%
%% This is file `science.bst', generated
%% on <1997/12/1> with the docstrip utility (2.2i).
%%
%% The original source files were:
%%
%% genbst.mbs (with options: `seq-no,nm-init,nmlm,x5,m1,yr-par,tit-q,jtit-x,vol-bf,volp-com,jpg-1,jnm-x,blk-com,pp,ed,abr,and-x')
%% ----------------------------------------
%% *** for Science magazine ***
%% This is just an edited version of the apalike style. It merges in some changes from science.bst and restricts the author list to the first author + et al.
%
% BibTeX `apalike' bibliography style (version 0.99a, 8-Dec-10), adapted from
% the `alpha' style, version 0.99a; for BibTeX version 0.99a.
%
% Copyright (C) 1988, 2010 Oren Patashnik.
% Unlimited copying and redistribution of this file are permitted as long as
% it is unmodified. Modifications (and redistribution of modified versions)
% are also permitted, but only if the resulting file is renamed.
%
@swederik
swederik / tracks2prob.cpp
Created January 17, 2014 11:28
Total Track Length in MRtrix's tracks2prob.cpp
/*
Copyright 2010 Brain Research Institute, Melbourne, Australia
Written by Robert E. Smith and J-Donald Tournier, 14/07/10.
This file is part of MRtrix.
MRtrix is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
@swederik
swederik / xtkCTM.html
Last active December 17, 2015 18:29
Testing CTM support for XTK
<html>
<head>
<title>XTK TEST WITHOUT COMPILATION</title>
<script type="text/javascript" src="http://localhost:8000/X/lib/google-closure-library/closure/goog/base.js"></script>
<script type="text/javascript" src="http://localhost:8000/X/xtk-deps.js"></script>
<script type="text/javascript" src="http://localhost:8000/xtktest/lzma.js"></script>
<script type="text/javascript">