我想在 Android 上显示 DICOM 图像。有没有办法在 Android 上将 DICOM 图像转换为 JPEG?
当前 DICOM 到位图的默认转换返回 null
。知道如何继续吗?
最佳答案
Imebra为 android 提供 Java 绑定(bind),文档显示如何提取准备显示的图像:
// Allocate a transforms chain: contains all the transforms to execute before displaying
// an image. Can be empty
TransformsChain transformsChain = new TransformsChain();
// Let's use a DrawBitmap object to generate a buffer with the pixel data. We will
// use that buffer to create an Android Bitmap
com.imebra.dicom.DrawBitmap drawBitmap = new com.imebra.dicom.DrawBitmap(image, transformsChain);
int temporaryBuffer[] = new int[1]; // Temporary buffer. Just used to get the needed buffer size
int bufferSize = drawBitmap.getBitmap(image.getSizeX(), image.getSizeY(), 0, 0, image.getSizeX(), image.getSizeY(), temporaryBuffer, 0);
int buffer[] = new int[bufferSize]; // Ideally you want to reuse this in subsequent calls to getBitmap()
// Now fill the buffer with the image data and create a bitmap from it
drawBitmap.getBitmap(image.getSizeX(), image.getSizeY(), 0, 0, image.getSizeX(), image.getSizeY(), buffer, bufferSize);
Bitmap renderBitmap = Bitmap.createBitmap(buffer, image.getSizeX(), image.getSizeY(), Bitmap.Config.ARGB_8888);
imageView.setImageBitmap(renderBitmap);
关于android - 在 Android 上显示 DICOM 图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24056033/