SetBitmapListValue Example for C++Builder
Cardinal uCount;
int nRet;
LEADDicom1->EnableMethodErrors = false;
/* move to the root element */
LEADDicom1->MoveFirstElement(false);
LEADDicom1->MoveRootElement();
/* insert a new element for the BitmapList Value */
LEADDicom1->FindFirstElement(TAG_PIXEL_DATA, false);
LEADDicom1->DeleteElement();
LEADDicom1->InsertElement(false, TAG_PIXEL_DATA, VR_OB, false, 0);
/* load an image */
LEADImage1->Load("c:\\lead\\images\\image1.cmp", 0, 1, 1);
ShowMessage("Image loaded from File - Wait");
/* create a bitmap list */
LEADImage2->InsertBitmapListItem(0, LEADImage1->Bitmap);
LEADImage1->Flip ();
LEADImage2->InsertBitmapListItem(1, LEADImage1->Bitmap);
LEADImage1->
Reverse();
LEADImage2->InsertBitmapListItem(2, LEADImage1->Bitmap);
/* insert the image list into the element */
LEADDicom1->BitmapList = LEADImage2->BitmapList;
/* set the bitmap list */
nRet = LEADDicom1->SetBitmapListValue(DICOM_IMAGE_COMPRESSION_NONE, DICOM_IMAGE_PHOTOMETRIC_RGB, 0, 0);
if(nRet != SUCCESS)
{
ShowMessage("Error Number: " + IntToStr(LEADDicom1->Error));
return;
}
ShowMessage("Image set to Data Set - Wait");
LEADDicom1->BitmapList = 0; /* free the value */
ShowMessage("ImageList cleared from memory - Wait");
uCount = LEADDicom1->GetBitmapCount();
/* get the bitmap list back */
if(nRet == SUCCESS)
{
LEADDicom1->GetBitmapListValue(0, uCount, 0, ORDER_RGB);
LEADImage1->BitmapList = LEADDicom1->BitmapList;
LEADImage1->ForceRepaint();
}
LEADDicom1->EnableMethodErrors = true;
ShowMessage("ImageList loaded from Data Set - Wait");