ApplyVOILUT example for Delphi
procedure TForm1.Button1Click(Sender: TObject);
begin
TestVOILUT(True);
end;
Function TForm1.TestVOILUT ( bLinear: Boolean ): L_INT;
var
LUT: Array[0..$FFF] of L_UINT16;
nRet: L_INT;
i: L_INT;
nFirstStoredPixelValueMapped: L_INT;
uEntryBits: L_UINT;
uNumberOfEntries: L_UINT;
begin
LEADImage1.Load('e:\image1.cmp', 0, 1, 1 );
if (bLinear = True) then
begin
// Apply "Abdomen T1" window-level , high bit is assumed
// to be "11" and low bit "0.
nRet:= LEADImage1.ApplyLinearVOILUT(330.0, 600.0, 0);
end
else
begin
for i:= 0 to $1000 do
begin
if(i < 30) then
begin
LUT[i]:= 0;
end
else
if(i > 630) then
begin
LUT[i]:= 630;
end
else
begin
LUT[i]:= Trunc(i);
end;
end;
{ fill the LUTDescriptor structure }
nFirstStoredPixelValueMapped:= 0;
uEntryBits:= 16;
uNumberOfEntries:= $1000;
{ apply the LUT }
nRet:= LEADImage1.ApplyVOILUT( @LUT, uNumberOfEntries, nFirstStoredPixelValueMapped, uEntryBits, 0);
end;
Result:= nRet;
end;