Project

General

Profile

Files » ovocytes.txt

Volker Baecker, 06/10/2013 01:05 PM

 
/**
* MRI Ovocytes Tool
*
* The Ovocytes Tool acquires images from the live window of the camera and measures the
* surface of the ovocyte in the image in a configurable time interval.
*
* written 2013 by Volker Baecker (INSERM) at Montpellier RIO Imaging (www.mri.cnrs.fr)
* in collaboration with Colette TOURNAIRE-ROUX (UMR 5004)
*/

var helpURL = "http://dev.mri.cnrs.fr/projects/imagej-macros/wiki/Ovocyte_Tool"

var TIME_INTERVAL = 20;
var NUMBER_OF_IMAGES = 7;
var THRESHOLD_METHOD = "Huang";
var MIN_SIZE = 20000;
var MAX_SIZE = 850000;
var LIVE_VIDEO_WIN = "GigE Live Video";
var THRESHOLDING_METHOD = "Huang";

macro "Unused Tool -" {}

macro "Ovocytes Tool Help Action Tool - C037T4d14?"{
run('URL...', 'url='+helpURL);
}

macro "GigEVison Camera Action Tool - Cf00 L30f0 L21e1 L12d2 L03c3 L46c6 L37b7 L28a8 L1999 L3cfc L2ded L1ede L0fcf "
{
run("IJ PtGigEControl");
}

macro "Analyze Ovocyte Action Tool - C037T4d14s" {
setBatchMode(true);
print("\\Clear");
print("\\Update0:" + "image 1 / " + NUMBER_OF_IMAGES);
run("Set Measurements...", "area redirect=None decimal=3");
selectWindow(LIVE_VIDEO_WIN);
run("Duplicate...", "title=["+LIVE_VIDEO_WIN+"-1]");
time1 = getTime();
measureOvocyte();
close();
setResult("Time", nResults-1, 0.0);
updateResults();
for(i=0; i<NUMBER_OF_IMAGES-1;i++) {
print("\\Clear");
print("\\Update0:" + "image "+(i+2)+" / " + NUMBER_OF_IMAGES);
wait(TIME_INTERVAL * 1000);
print(time1);
selectWindow(LIVE_VIDEO_WIN);
run("Duplicate...", "title=["+LIVE_VIDEO_WIN+"-"+(i+2)+"]");
measureOvocyte();
close();
time2 = getTime();
delta_time = (time2-time1)/1000.0;
setResult("Time", nResults-1, delta_time);
updateResults();
}
setBatchMode("exit and display");
print ("acquisition finished");
}

macro 'Analyze Ovocyte Action Tool Options...' {
Dialog.create("Ovocyte Tool Options");
Dialog.addNumber("time interval [s]", TIME_INTERVAL);
Dialog.addNumber("number of images", NUMBER_OF_IMAGES);
Dialog.addNumber("min. size [pixel]", MIN_SIZE);
Dialog.addNumber("max. size [pixel]", MAX_SIZE);
Dialog.addChoice("thresholding method", newArray("Default", "Huang", "Intermodes", "IsoData", "IJ_IsoData", "Li", "MaxEntropy", "Mean", "MinError", "Minimum", "Moments", "Otsu", "Percentile", "RenyiEntropy", "Shanbhag", "Triangle", "Yen"), THRESHOLDING_METHOD);
Dialog.show();
TIME_INTERVAL = Dialog.getNumber();
NUMBER_OF_IMAGES = Dialog.getNumber();
MIN_SIZE = Dialog.getNumber();
MAX_SIZE = Dialog.getNumber();
THRESHOLDING_METHOD = Dialog.getChoice();
}

function measureOvocyte() {
setAutoThreshold(THRESHOLD_METHOD);
run("Analyze Particles...", "size="+MIN_SIZE+"-"+MAX_SIZE+" circularity=0.00-1.00 show=Nothing display exclude");
}
(1-1/3)