Author Topic: Editing false colour palettes  (Read 5447 times)

Malcolm Roberts

  • Professor
  • ****
  • Posts: 134
Editing false colour palettes
« on: March 10, 2015, 01:08:31 AM »
Hi John,
Is there a way to edit the false colour palettes provided with PfEPMA? It would be nice to tweak rainbow to make backgrounds black, and make the custom FC palette look "nice"......... Its currently too pastel for my tastes. I have tried this in Surfer, but it does not recognise the format. I have opened the file in notepad and had a look and am none the wiser, nor have I made any headway in image J....... What's the trick?
Cheers,
malc.

UofO EPMA Lab

  • Professor
  • ****
  • Posts: 52
    • CAMCOR MicroAnalytical Facility
Re: Editing false colour palettes
« Reply #1 on: March 10, 2015, 01:23:56 PM »
Is there a way to edit the false colour palettes provided with PfEPMA? It would be nice to tweak rainbow to make backgrounds black, and make the custom FC palette look "nice"......... Its currently too pastel for my tastes. I have tried this in Surfer, but it does not recognise the format. I have opened the file in notepad and had a look and am none the wiser, nor have I made any headway in image J....... What's the trick?

Too pastel for your tastes...   eh?    ;)   Well I was trying to avoid black on both ends of each spectrum because if both the min and max are black... well you know.

But yes they can be edited.  Basically the FC format is quite simple as seen here:

False color description for MicroImage/Probe For EPMA/CalcImage
BEGIN Items
 Interpolate = 1
 Item=0 0 16711808 untitled
 Item=255 255 65535 untitled
 Item=120 120 8453888 untitled
END Items


Basically one can have either a non interpolated color scale or an interpolated color scale. If non interpolated (Interpolate = 0), then each color index (0 to 255) must be specified specifically. So you need 256 color entries.  For the interpolated color scale one only needs to specify at least two color entries (0 and 255). The app will automatically interpolate between the two colors specified.

The first two parameters for the "Item=" keywords are the color index entry numbers (0 through 255) for the start index and end index. Usually the same index is specified for each color in the non interpolated case, though one can define multiple color index numbers to the same color.

The last number is the 24 bit RGB composite color number, produced like this: Red + Green * 255 + Blue * 65535.  These are stored in a 32 bit long integer where the 4th byte is the "alpha" parameter which is not used by VB.

To compare to the JEOL .LUT color file, see below where I have attached a JEOL .LUT file and the same file converted to a .FC format.  Note that the JEOL .LUT file contains the 3 RGB 8 bit colors *not* composited as they are in the .FC file.

The easiest thing is probably for me to add a button somewhere to allow the user to convert .LUT files to .FC files.

What do you think?
« Last Edit: March 10, 2015, 01:26:06 PM by UofO EPMA Lab »
UofO MicroAnalytical Facility

Malcolm Roberts

  • Professor
  • ****
  • Posts: 134
Re: Editing false colour palettes
« Reply #2 on: March 10, 2015, 05:49:33 PM »
I think I'd prefer to save .clr files from surfer as .fc. Meanwhile, I must find scaffolding to prise my jaw off the desk....... :o

Malcolm Roberts

  • Professor
  • ****
  • Posts: 134
Re: Editing false colour palettes
« Reply #3 on: March 10, 2015, 07:50:37 PM »
Hi John
We've been knocking heads here to try and figure out what is going on and how to make changes. Firstly, we need to know where these palettes are being used from. I have tried making mods (very carefully I may add) to the .fc files in the PfEPMA folder and these are not being applied to the images in PfEPMA.
Further info on how the thing operates required please.......
Scaffolding assuming monumental proportions.......
Cheers,
malc.

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: Editing false colour palettes
« Reply #4 on: March 10, 2015, 09:36:26 PM »
We've been knocking heads here to try and figure out what is going on and how to make changes. Firstly, we need to know where these palettes are being used from. I have tried making mods (very carefully I may add) to the .fc files in the PfEPMA folder and these are not being applied to the images in PfEPMA.
Further info on how the thing operates required please.......
Scaffolding assuming monumental proportions.......

Hi Malcolm,
Stick to only modifying the custom.fc file and I think you will be fine.   By the way, you are the first user since I started programming, to ask about modifying the color palettes, but I do understand...

Ok, so I will add a .CLR to .FC convertor in the next release (tomorrow?), but in the meantime here is a JEOL .LUT to .FC converter in CalcImage:



By the way, the above red-blue palette can be created in a .fc file using just two colors...

