SetBitmapValue example for C++ 6.0 and later
short nRet;
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;
nRet = pRasterIO->Load( m_LEADRasterView1.GetRaster(),
"e:\\lead14\\dist\\images\\image1.cmp",
0,
1,
1);
AfxMessageBox("Image loaded from File - Wait");
pRasterIO->Release();
//insert the image into the element
m_pLEADDicomDS->Bitmap = m_LEADRasterView1.GetRaster().GetBitmap();
//set the bitmap
nRet = m_pLEADDicomDS->SetBitmapValue ( DICOM_IMAGE_COMPRESSION_NONE,
DICOM_IMAGE_PHOTOMETRIC_PALETTE_COLOR,
24,
0,
0);
if(nRet != 0)
{
AfxMessageBox("Error");
return;
}
AfxMessageBox("Image set to Data Set - Wait");
m_pLEADDicomDS->Bitmap = 0; //free the value
AfxMessageBox("Image cleared from memory - Wait");
//get the bitmap back
if(nRet == 0)
{
m_pLEADDicomDS->GetBitmapValue (0, 0, ORDER_RGB, 0);
m_LEADRasterView1.GetRaster().SetBitmap(m_pLEADDicomDS->Bitmap);
m_LEADRasterView1.ForceRepaint ();
}
AfxMessageBox("Image loaded from Data Set - Wait");