the Glasbey LUT & minimum colours

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

the Glasbey LUT & minimum colours

Jeremy Adler
Hi Gabriel,


1) re confusion about the 'glasbey inverted' and 'glasbey'  - my mac has both  while my PC only has the 'glasbey inverted'  - odd.

2) I have implemented a minimum color macro - how few colours are needed to individually colour ROIs that fill an image, such that each only touches those with a different colour.
The macro is attached - it generates a test image, then the minimum colour image and, for comparison, codes each ROI with a  different greyscale  (displayed with the glasbey). Typically it manages with 5 or 6 colours, much fewer than I expected.
Getting down to the theoretical minimum of 4 would require much more complex computation than the very simple method used.
The macro takes the ROIs sequentially, expands the ROI to check on the which colours are used by its neighbors and fills the ROI with the lowest unused intensity while trying to exclude diagonal connections that the 4 colour theory also rejects.

Playing with the macro throws up a irritating feature of the Voronoi, it leaves a 4 connected outline around each region and the resulting ROIs therefore do not completely fill the image. Software I used to used (Semper, Synoptics UK) would produce what it called a segmented image where the greyscale coded ROIs touched without an boundary.

Overall the minimum colours image is probably preferable to greyscale coding the ROIs and using the glasbey or similar, because with 255 different colours some the adjacent colours will inevitably be similar and there is something aesthetic about using a small number of colours, especially when printing. The glasbey method  has problems if more than 255 ROIs or greyscales are used since some adjacent ROIs will have the same intensity when displayed.

3) Apologies for sending the wrong file - probably senility. Correct one attached, a more or less random LUT that differs from the glasbey, which has a repeating motif.



-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Gabriel Landini
Sent: den 24 mars 2016 22:10
To: [hidden email]
Subject: Re: jpeg artifacts, the Glasbey LUT

On Thursday 24 Mar 2016 17:07:04 Jeremy Adler wrote:
> I have attached a pair of what I have called 'random' LUTs - they are
> the same except that one has zero set to black.

Hi Jeremy,
That file you posted, random.txt *is* the glasbey LUT, and the other has pure black as the first entry.
I guess that if a dark background is desired, one could swap entries 0 and 4 (although entry 4 it is not completely black).
Note that Curtis' inverted LUT might not preserving the colour relations as it is inverted in RGB space and the glasbey LUT is computed in CIE-Lab.
So I wonder if it would make more sense to convert to Lab and invert the L channel.

run("glasbey");
run("RGB Color");
run("Lab Stack");
setSlice(1);
run("Invert", "slice");
run("RGB Color");


BTW, when I downloaded the LUT from the link in my previous mail, it was a binary file, not a txt file. Not sure what is going on.

> In theory, but not using LUTs, we can colour an image with only 4
> different colours. But that is difficult computationally.

Yes, it would not be practical.

> However if we chose 10, I am guessing here, colours it could be done
> if each ROI had fewer than 9 neighbours: it would require starting
> with one ROI, colouring it, moving onto adjacent ROIs and for each of
> these checking their adjacent ROIs and picking a colour etc.

The problem is that most often we do not know how many neighbouring regions a given region has, and even then, it is not possible to know if the same colour would be adjacent in neighbouring regions.
Cheers

Gabriel

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

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

ColourRois14.txt (2K) Download Attachment
random-w.txt (5K) Download Attachment