best way to select a range of colors

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

best way to select a range of colors

Rodrigo Gonçalves
Hi people, in the past I've used ImageJ/Fiji mostly for grayscale images, so I have little experience in the color world. Now I have some samples treated with a stain and I thought I would separate stained vs unstained particles. But it was not as straightforward as I expected (at least with the approach I'm using).

Here's the original image.
https://www.dropbox.com/s/yc7v90wv9s6rwje/initial_image.tif?dl=0

This is after I automatically re balance colors (for this step I used "auto adjust colors" in IrfanView, for some reason I can't get ImageJ to reach the same nice result with any of the "auto" options of the Color Balance tool):https://www.dropbox.com/s/lcmo93oce8rupze/step2_colors_autobalanced.tif?dl=0

In this image I pointed most of the interest particles so you can see the range of colors I'm looking for. https://www.dropbox.com/s/c78z37jbzsae223/some_interest_particles.jpg?dl=0

So the (unsuccessful) approach I tried is:1- manually select a few interest particles2- generate the color (RGB) histogram of those3- note the mean and standard deviation of each RGB4- with the Color Threshold tool, select the mean +/- 1-2 SD of each R, G and B

but this does not produce the desired threshold.
I'm sure this problem is as old as ImageJ so there must be tens of better ways, could you advice on this?Thanks a lot,
Rodrigo
 ________________________
Rodrigo J. Gonçalves

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

Re: best way to select a range of colors

Herbie-4
Good day Rodrigo,

at least in the posted JPG-image there is very little color information.
Consequently, reliable color segmentation according to the indicated
regions appears hardly possible.

The best results I get are from the Hue channel.

Perhaps you try a more selective staining technique.

Best

Herbie

:::::::::::::::::::::::::::::::::::::::::::
On 09.02.15 15:37, Rodrigo Gonçalves wrote:

> Hi people, in the past I've used ImageJ/Fiji mostly for grayscale
> images, so I have little experience in the color world. Now I have
> some samples treated with a stain and I thought I would separate
> stained vs unstained particles. But it was not as straightforward as
> I expected (at least with the approach I'm using).
>
> Here's the original image.
> https://www.dropbox.com/s/yc7v90wv9s6rwje/initial_image.tif?dl=0
>
> This is after I automatically re balance colors (for this step I used
> "auto adjust colors" in IrfanView, for some reason I can't get ImageJ
> to reach the same nice result with any of the "auto" options of the
> Color Balance
> tool):https://www.dropbox.com/s/lcmo93oce8rupze/step2_colors_autobalanced.tif?dl=0
>
>  In this image I pointed most of the interest particles so you can
> see the range of colors I'm looking for.
> https://www.dropbox.com/s/c78z37jbzsae223/some_interest_particles.jpg?dl=0
>
>  So the (unsuccessful) approach I tried is:1- manually select a few
> interest particles2- generate the color (RGB) histogram of those3-
> note the mean and standard deviation of each RGB4- with the Color
> Threshold tool, select the mean +/- 1-2 SD of each R, G and B
>
> but this does not produce the desired threshold. I'm sure this
> problem is as old as ImageJ so there must be tens of better ways,
> could you advice on this?Thanks a lot, Rodrigo
> ________________________ Rodrigo J. Gonçalves
>
> -- 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: best way to select a range of colors

Jacqueline Ross
In reply to this post by Rodrigo Gonçalves
Hi Rodrigo,

Not sure exactly what you want to do with your analysis, assume it's counting particles, size, shape, etc.

I tried the Threshold Colour plugin on your image but that didn't work very well for me as your hues are not very well defined.

So, I went to my favourite, which is the Colour Deconvolution plugin. This is designed (by Gabriel Landini) for histological stains and I thought I'd test it out for your image. I found it worked pretty well after some colour balancing, background subtraction (radius 100) and using the ROI option, making sure to only draw an ROI around the really pink pixels and then selecting the brownish ones for the second colour.

You can see the result in the attached JPG montage. If you want the full processed images, please email me directly as I don't want to clog up the list.

The first image in the panel is the result of the colour balance and background subtraction. I then used that for the Colour Deconvolution.

Cheers,

Jacqui

Jacqueline Ross
Biomedical Imaging Microscopist
Biomedical Imaging Research Unit 
School of Medical Sciences 
Faculty of Medical & Health Sciences
The University of Auckland
Private Bag 92019
Auckland 1142, NEW ZEALAND

Tel: 64 9 923 7438
Fax: 64 9 373 7484

http://www.fmhs.auckland.ac.nz/sms/biru/


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Rodrigo Gonçalves
Sent: Tuesday, 10 February 2015 3:38 a.m.
To: [hidden email]
Subject: best way to select a range of colors

Hi people, in the past I've used ImageJ/Fiji mostly for grayscale images, so I have little experience in the color world. Now I have some samples treated with a stain and I thought I would separate stained vs unstained particles. But it was not as straightforward as I expected (at least with the approach I'm using).

Here's the original image.
https://www.dropbox.com/s/yc7v90wv9s6rwje/initial_image.tif?dl=0

This is after I automatically re balance colors (for this step I used "auto adjust colors" in IrfanView, for some reason I can't get ImageJ to reach the same nice result with any of the "auto" options of the Color Balance tool):https://www.dropbox.com/s/lcmo93oce8rupze/step2_colors_autobalanced.tif?dl=0

In this image I pointed most of the interest particles so you can see the range of colors I'm looking for. https://www.dropbox.com/s/c78z37jbzsae223/some_interest_particles.jpg?dl=0

So the (unsuccessful) approach I tried is:1- manually select a few interest particles2- generate the color (RGB) histogram of those3- note the mean and standard deviation of each RGB4- with the Color Threshold tool, select the mean +/- 1-2 SD of each R, G and B

but this does not produce the desired threshold.
I'm sure this problem is as old as ImageJ so there must be tens of better ways, could you advice on this?Thanks a lot, Rodrigo
 ________________________
Rodrigo J. Gonçalves

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

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

Montage.jpg (143K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

FW: best way to select a range of colors

Jacqueline Ross
Hi Rodrigo,

The listserv just rejected my first email as the attached macro had the .ijm extension. I’ve saved it again as plain text (.txt) so you just need to open it in Fiji and then choose the language – ImageJ1.

Please read the email below for the original email I sent.

Cheers,
JR

Jacqueline Ross
Biomedical Imaging Microscopist
Biomedical Imaging Research Unit
School of Medical Sciences
Faculty of Medical & Health Sciences
The University of Auckland
Private Bag 92019
Auckland 1142, NEW ZEALAND

Tel: 64 9 923 7438
Fax: 64 9 373 7484

http://www.fmhs.auckland.ac.nz/sms/biru/

From: Jacqui Ross
Sent: Thursday, 9 April 2015 10:21 a.m.
To: 'Rodrigo Gonçalves'
Cc: [hidden email] ([hidden email])
Subject: RE: best way to select a range of colors

Hi Rodrigo,

I think the problem is that you haven’t incorporated your user values into the actual macro. On our website<https://www.fmhs.auckland.ac.nz/en/sms/about/our-departments/biomedical-imaging-research-unit/image-processing-and-analysis/analysis-resources.html>, there are some instructions for creating a macro for Colour Deconvolution using ROIs, which is written around standard ImageJ but it’s basically the same for Fiji except that you will have the colour coding options when you choose the language. In this case, I usually use ImageJ1 but obviously there are other ways of doing the macro – I take the simplest route☺.

I’ve modified a macro that I wrote previously to incorporate your values – see attached. This macro does the decon and then saves two of the result images into a Destination folder. I usually don’t want Colour 3 but if you do, then you can add that back in instead of closing it.

I’ve CCd the list in case anyone else is also interested. I also have the instructions in PDF if you want me to send it directly but I know the listserv won’t accept that file….

Cheers,

Jacqui

Jacqueline Ross
Biomedical Imaging Microscopist
Biomedical Imaging Research Unit
School of Medical Sciences
Faculty of Medical & Health Sciences
The University of Auckland
Private Bag 92019
Auckland 1142, NEW ZEALAND

Tel: 64 9 923 7438
Fax: 64 9 373 7484

http://www.fmhs.auckland.ac.nz/sms/biru/

From: Rodrigo Gonçalves [mailto:[hidden email]]
Sent: Thursday, 9 April 2015 8:53 a.m.
To: Jacqui Ross
Subject: Re: best way to select a range of colors

Dear Jacqui,

Have you ever used the Color Deconvolution plugin from a macro? I can't get it to show me the results :(

Please if you have one minute could you take a look at the email I sent to the list? (see below).
Thanks!!!
Rodrigo Gonçalves
_____________________
Dear all,

I'm preparing a macro in Fiji to run color deconvolution in all images inside a given folder (using Process-Batch-Macro).
What I intend is, for each image:
- Run color deconvolution with my user-defined colour vectors
- Save the first resulting image (colour 1) as a TIFF file in the same folder

I recorded the macro while doing color deconvolution and I can assign my user-defined values to the vectors. However the macro runs without showing the results.

The log file seems ok and there are no error messages or anything, but doesn't show anything else than the log.
I copy here the macro (and the log further down).

What am I missing?
Thanks!
Rodrigo

---- start of macro code ---// Colour vectors to use:

//Colour[1]:

  Red1=13.951654
  Green1=23.660986
  Blue1=19.173325

//Colour[2]:

  Red2=7.737847
  Green2=7.301559
  Blue2=9.771005

//Colour[3]:

  Red3=144.38943
  Green3=112.913376
  Blue3=85.59621


run("Colour Deconvolution", "vectors=[User values] show [r1]=Red1 [g1]=Green1 [b1]=Blue1 [r2]=Red2 [g2]=Green2 [b2]=Blue2 [r3]=Red3 [g3]=Green3 [b3]=Blue3");
---- end of macro code ---

---- start of log text ---User values Vector Matrix ---
Colour[1]:
  R1: 13.951654
  G1: 23.660986
  B1: 19.173325

Colour[2]:
  R2: 7.737847
  G2: 7.301559
  B2: 9.771005

Colour[3]:
  R3: 144.38943
  G3: 112.913376
  B3: 85.59621

User values Java code ---
        if (myStain.equals("New_Stain")){
        // This is the New_Stain
            MODx[0]=0.41649377;
            MODy[0]=0.706343;
            MODz[0]=0.57237446;
            MODx[1]=0.5356745;
            MODy[1]=0.5054712;
            MODz[1]=0.67642564;
            MODx[2]=0.7137465;
            MODy[2]=0.5581539;
            MODz[2]=0.42311957;
}
---- end of log text ---

________________________



________________________________
From: Jacqui Ross <[hidden email]<mailto:[hidden email]>>
To: [hidden email]<mailto:[hidden email]>
Sent: Tuesday, 10 February 2015, 1:30
Subject: Re: best way to select a range of colors

Hi Rodrigo,

Not sure exactly what you want to do with your analysis, assume it's counting particles, size, shape, etc.

I tried the Threshold Colour plugin on your image but that didn't work very well for me as your hues are not very well defined.

So, I went to my favourite, which is the Colour Deconvolution plugin. This is designed (by Gabriel Landini) for histological stains and I thought I'd test it out for your image. I found it worked pretty well after some colour balancing, background subtraction (radius 100) and using the ROI option, making sure to only draw an ROI around the really pink pixels and then selecting the brownish ones for the second colour.

You can see the result in the attached JPG montage. If you want the full processed images, please email me directly as I don't want to clog up the list.

The first image in the panel is the result of the colour balance and background subtraction. I then used that for the Colour Deconvolution.

Cheers,

Jacqui

Jacqueline Ross
Biomedical Imaging Microscopist
Biomedical Imaging Research Unit
School of Medical Sciences
Faculty of Medical & Health Sciences
The University of Auckland
Private Bag 92019
Auckland 1142, NEW ZEALAND

Tel: 64 9 923 7438
Fax: 64 9 373 7484

http://www.fmhs.auckland.ac.nz/sms/biru/


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]<mailto:[hidden email]>] On Behalf Of Rodrigo Gonçalves
Sent: Tuesday, 10 February 2015 3:38 a.m.
To: [hidden email]<mailto:[hidden email]>
Subject: best way to select a range of colors

Hi people, in the past I've used ImageJ/Fiji mostly for grayscale images, so I have little experience in the color world. Now I have some samples treated with a stain and I thought I would separate stained vs unstained particles. But it was not as straightforward as I expected (at least with the approach I'm using).

Here's the original image.
https://www.dropbox.com/s/yc7v90wv9s6rwje/initial_image.tif?dl=0

This is after I automatically re balance colors (for this step I used "auto adjust colors" in IrfanView, for some reason I can't get ImageJ to reach the same nice result with any of the "auto" options of the Color Balance tool):https://www.dropbox.com/s/lcmo93oce8rupze/step2_colors_autobalanced.tif?dl=0

In this image I pointed most of the interest particles so you can see the range of colors I'm looking for. https://www.dropbox.com/s/c78z37jbzsae223/some_interest_particles.jpg?dl=0

So the (unsuccessful) approach I tried is:1- manually select a few interest particles2- generate the color (RGB) histogram of those3- note the mean and standard deviation of each RGB4- with the Color Threshold tool, select the mean +/- 1-2 SD of each R, G and B

but this does not produce the desired threshold.
I'm sure this problem is as old as ImageJ so there must be tens of better ways, could you advice on this?Thanks a lot, Rodrigo
 ________________________
Rodrigo J. Gonçalves

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



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


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

Rodrigo_Decon_batch.txt (1K) Download Attachment