简体   繁体   English

如何在ImageJ中获得像素值矩阵?

[英]how to get a matrix of pixel values in ImageJ?

I am sorry if I have overlooked the answer to my question in the Fiji tutorials. 很抱歉,如果我忽略了斐济教程中问题的答案。 I guess I am wondering; 我想我在想; is there any way of getting information about all the image pixel values (for instance in a matrix? or a list of matrices) from either the imagePlus, ImageStack or process.ImageProcessor? 有什么方法可以从imagePlus,ImageStack或process.ImageProcessor获取有关所有图像像素值的信息(例如,在矩阵中还是在矩阵列表中)?

I have so far tried to get pixel values (my image has 262144 pixels) as seen in the two lowest lines. 到目前为止,我一直试图获得像素值(我的图像具有262144像素),如最低的两行所示。 Pixels should now be an array of pixel values, but its an object that I can't access as an array. 像素现在应该是像素值的数组,但是它是我无法作为数组访问的对象。 I get that the pixel is 0 (which seems to be an out of bounds return value), and that the pixelValue is -1024. 我得到像素为0(似乎是超出范围的返回值),而pixelValue是-1024。

Any help would be very appreciated.. 任何帮助将不胜感激。

import ij._
import java.nio.file.{Paths,Files}

object Main{
    def main(args: Array[String]){ 
        println(ImagesProcessing.read())
    }
}

object ImagesProcessing { 

    def read():Unit = {
        val image: ImagePlus = IJ.openImage("./image.dcm")
        val stack:ImageStack = image.getImageStack()
        val processor: process.ImageProcessor = image.getProcessor().convertToRGB()
        val pixels = processor.getPixels()
        println(pixels)
   }

}

I have looked into the tutorial suggested, and it seems that I am using the correct functions. 我已经研究了建议的教程,看来我使用的是正确的功能。 I have decided to convert to RGB as that is mentioned in the first suggested tutorial. 我决定转换为RGB,这在第一个建议的教程中已提到。 The only thing I see that I am not doing is a type casting. 我唯一看不到的就是类型转换。 I believe I am getting a Java object which I do not know how to iterate over (I wrote a separate question about that). 我相信我得到了一个我不知道如何迭代的Java对象(我为此写了一个单独的问题)。

Maybe one of these options will be helpful: 这些选项之一可能会有所帮助:

In the plugin tutorial by Werner Bailer , see pages 16-18 for examples of accessing individual pixel values in a Java plugin. Werner Bailer插件教程中 ,有关在Java插件中访问单个像素值的示例,请参见第16-18页。

Albert Cardona's tutorial shows how to do it in Jython. Albert Cardona的教程显示了如何在Jython中进行操作。

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

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