Skip to content

Instantly share code, notes, and snippets.

View bisectionSearch.m
function [ x ] = bisectionSearch( y, fn ,e )
% BISECTIONSEARCH Searches for x that results in y for function fn with max
% error e between a<=x<=b, or until iteration does not change value of y
% FUNCTION MUST BE MONOTONIC
% Hyo Byun
% Mayberg Lab, Emory University
% 2013
% Set bounds
a=0;
@hyobyun
hyobyun / progress.m
Created Jun 24, 2013
Outputs a progress report w/ percent complete and estimated time till completion. Supply start time, iteration #, number of total iterations. Accuracy improves over iterations. Works best when iteration time does not change over time.
View progress.m
function time = progress( startT, i, N )
% PROGRESS
% Outputs estimated time and percentage till completion
% To use, before loop, save startT ( startT=clock; )
% then, inside loop, call progress using following variables:
% startT : beginning time defined above using clock
% i : ith iteration
% N : total number of expected iterations
%
% Hyo Byun
View findAndCopy.sh
#!/bin/bash
cd /mnt/QNAPimaging/DBS/callie/fMRI/subjects
files=`find -name *.rest.callie_proc_05222013.nii.gz | cut -c3-`
for f in $files; do
cp -v $f /research/images/DBS/callie_proc_05222013
done
@hyobyun
hyobyun / gist:5699339
Created Jun 3, 2013
copy dicoms, only t1, restint combined, restSeq Combined
View gist:5699339
images='dir1
dir2
'
for i in $images; do
mkdir /research/CIDAR_proc_test/2ndset/$i
cp -vR /mnt/DICOM_originals/CIDAR/dicom/$i/*interleaved_Combined* /research/CIDAR_proc_test/2ndset/$i/
cp -vR /mnt/DICOM_originals/CIDAR/dicom/$i/*sequential_Combined* /research/CIDAR_proc_test/2ndset/$i/
cp -vR /mnt/DICOM_originals/CIDAR/dicom/$i/*t1* /research/CIDAR_proc_test/2ndset/$i/
done
@hyobyun
hyobyun / CheckQCOutput.sh
Last active Dec 18, 2015
CIDAR QC png check using feh
View CheckQCOutput.sh
cd /research/CIDAR_proc_test
images=`find . -mindepth 1 -maxdepth 1 -type d | cut -c3- | sort`
cd /research/CIDAR/QC_output
for i in $images; do
feh --auto-zoom --fullscreen --draw-filename \
mosaic/$i\_anat.png \
mosaic/$i\_RestSeq.png \
mosaic/$i\_RestAlt.png \
@hyobyun
hyobyun / 3-item-bin-packing.java
Created Jun 2, 2013
Dynamic programming solution for bin packing with 3 items of variable size
View 3-item-bin-packing.java
/* THIS CODE IS MY OWN WORK, IT WAS WRITTEN WITHOUT CONSULTING A TUTOR OR CODE WRITTEN BY OTHER STUDENTS -HYO BYUN*/
import java.util.*;
public class BinPacking {
/* -----------------------------------------------------------
SolveBP(k1, s1, k2, s2, k3, s3, Cap):
NOTE DOESN"T USE RESIDUAL CAP, USES FILLED CAP
returns the min # bins needed to pack:
@hyobyun
hyobyun / DALE-convert-img.java
Created Jun 2, 2013
Turns a 25x25 gif single frame image into arduino code for a 25x25 led matrix
View DALE-convert-img.java
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
import java.lang.*;
public class Convert {
public static void main(String[] args) {
boolean preview = false;
if (args.length >0 && args[0].equals("p")) {
preview=true;