Login  Register

"Heat maps"

Posted by Jeremy Adler-2 on Feb 17, 2017; 5:39am
URL: http://imagej.273.s1.nabble.com/Heat-maps-tp5018125.html

I find the increasing use of "heat maps" unhelpful.  
Some false color LUTs do resemble the color sequence that a heated object could display, but most do not. It is therefore unclear if a "heat map" refers to a subset of LUTs or is intended as a generic reference to all LUTs.

"LUTs",  a longer but more precise "display LUTs" or "false color LUTs" seem to be provide greater clarity.



________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of Dobens, Leonard [[hidden email]]
Sent: 16 February 2017 22:37
To: [hidden email]
Subject: problem overlaying from ROI manager in macro

I am writing a macro to overlay a heat map of particle orientation measurements (over 360 degrees) as colors filling the particles overlayed back onto the original image. The macro works fine until the last step when I would like to recall the original image and from ROI overlay the colors. Interestingly, I can not close the ramp legend nor the thresholded particles image with this:

run("Close All");

open(path_name);
run("RGB Color");
run("From ROI Manager”);

I can close the windows if I open a new macro with

run("Close All");


Here is the whole macro, using the “blobs” as an example; if you try it, just hit “return” to move past the dialog box; scroll to the last lines of the macro to see what I’ve written and if you could explain what the problem is down there, I’d be eternally grateful!


best,

Len Dobens

////////////////////
var path_name = getDirectory("image")+ getInfo("image.filename");


run("Blobs (25K)");

run("Make Binary");
 run("Set Measurements...", "centroid center feret's redirect=None decimal=3");

Dialog.create("Settings");
  Dialog.addNumber("Particle width:", 5);
  Dialog.addNumber("Opacity", 50);
  Dialog.addChoice("Lut:", newArray("32_Colors", "Ice", "Spectrum", "20_Colors"));
  Dialog.show();
  z = Dialog.getNumber();
  opac = Dialog.getNumber();
  heatmap = Dialog.getChoice();


 run("Analyze Particles...", "size=z-Infinity show=Overlay display exclude clear add");


 run("To ROI Manager");
 roiManager("Show All without labels");

Overlay.drawLabels(false);

for (i=0; i<nResults; i++) {
     x11 = getResult("FeretX",i);
     y11 = getResult("FeretY",i);
     length = getResult("Feret",i);
     degrees = getResult("FeretAngle",i);
     if (degrees>90)
        degrees -= 180;
     angle = degrees*PI/180;
     x21 = x11 + cos(angle)*length;
     setResult("x21", i, x21);
     y21 = y11 - sin(angle)*length;
     setResult("y21", i, y21);

     x31 = getResult("X",i);
     y31 = getResult("Y",i);

     makeLine(x31, y31, x11, y11);
     getPixelSize(unit, pw, ph);
     dz = (x31 - x11)*pw;
     da = (y31 - y11)*ph;
     distance1 = sqrt(dz*dz + da*da);
     setResult("D1", i, distance1);
     updateResults;

  makeLine(x31, y31, x21, y21);
     getPixelSize(unit, pw, ph);
     dx = (x31 - x21)*pw;
     dy = (y31 - y21)*ph;
     distance2 = sqrt(dx*dx + dy*dy);
     setResult("D2", i, distance2);
     updateResults;

}

for (i=0; i<nResults; i++) {

     D1 = getResult("D1",i);
     D2 = getResult("D2",i);
     x11 = getResult("FeretX",i);
     y11 = getResult("FeretY",i);
     x21 = getResult("x21",i);
     y21 = getResult("y21",i);

     if (D1 > D2) {
      setResult("xh", i, x11);
  setResult("xt", i, x21);
  setResult("yh", i, y11);
  setResult("yt", i, y21);
  updateResults;setTool("arrow");

   } else {

setResult("xh", i, x21);
  setResult("xt", i, x11);
setResult("yh", i, y21);
setResult("yt", i, y11);
  }
}

for (i=0; i<nResults; i++) {
xh = getResult("xh",i);
xt = getResult("xt",i);
yh = getResult("yh",i);
yt = getResult("yt",i);
degrees = getResult("FeretAngle",i);


if (xh > xt && yh < yt){
angle2 = degrees + 180;
setResult("angle360", i, angle2);
updateResults;
}

if (xh < xt && yh > yt){
angle2 = degrees + 0;
setResult("angle360", i, angle2);
updateResults;
}

if (xh > xt && yh > yt){
angle2 = degrees + 0;
setResult("angle360", i, angle2);
updateResults;
}

if (xh < xt && yh < yt){
angle2 = degrees + 180;
setResult("angle360", i, angle2);
}
}

run("RGB Color");
roiManager("Show All without labels");

if (heatmap == "32_Colors") {
run("ROI Color Coder", "measurement=angle360 lut=32_Colors width=0 opacity="+ opac +" range=Min-Max n.=5 decimal=0 ramp=[256 pixels] font=SansSerif font_sie=14 draw");

} else {

if (heatmap == "Ice") {
run("ROI Color Coder", "measurement=angle360 lut=Ice width=0 opacity="+ opac +" range=Min-Max n.=5 decimal=0 ramp=[256 pixels] font=SansSerif font_size=14 draw");

} else {

if (heatmap == "Spectrum") {
run("ROI Color Coder", "measurement=angle360 lut= Spectrum width=0 opacity="+ opac +" range=Min-Max n.=5 decimal=0 ramp=[256 pixels] font=SansSerif font_size=14 draw");

} else {

if (heatmap == "20_Colors") {
run("ROI Color Coder", "measurement=angle360 lut=20_Colors width=0 opacity="+ opac +" range=Min-Max n.=5 decimal=0 ramp=[256 pixels] font=SansSerif font_size=14 draw");

}
}

run("Close All");

open(path_name);
run("RGB Color");
run("From ROI Manager");





///////////////////


Leonard Dobens, PhD
Professor of Molecular Biology and Biochemistry
SCB312
School of Biological Sciences
University of Missouri-Kansas City
5007 Rockhill Road
Kansas City, MO 64110
8162356272
[hidden email]<mailto:[hidden email]>




--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html