ApplyVOILUT example for C++ Builder
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TestVOILUT(True);
}
L_INT TForm1::TestVOILUT ( bool bLinear )
{
L_INT nRet;
L_UINT16 LUT[0x1000];
L_INT i;
L_INT nFirstStoredPixelValueMapped = 0;
unsigned uEntryBits = 16; unsigned uNumberOfEntries = 0x1000;
LEADImage1->Load("e:\\image1.cmp", 0, 1, 1 );
if(bLinear)
{
// Apply "Abdomen T1" window-level , high bit is assumed
// to be "11" and low bit "0.
nRet = LEADImage1->ApplyLinearVOILUT(330.0, 600.0, 0);
}
else
{
for(i = 0; i <= 0x1000; i++)
{
if(i < 30)
{
LUT[i] = 0;
}
else
if(i > 630)
{
LUT[i] = 630;
}
else
{
LUT[i] = i;
}
}
nFirstStoredPixelValueMapped = 0;
uEntryBits = 16;
uNumberOfEntries = 0x1000;
// apply the LUT
nRet = LEADImage1->ApplyVOILUT(LUT, uNumberOfEntries, nFirstStoredPixelValueMapped, uEntryBits, 0);
}
return nRet;
}