Skip to content

Instantly share code, notes, and snippets.

@hirokai
hirokai / gist:5112043
Created March 7, 2013 21:39
Pratt and Chandler’s theory calculation
import Data.List
import Data.Maybe
import Control.Monad
type RealFunc = Double -> Double
fi :: Int -> Double
fi = fromIntegral
integral :: RealFunc -> (Double,Double) -> Maybe Int -> Double
@hirokai
hirokai / gist:5184002
Created March 17, 2013 22:55
hfsevents-0.1.3 installation error
$ sudo cabal install hfsevents
Resolving dependencies...
Configuring hfsevents-0.1.3...
Building hfsevents-0.1.3...
Preprocessing library hfsevents-0.1.3...
[1 of 1] Compiling System.OSX.FSEvents ( System/OSX/FSEvents.hs, dist/build/System/OSX/FSEvents.o )
[1 of 1] Compiling System.OSX.FSEvents ( System/OSX/FSEvents.hs, dist/build/System/OSX/FSEvents.p_o )
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:5:0:
0,
@hirokai
hirokai / gist:5184391
Created March 18, 2013 01:12
hfsevents installation error
$ sudo cabal install -v hfsevents
Password:
Reading available packages...
Choosing modular solver.
Resolving dependencies...
Ready to install hfsevents-0.1.3
Waiting for install task to finish...
Extracting
/Users/hiroyuki/Library/Haskell/repo-cache/hackage.haskell.org/hfsevents/0.1.3/hfsevents-0.1.3.tar.gz
to /tmp/hfsevents-0.1.3-29642...
@hirokai
hirokai / gist:5184702
Last active December 15, 2015 02:09
hfsevents Installation error log
Last login: Sun Mar 17 18:10:57 on ttys000
Hiroyukis-MacBook-Air:~ hiroyuki$ cabal unpack hfsevents
Unpacking to hfsevents-0.1.3/
Hiroyukis-MacBook-Air:~ hiroyuki$ cd hfsevents-0.1.3/
Hiroyukis-MacBook-Air:hfsevents-0.1.3 hiroyuki$ ghc -v -c -odir dist/build -Idist/build -Icbits -optc-O2 cbits/c_fsevents.c
Glasgow Haskell Compiler, Version 7.4.2, stage 2 booted by GHC version 7.0.4
Using binary package database: /opt/local/lib/ghc-7.4.2/package.conf.d/package.cache
Using binary package database: /Users/hiroyuki/.ghc/x86_64-darwin-7.4.2/package.conf.d/package.cache
hiding package split-0.2.1.1 to avoid conflict with later version split-0.2.1.2
hiding package Cabal-1.14.0 to avoid conflict with later version Cabal-1.16.0.3
@hirokai
hirokai / halide-load-tiff.cpp
Last active December 20, 2015 15:29
MIT Halide tiff load using libtiff
// To compile this, you need to link libpng and libtiff:
// clang++ `libpng-config --cflags --ldflags` -lHalide -ltiff halide-load-tiff.cpp
#include <Halide.h>
#include <cstdio>
using namespace Halide;
#include "image_io.h"
#include "tiffio.h"
@hirokai
hirokai / metadata.hs
Created November 14, 2013 08:14
MicroManager metadata file parsing example in Haskell
-- MicroManager metadata.txt parse example
-- metadata.hs
-- Uses aeson, directory-tree.
{-# LANGUAGE OverloadedStrings #-}
import Data.Aeson
import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString.Lazy.Char8 as BS
import qualified Data.HashMap.Strict as HM
@hirokai
hirokai / confocal-plus-TIRF.bsh
Created December 16, 2013 09:35
Confocal and TIRF on Scope 7
// Test acquisition script
// Modified from http://www.micro-manager.org/w/images/3/33/TestAcq.bsh (Nenad Amodaj, feb2008)
import org.micromanager.api.AcquisitionOptions;
// clear all previous acquisitions
gui.closeAllAcquisitions();
gui.clearMessageWindow();
// file locations
# Example of Fiji script for calculating a radial profile.
from ij import IJ
from ij.process import ImageStatistics as IS
from ij.gui import Roi, OvalRoi
import csv
options = IS.MEAN | IS.MEDIAN | IS.MIN_MAX | IS.AREA
# Example of Fiji script for taking statistics of every stack in a stack file.
# Statistics of 3 ROIs are taken for every stack.
from ij import IJ
from ij.process import ImageStatistics as IS
# import os
options = IS.MEAN | IS.MEDIAN | IS.MIN_MAX | IS.AREA
path cx cy r num_bin
/Volumes/Macintosh HD/GrovesLabData/20131106/03 FC3/04 cells_10/img_000000014_488_000.tif 243 243 120 20
/Volumes/Macintosh HD/GrovesLabData/20131106/03 FC3/04 cells_10/img_000000014_488_001.tif 300 231 100 20
/Volumes/Macintosh HD/GrovesLabData/20131106/03 FC3/04 cells_10/img_000000014_488_002.tif 398 645 160 20