Macro record issue

color-analysis
macro
thresholding
Tags: #<Tag:0x00007fd541ceb6e8> #<Tag:0x00007fd541ceb508> #<Tag:0x00007fd541ceb3c8>

#1

Hello, just having an issue with thresholding using the recording tool to make a macro. The original image is a white square with blue dye on it and I’m using image j to gather data on the blue dye. When using the tool manually this turns the blue dye red and I’m able to use the analyze tool to gather this data. I’ve exported the threshold settings to the recorder and when run, the image is completely desaturated to black and white and no data can be gathered. Why the difference and how do I correct it?

Settings are as follows in the threshold menu:
Hue 124/204
Saturation 12/255
Brightness 0/255
Thresholding method: Default
Thresholding color: red
Color Space: HSB
all pass boxes are checked
dark background checked

This is the maco code:

// Color Thresholder 2.0.0-rc-22/1.49n
// Autogenerated macro, single images only!
min=newArray(3);
max=newArray(3);
filter=newArray(3);
a=getTitle();
run("HSB Stack");
run("Convert Stack to Images");
selectWindow("Hue");
rename("0");
selectWindow("Saturation");
rename("1");
selectWindow("Brightness");
rename("2");
min[0]=124;
max[0]=204;
filter[0]="pass";
min[1]=12;
max[1]=255;
filter[1]="pass";
min[2]=0;
max[2]=255;
filter[2]="pass";
for (i=0;i<3;i++){
  selectWindow(""+i);
  setThreshold(min[i], max[i]);
  run("Convert to Mask");
  if (filter[i]=="stop")  run("Invert");
}
imageCalculator("AND create", "0","1");
imageCalculator("AND create", "Result of 0","2");
for (i=0;i<3;i++){
  selectWindow(""+i);
  close();
}
selectWindow("Result of 0");
close();
selectWindow("Result of Result of 0");
rename(a);
// Colour Thresholding-------------

Thanks for your help!


#2

Hi @koot,

What you see after applying the macro on your images is the actual thresholding result. It produces a binary image. This is the basis for a multitute of different analyses.
In your case (without having seen the image) I would guess that the >Analyze >Analyze Particles… does the job.


#3

Actually, I have the same challenge … where the binary image generated by the colour thresholding macro isn’t usable for my analyses.

Is it possible to adapt the generated colour threshold macro to maintain the HSB colour space, instead of creating an 8-bit (?) image? Ideally, I’d like to measure a thresholded selection using the colour histogram function and/or the Colour Inspector 3D plug-in.