Skip to content

Instantly share code, notes, and snippets.

@miura
miura / gist:3b93db1f3f3c0eb99550
Last active August 29, 2015 14:03
brew upgrade macvim problem
miura$ brew upgrade -v macvim
==> Upgrading 1 outdated package, with result:
macvim 7.4-73
==> Upgrading macvim
==> Downloading https://github.com/b4winckler/macvim/archive/snapshot-73.tar.gz
Already downloaded: /Library/Caches/Homebrew/macvim-7.4-73.tar.gz
==> Verifying macvim-7.4-73.tar.gz checksum
tar xf /Library/Caches/Homebrew/macvim-7.4-73.tar.gz
==> ./configure --with-features=huge --enable-multibyte --with-macarchs=x86_64 --enable-perlinterp --enable-rubyinterp --enable-tclinterp --with-ruby-command=/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby --with-tlib=ncurses --with-compiledby=Homebrew --with-local-dir=/usr/local --enable-cscope --enable-pythoninterp
configure: creating cache auto/config.cache
orgtitle = getTitle();
run("Split Channels");
selectWindow("C1-"+orgtitle);
c1id = getImageID();
selectWindow("C2-"+orgtitle);
c2id = getImageID();
selectImage(c2id);
run("Gaussian Blur...", "sigma=1 stack");
run("Auto Threshold", "method=Li white stack use_stack_histogram");
//setTool("zoom");
run("Split Channels");
run("Gaussian Blur...", "sigma=1 stack");
//selectWindow("C2-NPC1.tif");
//selectWindow("C1-NPC1.tif");
run("Auto Threshold", "method=Li white stack use_stack_histogram");
run("Open", "stack");
run("Fill Holes", "stack");
run("Duplicate...", "title=C2-NPC1-1.tif duplicate range=1-15");
for (i = 0; i < nResults - 1; i++){
trackID = getResult("Trajectory", i);
nexttrackID = getResult("Trajectory", i + 1);
if (trackID == nexttrackID){
x1 = getResult("x", i);
y1 = getResult("y", i);
x2 = getResult("x", i + 1);
y2 = getResult("y", i + 1);
displacement = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
setResult("Displacement", i, displacement);
'''
Tiff file resolution checker
'''
from ij.io import TiffDecoder
from ij.io import DirectoryChooser
from ij import IJ
import os
def xresGetter(d, filename):
@miura
miura / MTplusend.ijm
Created November 14, 2014 22:27
JFilament results plotting 1
scale = 0.083; // マイクロメータ/ピクセル
dt = 3; // 秒/フレーム
path = File.openDialog("Select a File");
str = File.openAsString(path);
strA = split(str, "\n");
// データ格納用の配列の用意
dispA = newArray(strA.length - 13);
intdispA = newArray(strA.length - 13);
// *** Start: White balance ***
name=getTitle();
run("Split Channels");
MeanColor=newArray(3);
maxi = 0;
for (u=1; u<4; u++) {
selectWindow("C"+u+"-"+name);
makeRectangle(100,100,100,100);
// waitForUser("Please draw a region in the background");
function onOpen() {
var menuEntries = [ {name: "Create Diary Doc from Sheet", functionName: "createDocFromSheet"}];
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.addMenu("Fitness Diaries", menuEntries);
}
function createDocFromSheet(){
var templateid = "1O4afl8SZmMxMFpAiN16VZIddJDaFdeRBbFyBtJvepwM"; // get template file id
var FOLDER_NAME = "Fitness Diaries"; // folder name of where to put completed diaries
// get the data from an individual user
cc=0;
for(k=0; k<nSlices; k++)
for(j=0;j<getHeight();j++)
for(i=0;i<getWidth();i++)
{setSlice(k+1);if(getPixel(i,j)>0)cc++;}
print("non-0:" + cc);
from com.sun.j3d.utils.universe import SimpleUniverse
from com.sun.j3d.utils.geometry import ColorCube
from javax.media.j3d import BranchGroup
universe = SimpleUniverse()
group = BranchGroup()
group.addChild(ColorCube(0.3))
universe.getViewingPlatform().setNominalViewingTransform()
universe.addBranchGraph(group)