ImageEn, unit ieDicomTags

GenerateDicomColorPalette

GenerateDicomColorPalette

Declaration

function GenerateDicomColorPalette(ColorTable: TIEColorTable; ColorCount: Integer = 256): TIEArrayOfTRGB;

Description

Returns an array of RGB colors for a specified color palette.
These palettes are commonly used to colorize gray-scale DICOM images.
ColorCount must be in the range of 2 - 256.


To display images with a color map (without modifying the image) use AssignColorMap.
To change the colors of an image use MapGrayToColor

Note:
Add ieDicomTags to your uses clause to support GenerateDicomColorPalette
ieDicomTags adds about 400KB to your exe
You can output the palette as an image using IEDrawColorPalette, or show the palette to the user using IEPromptForColor

Demos

Demo  Demos\InputOutput\DicomRange\Dicom.dpr
Demo  Demos\Other\ColorPalette\ColorPalette.dpr

Examples

Also see: Automated Samples
// Show preview of Rainbow color palette
var
  colorMap: TIEArrayOfTRGB;
  aColor: TColor;
begin
  colorMap := GenerateDicomColorPalette( iectRainbow );
  IEPromptForColor( aColor, colorMap, Length( colorMap ));
end;




// Show image with Rainbow palette (image is not changed)
colorMap := GenerateDicomColorPalette( iectRainbow );
ImageEnView1.IEBitmap.AssignColorMap( colorMap );
ImageEnView1.Update();




// Apply Hot Iron palette to image (change image)
colorMap := GenerateDicomColorPalette( iectHotIron );
ImageEnView1.Proc.MapGrayToColor( colorMap );




// Apply PET palette to image
colorMap := GenerateDicomColorPalette( iectPET );
ImageEnView1.Proc.MapGrayToColor( colorMap );




// Apply PET 20 Step palette to image
colorMap := GenerateDicomColorPalette( iectPET20Step );
ImageEnView1.Proc.MapGrayToColor( colorMap );




// Apply Hot Metal Blue palette to image
colorMap := GenerateDicomColorPalette( iectHotMetalBlue );
ImageEnView1.Proc.MapGrayToColor( colorMap );




// Display Hot Iron palette in TIEColorPalette
var
  colorMap: TIEArrayOfTRGB;
begin
  colorMap := GenerateDicomColorPalette( iectHotIron );
  ColorPalette1.AssignPalette( colorMap );
end;


// Show colors as inverted (Negative)
var
  colorMap: TIEArrayOfTRGB;
begin
  colorMap := GenerateDicomColorPalette( iectInverted );
  ColorPalette1.AssignPalette( colorMap );
end;


// Output a color palette
colorMap := GenerateDicomColorPalette( iectBerlin, 256 );
IEDrawColorPalette( bmp, colorMap, 17, 17, 32 );

See Also

IEPromptForColor
AssignColorMap
MapGrayToColor
IEDrawColorPalette