User Tools

Site Tools


Downloads (-2016)
Downloads (2016-)
RSS aggregates

EMBL BioImage Data Analysis



—- Contact
CMCI Alumni
EMBL Heidelberg
EMBL Intranet

Popularity Ranking

Timeline of @cmci_

cmci_ avatar

Impressive and swift moderation @helenajambor !
About 3 hours, 32 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

RT @LuisDVerde: Now available as a #ggplot2 geom thanks to @naupakaz
About 3 hours, 35 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

RT @helenajambor: awesome, within 2 days .@naupakaz made a code publicly available for anyone wanting to make the half-and-half-plot FYI @…
About 3 hours, 36 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

RT @dgaboriau: Thread on data visualisation: ggplots, boxplots and violin plots
About 9 hours, 13 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

RT @christlet: SUSHI from Valentin Nāgerl lab allows super-resolution microscopy of neuronal morphology by STED imaging of extracellular sp…
About 12 hours, 23 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

RT @christlet: Our work with @HenriquesLab and @MercerLab on SQUIRREL highlighted on the @CNRS website (in French, and we even found a pun!…
About 12 hours, 25 mins ago by: Kota Miura (@cmci_)
Algorithm FRAP Fiji ImageJ ImageJ Plugin ImageJ Plugin 3Dviewer Imaris Java Javascript Python R bias blog dokuwiki fiji google imagej java libraries matlab meetings neubias news papers python references software webadmin

CMCI weblog

Marriage Matching Algorithm

Consider that we have probe 1 and 2 labeling some molecule as dots, and for each cell we have several signals for each probe, cf. 3 dots for probe 1 and 2 dots for probe 2. The we have an assignment that we want to pair them each, leaving one probe 1 dot unpaired (cf. In my case I know that a probe 1 dot and a probe 2 dot are on a same chromosome.) What would be the algorithm?

In broader sense, this is a combinatorial optimization problem but I thought there could be simpler way of doing this.. then following is some possibilities.

One way is to construct a cost function, such as “sum of distace between paired”, calculate cost funciton for all possible combinations and choose the one with the lowest sum.

I found otherway of doing this, by so-called "stable marriage algorithm". In this case, same each number of boys and girls are matched.

In Javascript it should be as follows:

function make_matches(gb, bg){
  var N = gb.length;
  var boy = [], girl = [], position = [], rank = [];
  var b, g, r, s, t;
  for (g = 1; g <= N; g++){
    rank[g] = [N+1];
    for (r = 1; r <= N; r++){
      b = gb[g-1][r-1];
      rank[g][b] = r;
    boy[g] = 0;
  for (b = 1; b <= N; b++){
    girl[b] = [0];
    for (r = 1; r <= N; r++){
      girl[b][r] = bg[b-1][r-1];
    position[b] = 0;
  for (b = 1; b <= N; b++){
    s = b;
    while (s != 0){
      g = girl[s][++position[s]];
      if (rank[g][s] < rank[g][boy[g]]){
        t = boy[g]; boy[g] = s; s = t;
  return boy;

Only the problem when applying this to a problem with non-equal number of boys and girls population. For this case, either modify the above algorithm, or prepare a dummy with very low ranking to satisfy the equal number of populaiton for using the algorithm as the above.

more references

Bleach Correction (2)

As I test through different method further

  1. Phair's method (or simple ratio)
  2. Exponential decay fitting (or exponential ratio, I call)
  3. Histogram streching,

all these methods are not really satisfactory. so I kept on searching for other methods and I tested something not used often, which is called “Histgram Matching”, and it seems to work better. Bleached images are better be blurred a bit. I might try implementing it as another method for bleaching correction.

Followings are links related to this method, which I referred to.

Histogram equalizaiton theory (by R. Fisher, S. Perkins, A. Walker and E. Wolfart.@ Image Processing Learning Resources).

I also refrred to Digital Image Processing using Matlab“ but it was too simply formulated (and, the matlab function which should be used is indicated but too short).

Paper: “A statistical approach for intensity loss compensation of confocal microscopy images”, Gopinath et al (2007) J. of microscopy ( Link). This paper tries to correct the acquistion bleaching while the image itself is changing a lot (the sample seems to be internalizing cell surface recepter, so from diffuse signal to dotty signals). In case of sequences with less changes in signal shape, the problem is more simple and straightforward, but such dynamic version should be already in our sight. (by the way, I am always amazed by works which Luby-Phelps is involved in. When I found the name on this paper, amazed again…).

Point Operations
CMPUT 206, Instructor: NilanjanRay
(powerpoint slides in PDF)

Java library: source for historam matching is in Burger & Burge website, chapter 5.
"Digital Image Processing: An algorithmic introduction uing Java"

Photobleaching Correction -3D time series

There are several IJ tools available for 2D time series bleaching correction, but seems not with 3D:

2D-t tools:

    • Phair's double normalization method. Dependent on ratio, similar to the above, but can specify reference area (if my understanding is correct).
    • proposes two ways,
      1. conceptually similar to above two: estimate the correction ratio. But this is done by fitting exponential decay curve and use decay parameter.
        1. <jsm> I_c(t) = I(t) / exp^{-\tau t}</jsm>
      2. use “enhance contrast”. framewise Histogram streching.

Among these, exponential decay method is theoretically clean (but in practice, timeseries are not teoretical…).

Anycase, there should be 3D-t bleach correction tool (and I need it NOW). I might make some quick solution using two methods, one using division of first frame and the other with exponential fitting.

By the way, bleaching corrected images cannot basically be used for intensity quantification (FRAP, on the other hands, correct bleaching after measuring the raw image). If you are analyzing shapes or positions, no problem for quantification.

here is the “ratio” version:

macro "Bleach Corection 3D-t by ratio"{
	run("Duplicate...", "title=bleach_corrected duplicate");
	getDimensions(width, height, channels, slices, frames);
	if (frames == 1) {
		uslices = getNumber("how many z slices/timepoint?", 1);
		if ((slices%uslices) !=0) exit("that slice number dows not match with the current stack");
		frames = slices / uslices;
	tIntA = newArray(frames);
	for(i=0; i<frames; i++){
		startf = (i*slices)+1;
		endf = (i+1)*slices;
		op ="start="+startf+" stop="+endf+" projection=[Sum Slices]";
		run("Z Project...", op);
		getRawStatistics(nPixels, mean);
		if (i==0) tIntA[i] = mean;
		else tIntA[i] = mean/tIntA[0];
	setBatchMode("exit and display");
	tIntA[0] =1;
	for(i=0; i<frames; i++){
		for(j=0; j<slices; j++){
			curframe = i*slices + j+1;
			//print("frame"+curframe + " factor" + tIntA[i]);
			op = "value="+tIntA[i]+" slice";
			run("Divide...", op);
		print("time point:"+i+1 + "  factor" + tIntA[i]);

Before Correction (each row is a time point, with 8 z-slices)
 Before each row is a time point Average intensity along stack slices. 5 peaks corresponds to 5 time points. Before

After Correction
After After

entry generator

Weblog Archive

blogtng/blogtop.txt · Last modified: 2016/05/24 05:46 (external edit)