繁体   English   中英

ImageJ API:合并图像

[英]ImageJ API: Combining images

我试图使用ImageJ api保存一个合成图像,该图像由并排放置的多个图像组成。

我有加载ImagePlus objs并保存它们的代码。 但是我不知道如何将一个图像粘贴到另一个图像中。

我将问题解释为拍摄多张图像并将它们并排缝合在一起以形成较大的图像,其中图像可能具有不同的尺寸。 以下不完整的代码是执行此操作的一种方法,应该使您入门。

public ImagePlus composeImages(ArrayList<ImagePlus> imageList){
    int sumWidth = 0;
    int maxHeight = 0;

    for(ImagePlus imp : imageList){
        sumWidth = sumWidth +imp.getWidth();
        if(imp.getHeight() > maxHeight)
            maxHeight = imp.getWidth();

    }

    ImagePlus impComposite = new ImagePlus();

    ImageProcessor ipComposite = new ShortProcessor(sumWidth, maxHeight);

    for(int i=0; i<sumWidth; i++){
        for(int j=0; j<sumWidth; j++){

            ipComposite.putPixelValue(i, j, figureOutThis);

        }
    }

    impComposite.setProcessor(ipComposite);
    return impComposite;

}

您需要编写一种算法来查找要放入合成图像ij的像素值( figureOutThis )。 如果所有图像都具有相同的宽度,否则工作量会很小。 快乐编码

编辑:我应该补充一点,我假设它们都是短图像(我使用医学灰度)。 您可以为其他处理器修改它

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM