Imebra库在传输语法1.2.840.10008.1.2.1中显示为完全灰色图像,>

问题描述 投票:0回答:1

我正在尝试使用Imebra库在android中显示DICOM图像。 Iam使用该库的版本5.0。显示的位图是完全灰色的,图像的传输语法为1.2.840.10008.1.2.1。对于其他受支持的传输语法,例如JPEG,它可以正常工作。

enter image description here

而且我也无法按照文档中所述添加VOILUT转换功能,它提供了VOILUT找不到错误的构造器。

enter image description here

下面是Iam使用的代码,VOILUT转换部分给出了未找到的构造方法。如果我删除VOILUT变换部分,则一切正常,但对于传输语法为1.2.840.10008.1.2.1的图像,它显示为完全灰色图像

    private Bitmap fromDicom(String filePath, int frameNumber){

    // have been applied).
    Image dicomImage = loadedDataSet.getImageApplyModalityTransform(frameNumber);

    // Use a DrawBitmap to build a stream of bytes that can be handled by the
    // Android Bitmap class.
    com.imebra.TransformsChain chain = new com.imebra.TransformsChain();


    if(com.imebra.ColorTransformsFactory.isMonochrome(dicomImage.getColorSpace());
    {
        // Allocate a VOILUT transform. If the DataSet does not contain any pre-defined
        //  settings then we will find the optimal ones.
        VOILUT voilutTransform = new VOILUT();

        // Retrieve the VOIs (center/width pairs)
        com.imebra.vois_t vois = loadedDataSet.getVOIs();

        // Retrieve the LUTs
        List<LUT> luts = new ArrayList<LUT>();
        for(long scanLUTs = 0; ; scanLUTs++)
        {
            try
            {
                luts.add(loadedDataSet.getLUT(new com.imebra.TagId(0x0028,0x3010), scanLUTs));
            }
            catch(Exception e)
            {
                break;
            }
        }

        if(!vois.isEmpty())
        {
            voilutTransform.setCenterWidth(vois.get(0).center, vois.get(0).width);
        }
        else if(!luts.isEmpty())
        {
            voilutTransform.setLUT(luts.get(0));
        }
        else
        {
            voilutTransform.applyOptimalVOI(dicomImage, 0, 0, width, height);
        }

        chain.add(voilutTransform);
    }


    DrawBitmap drawBitmap = new DrawBitmap(chain);
    Memory memory = drawBitmap.getBitmap(dicomImage, drawBitmapType_t.drawBitmapRGBA, 4);

    // Build the Android Bitmap from the raw bytes returned by DrawBitmap.
    Bitmap renderBitmap = Bitmap.createBitmap((int)dicomImage.getWidth(), (int)dicomImage.getHeight(), Bitmap.Config.ARGB_8888);
    byte[] memoryByte = new byte[(int)memory.size()];
    memory.data(memoryByte);
    ByteBuffer byteBuffer = ByteBuffer.wrap(memoryByte);
    renderBitmap.copyPixelsFromBuffer(byteBuffer);
    // Update the image
    return renderBitmap;

}

我正在尝试使用Imebra库在android中显示DICOM图像。 Iam使用该库的版本5.0。显示的位图是完全灰色的,图像的传输语法为1.2.840.10008.1.2.1。对于...

java android image-processing dicom imebra
1个回答
0
投票

[VOILUT必须使用数据集中的适当对比度设置进行初始化,如下面的代码。

© www.soinside.com 2019 - 2024. All rights reserved.