ApplyModalityLUT Example for C++ 5.0 and later
int CTestImgProcView::TestModalityLUT(BOOL bLinear)
{
int nRet = 0;
ILEADRasterVariant * pRasterVar = NULL;
CoCreateInstance(
CLSID_LEADRasterVariant,
NULL,
CLSCTX_ALL,
IID_ILEADRasterVariant,
(void**)&pRasterVar
);
pRasterVar->Type
= VALUE_ARRAY_LONG;
pRasterVar->ItemCount
= 65536;
if (bLinear)
{
nRet = m_pRasterProc->ApplyLinearModalityLUT(m_LeadRasterView.GetRaster(), 0, 0.5, (ModalityLUTConstants)0);
}
else
{
for(int i = 0; i < 65536; ++i)
{
pRasterVar->PutLongItemValue(i,
i/2);
}
m_pRasterProc->ApplyModalityLUT(m_LeadRasterView.GetRaster(),
pRasterVar, 0, (ModalityLUTConstants)0);
}
pRasterVar->Release();
return nRet;
}