2
我想在android上顯示DICOM圖像。有沒有什麼辦法可以在Android上將DICOM圖像轉換爲JPEG格式?在Android上顯示DICOM圖像
目前DICOM默認轉換爲位圖返回null
。任何想法如何繼續?
我想在android上顯示DICOM圖像。有沒有什麼辦法可以在Android上將DICOM圖像轉換爲JPEG格式?在Android上顯示DICOM圖像
目前DICOM默認轉換爲位圖返回null
。任何想法如何繼續?
Imebra提供了Java綁定Android和文檔演示瞭如何提取準備要顯示的圖像:
// 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);
什麼是DICOM圖像? –
檢查此鏈接http://stackoverflow.com/questions/5739349/how-to-access-dicom-file-on-android-os http://stackoverflow.com/questions/20094508/converting-dicom-image-to -jpeg-image – Randroid
感謝您的回覆。我已經檢查了上述鏈接。但BufferedImage和ImageIo類是java特定的,並且不支持在android中。 – Kalyani