Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, October 27, 2016 7:28:44 AM(UTC)

Hussam  
Hussam

Groups: Registered, Tech Support
Posts: 14


The attached sample C# project shows how RasterImage.GetPalette and RasterImage.SetPalette can be used with 8-bit ordered grayscale images to convert the grayscale image to an image with pseudocolors.

The output image is derived from the grayscale image by mapping each intensity value to a color that ranges from pure blue for intensity zero (black) to pure green for intensity 255 (white).

Here the RasterImage.GetPalette() method from our toolkit is used to obtain the ordered grayscale palette of an 8-bit image. Then each element in the resulting ascending array is mapped to a desired color.

This code example implements a two-color fade with blue at the cold end and green at the hot end though you can get a more complex gradient by defining different color gradients for subsets of the palette, for example:
for (int i = 0; i < ourPalette.Length/3; ++i): Blue to Green
for (int i = ourPalette.Length/3; i < 2*ourPalette.Length/3; ++i): Green to Yellow
for (int i = 2*ourPalette.Length/3; i < ourPalette.Length; ++i): Yellow to Red

Finally, note that if you are using extended grayscale images (10-16) which are typical of medical images, then our medical SDK has the GetLookupTable and SetLookupTable Methods which can be used as above.
input and output

File Attachment(s):
Comparison.png (594kb) downloaded 1,418 time(s).
File Attachment(s):
CS_GreyToPseudo.zip (412kb) downloaded 333 time(s).
Hussam Barouqa
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.051 seconds.