Problem with thresholding

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with thresholding

sdegan
Hi All,

I am having a problem quantifying an antibody staining where the value of
the total area comes up smaller than the value of the cells stained by the
antibody (it should be the opposite).

In the past with the color threshold plugin I was able to sample the
staining and have the values for both total area and the staining. Now it
this not working so I tried some workaround. Here is the macro for the
reactive area to the antibody where I run the color threshold and then I
inverted the image and re-run the threshold (this was one of the many
attempts).

I am attaching the original image and the image generated after running the
macro for the threshold antibody calculation in the output folder (black
background). You can also check a third image (white background) that was
generated during the second threshold calculation in the macro.

Does anybody have any idea what I am missing since it was working in the
past?

Thank you


// Color Thresholder 1.52k
// 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]=117;
max[0]=229;
filter[0]="stop";
min[1]=170;
max[1]=255;
filter[1]="pass";
min[2]=102;
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-------------


run("Invert");

run("Duplicate...", " ");
setAutoThreshold("Intermodes");
//setThreshold(0, 125);
run("Convert to Mask");


run("Set Scale...", "distance=340 known=100 pixel=1 unit=um");

run("Measure");


<http://imagej.1557.x6.nabble.com/file/t187616/photomicrograph.png>
<http://imagej.1557.x6.nabble.com/file/t187616/44773_Tra%2BHCQ_F40_dapi_Merge_001.jpg>
<http://imagej.1557.x6.nabble.com/file/t187616/Screen_Shot_2020-11-10_at_5.png>






--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Problem with thresholding

Gabriel Landini
Hi,
With a confocal stack, to quantify the area occupied in the red channel, I
would not use the colour threshold plugin, but just the red channel as a
greyscale image. You are complicating things unnecessarily.

In addition, the intensity of the channels in a confocal microscope depend on
a number of things, that you need to control, not just the amount of bound of
antibody bound.

From the description is not possible to tell what is that you consider "total
area" so not sure what may be wrong with the areas detected. Maybe you are
comparing pixel units and calibrated units.

Hope it helps

Gabriel


On Tuesday, 10 November 2020 23:37:30 GMT you wrote:

> Hi All,
>
> I am having a problem quantifying an antibody staining where the value of
> the total area comes up smaller than the value of the cells stained by the
> antibody (it should be the opposite).
>
> In the past with the color threshold plugin I was able to sample the
> staining and have the values for both total area and the staining. Now it
> this not working so I tried some workaround. Here is the macro for the
> reactive area to the antibody where I run the color threshold and then I
> inverted the image and re-run the threshold (this was one of the many
> attempts).
>
> I am attaching the original image and the image generated after running the
> macro for the threshold antibody calculation in the output folder (black
> background). You can also check a third image (white background) that was
> generated during the second threshold calculation in the macro.
>
> Does anybody have any idea what I am missing since it was working in the
> past?
> I recently updated ImageJ.
> Thank you
>
>
> // Color Thresholder 1.52k
> // 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]=117;
> max[0]=229;
> filter[0]="stop";
> min[1]=170;
> max[1]=255;
> filter[1]="pass";
> min[2]=102;
> 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-------------
>
>
> run("Invert");
>
> run("Duplicate...", " ");
> setAutoThreshold("Intermodes");
> //setThreshold(0, 125);
> run("Convert to Mask");
>
>
> run("Set Scale...", "distance=340 known=100 pixel=1 unit=um");
>
> run("Measure");
>
>
> <http://imagej.1557.x6.nabble.com/file/t187616/photomicrograph.png>
> <http://imagej.1557.x6.nabble.com/file/t187616/44773_Tra%2BHCQ_F40_dapi_Merg
> e_001.jpg>
> <http://imagej.1557.x6.nabble.com/file/t187616/Screen_Shot_2020-11-10_at_5.
> png>
>
>
>
>
>
>
> --
> Sent from: http://imagej.1557.x6.nabble.com/
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Problem with thresholding

sdegan
Hi,

This is not a stack. It is an immunofluorescence photomicrograph.
What is very, very weird and never happened in the past, is that I am having
the threshold values the same for all samples after sampling the cells with
the antibody staining using the sample tool in "color threshold".

Previously I was sampling the stained area of interested and the area was
coming up as a value of the actual staining for each image. What is even
more weird is that, if I run an image without the macro, but following the
same steps manually I had different -I believe the real- value of the area
picked up by the threshold.

Here is the macro I used:

// Color Thresholder 1.53f
// 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]=0;
max[0]=255;
filter[0]="pass";
min[1]=0;
max[1]=250;
filter[1]="pass";
min[2]=134;
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-------------
run("Set Scale...", "distance=340 known=200 unit=um");
run("Measure");

<http://imagej.1557.x6.nabble.com/file/t187616/Screen_Shot_2020-11-10_at_8.png>





--
Sent from: http://imagej.1557.x6.nabble.com/

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