DcmDataset *m_dcmDataset = dfile->getDataset(); E_TransferSyntax xfer = m_dcmDataset ->getOriginalXfer(); DicomImage *di = new DicomImage(m_dcmDataset,xfer,CIF_MayDetachPixelData,1,2); di->setHistogramWindow(); di = di->createScaledImage((const unsigned long)100,(const unsigned long)100,1,1); //di->writeBMP(bmpFilePath,24); void * bufferpic; di->createWindowsDIB(bufferpic,0,0,24,1,1);
BITMAPINFO m_bmiCurrentImage; memset(&m_bmiCurrentImage, 0, sizeof(m_bmiCurrentImage)); m_bmiCurrentImage.bmiHeader.biSize = sizeof(m_bmiCurrentImage.bmiHeader); m_bmiCurrentImage.bmiHeader.biWidth = di->getWidth();; m_bmiCurrentImage.bmiHeader.biHeight = di->getHeight();; m_bmiCurrentImage.bmiHeader.biPlanes = 1; m_bmiCurrentImage.bmiHeader.biBitCount = 24; m_bmiCurrentImage.bmiHeader.biCompression = BI_RGB;
HBITMAP hbitmap = CreateDIBitmap(GetDC()->m_hDC,&(m_bmiCurrentImage.bmiHeader), CBM_INIT,bufferpic, &m_bmiCurrentImage,DIB_RGB_COLORS);
//HBITMAP hbitmap = (HBITMAP)LoadImage(NULL,bmpFilePath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE); CBitmap *bmp = CBitmap::FromHandle(hbitmap); if(bmp!=NULL) { COLORREF rgbTransparentColor; m_imageList.Add(bmp,rgbTransparentColor); m_listCtrl.InsertItem(0,finder.GetFileName(),index++); m_filepaths->AddHead(filePath); }dcmtk 中创建的DIB设备无关图要绑定到CIMAGELIST中,先要CreateDIBitmap创建成设备相关的图,在绑定!
转载于:https://www.cnblogs.com/nanshouyong326/archive/2009/08/05/1539725.html
相关资源:dcmtk使用手册,dcmtk使用手册,dcmtk使用手册