The JEOLCOLOR.FC file I attached previously is the one you are probably used to. Just rename it to custom.fc and copy it to the PFE app folder. I do not overwrite that file on updates.
« Last Edit: March 10, 2015, 10:56:21 PM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Ben Buse

  • Professor
  • ****
  • Posts: 498
Re: Editing false colour palettes
« Reply #5 on: August 11, 2015, 09:40:27 AM »
Hi John,

I've been creating color tables for different phases in calcimage. So I've been modifying the CUSTOM.FC file as suggested. I noticed slight mistake - 24 bit RGB composite color number formula should be: Red + Green * 256 + Blue * 65536. (256 not 255, and 65536 not 65535).

I really like your color table files - there easy to make. Such that I've made an excel file to generate the CUSTOM.FC file script. In it the color is selected for each phase and the script is copied for that number of phases into the CUSTOM.FC file. I've attached it in case its useful for anyone else. I've locked all the cells except those which you type in. No macros required. Instructions in red text boxes.

Ben


John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: Editing false colour palettes
« Reply #6 on: August 11, 2015, 10:11:16 AM »
Hi John,

I've been creating color tables for different phases in calcimage. So I've been modifying the CUSTOM.FC file as suggested. I noticed slight mistake - 24 bit RGB composite color number formula should be: Red + Green * 256 + Blue * 65536. (256 not 255, and 65536 not 65535).

I really like your color table files - there easy to make. Such that I've made an excel file to generate the CUSTOM.FC file script. In it the color is selected for each phase and the script is copied for that number of phases into the CUSTOM.FC file. I've attached it in case its useful for anyone else. I've locked all the cells except those which you type in. No macros required. Instructions in red text boxes.

Ben

Hi Ben,
Thanks and very nice.

Is the 65535 mistake in the documentation?  Where?
john
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Ben Buse

  • Professor
  • ****
  • Posts: 498
Re: Editing false colour palettes
« Reply #7 on: August 13, 2015, 03:07:53 AM »
Hi John,

Sorry I did not make clear its just wrong further up this post in your response to Malcom,

I haven't looked in the documentation

Thanks

Ben

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: Editing false colour palettes
« Reply #8 on: August 13, 2015, 06:57:07 AM »
Hi John,

Sorry I did not make clear its just wrong further up this post in your response to Malcom,

I haven't looked in the documentation

Thanks

Ben

Hmmm, I checked and this is what is in my code:

' Load RBG data
RGB_WtPercents!(1) = InputArray!(ipixelx&, ipixely&, R_Column%)
RGB_WtPercents!(2) = InputArray!(ipixelx&, ipixely&, G_Column%)
RGB_WtPercents!(3) = InputArray!(ipixelx&, ipixely&, B_Column%)

' Calculate composite color
If RGB_WtPercents!(1) <> 0# And RGB_WtPercents!(2) <> 0# And RGB_WtPercents!(3) <> 0# Then
RGB_Fractions!(1) = RGB_WtPercents!(1) / (RGB_WtPercents!(1) + RGB_WtPercents!(2) + RGB_WtPercents!(3))
RGB_Fractions!(2) = RGB_WtPercents!(2) / (RGB_WtPercents!(1) + RGB_WtPercents!(2) + RGB_WtPercents!(3))
RGB_Fractions!(3) = RGB_WtPercents!(3) / (RGB_WtPercents!(1) + RGB_WtPercents!(2) + RGB_WtPercents!(3))

' Check for range
If RGB_Fractions!(1) < 0# Then RGB_Fractions!(1) = 0#
If RGB_Fractions!(2) < 0# Then RGB_Fractions!(2) = 0#
If RGB_Fractions!(3) < 0# Then RGB_Fractions!(3) = 0#

If RGB_Fractions!(1) > 1# Then RGB_Fractions!(1) = 1#
If RGB_Fractions!(2) > 1# Then RGB_Fractions!(2) = 1#
If RGB_Fractions!(3) > 1# Then RGB_Fractions!(3) = 1#

' Save for GRD output (24 bit color values)
RGBData(1).gData!(ipixelx&, ipixely&) = CLng(RGB_Fractions!(1) + RGB_Fractions!(2) * 255 + RGB_Fractions!(3) * 65535)
If RGBData(1).gData!(ipixelx&, ipixely&) < RGBData(1).zmin# Then RGBData(1).zmin# = RGBData(1).gData!(ipixelx&, ipixely&)
If RGBData(1).gData!(ipixelx&, ipixely&) > RGBData(1).zmax# Then RGBData(1).zmax# = RGBData(1).gData!(ipixelx&, ipixely&)


I think it is correct for zero indexing?
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"