Skip to content

Instantly share code, notes, and snippets.

@hyobyun
hyobyun / DALE-convert-img.java
Created June 2, 2013 21:24
Turns a 25x25 gif single frame image into arduino code for a 25x25 led matrix
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;
@hyobyun
hyobyun / 3-item-bin-packing.java
Created June 2, 2013 21:31
Dynamic programming solution for bin packing with 3 items of variable size
/* 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 / CheckQCOutput.sh
Last active December 18, 2015 00:49
CIDAR QC png check using feh
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 / gist:5699339
Created June 3, 2013 16:24
copy dicoms, only t1, restint combined, restSeq Combined
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
#!/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 / progress.m
Created June 24, 2013 16:40
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.
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
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;