SetBitmapListValue example for C++ 6.0 and later
short nRet;
long lCount;
m_pLEADDicomDS->EnableMethodErrors = FALSE;
//move to the root element
m_pLEADDicomDS->MoveFirstElement (FALSE);
m_pLEADDicomDS->MoveRootElement ();
//insert a new element for the Bitmap Value
nRet = m_pLEADDicomDS->FindFirstElement (TAG_PIXEL_DATA, FALSE);
nRet = m_pLEADDicomDS->DeleteElement();
nRet = m_pLEADDicomDS->InsertElement (FALSE, TAG_PIXEL_DATA, VR_OB, FALSE, 0);
m_LEADRasterView1.ShowWindow(SW_SHOW);
//load an image
ILEADRasterIO *pRasterIO=NULL;
HRESULT hr;
hr = CoCreateInstance(CLSID_LEADRasterIO,
NULL,
CLSCTX_ALL,
IID_ILEADRasterIO,
(void**)&pRasterIO);
pRasterIO->EnableMethodErrors = FALSE;
pRasterIO->Load(m_LEADRasterView1.GetRaster(),"e:\\lead14\\dist\\images\\image1.cmp", 0, 1, 1);
AfxMessageBox("Image loaded from File - Wait");
pRasterIO->Release();
//flip the image
ILEADRasterProcessPtr pRasterProcess=NULL;
CoCreateInstance(CLSID_LEADRasterProcess,
NULL,
CLSCTX_ALL,
IID_ILEADRasterProcess,
(void**)&pRasterProcess);
pRasterProcess->EnableMethodErrors = FALSE;
//create a bitmap list
m_LEADRasterView2.GetRaster().InsertBitmapListItem(0, m_LEADRasterView1.GetRaster().GetBitmap());
pRasterProcess->Flip(m_LEADRasterView1.GetRaster());
m_LEADRasterView2.GetRaster().InsertBitmapListItem(1, m_LEADRasterView1.GetRaster().GetBitmap());
pRasterProcess->Reverse(m_LEADRasterView1.GetRaster());
m_LEADRasterView2.GetRaster().InsertBitmapListItem(2, m_LEADRasterView1.GetRaster().GetBitmap());
//insert the image list into the element
m_pLEADDicomDS->BitmapList = m_LEADRasterView2.GetRaster().GetBitmapList();
//set the bitmap list
nRet = m_pLEADDicomDS->SetBitmapListValue(DICOM_IMAGE_COMPRESSION_NONE,
DICOM_IMAGE_PHOTOMETRIC_PALETTE_COLOR,
24,
0,
0);
if(nRet != 0)
{
AfxMessageBox("Error");
return;
}
AfxMessageBox("ImageList set to Data Set - Wait");
m_pLEADDicomDS->BitmapList = 0; //free the value
AfxMessageBox("ImageList cleared from memory - Wait");
lCount = m_pLEADDicomDS->GetBitmapCount();
//get the bitmap list back
if(nRet == 0)
{
m_pLEADDicomDS->GetBitmapListValue(0, lCount, 0, ORDER_RGB, 0);
m_LEADRasterView1.GetRaster().SetBitmapList(m_pLEADDicomDS->BitmapList);
m_LEADRasterView1.ForceRepaint();
}
AfxMessageBox("ImageList loaded from Data Set - Wait");