Skip to content

Instantly share code, notes, and snippets.

import os, re
def filterdirs(folderpath):
dirs = os.listdir(folderpath)
pattern = re.compile('(.*)-(.*)--(.*)')
dirlist = []
for d in dirs:
if d.startswith('0'):
res = re.search(pattern, d)
#if int(res.group(1)) > 9 and int(res.group(1)) < 160:
@miura
miura / AreaOutlierDetector.py
Last active August 29, 2015 13:57
Detecting outliers with occupied area.
from org.jfree.data.statistics import BoxAndWhiskerCalculator
from ij.measure import ResultsTable
from java.util import ArrayList, Arrays
VERBOSE = True
class InstBWC(BoxAndWhiskerCalculator):
def __init__(self):
pass
from ij.plugin.filter import GaussianBlur
from fiji.threshold import Auto_Local_Threshold as ALT
from ij.plugin.filter import ParticleAnalyzer as PA
from org.jfree.data.statistics import BoxAndWhiskerCalculator
from java.util import ArrayList, Arrays
import os
# size of juxtanuclear region. In pixels.
RIMSIZE = 15
# image background is expected to be black.
# test script for the Centre course
# Kota Miura 20131129
# fiji --headless --mem=500m /g/almf/software/scripts2/getIntensityRange3.py '0076-14--2006-01-23'
import sys, os, csv, re
from ij import ImagePlus, IJ
from org.jfree.data.statistics import BoxAndWhiskerCalculator
from java.util import ArrayList, Arrays
from ij.io import Opener
a = 1
b = 2
c = a + b
print c
a = '1'
b = '2'
c = a + b
print c
from ij import IJ
IJ.log('write to Log window')
#Loading Image, Interactively
imp = IJ.openImage()
imp.show()
#Loading image, defined path
import os, sys
from ij.plugin.filter import ParticleAnalyzer as PA
# size of juxtanuclear region. In pixels.
RIMSIZE = 15
def roiRingGenerator(r1):
""" Create a band of ROI outside the argument ROI.
See Liebel (2003) Fig. 1
"""
setBatchMode(true);
title = getTitle();
c1 = "C1-" + title;
c2 = "C2-" + title;
run("Split Channels");
selectWindow(c1);
c1ID = getImageID();
selectWindow(c2);
c2ID = getImageID();
//Curve fitting example
// see class CurveFitter
// http://rsb.info.nih.gov/ij/developer/api/ij/measure/CurveFitter.html
// 20110412 Kota
//creat example data arrays
var xa = [1, 2, 3, 4];
var ya = [3, 3.5, 4, 4.5];
//construct a CurveFitter instance
x = newArray(0);
a1 = newArray(1, 2, 3);
a2 = newArray(10, 20, 30);
//accumulate arrays in a single array
x = Array.concat(x, a1);
x = Array.concat(x, a2);
Array.print(x);
//slicing a range