- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
所以我的问题是如何从 ij.ImagePlus 获取 16 位 bufferedImage...?如果我尝试使用 ShortProcessor,它将我的签名图像更改为未签名,因此我无法获得原始图像...提前致谢,任何人都可以提供解决方案。
ImageJ 如何在其查看器中显示 16 位签名图像..而我们只能获得 8 位 bufferedImage 或 16 位无符号 bufferedImage 那么我如何获得 16 位签名 BufferedImage..?
最佳答案
ImageJ 可以使用特殊的Calibration
函数表示带符号的 16 位类型。 isSigned16Bit()
方法指示何时使用特定校准函数 - 它是线性 m*x+b 校准,其中 m=1 且 b=-32768;这可以是seen in the ImageJ source code .
ImageJ 提供了一种通过 getImage()
方法从 ImagePlus
获取 BufferedImage
的方法。然而,这个always returns an 8-bit BufferedImage
.
因此,下一个方法是创建您自己的 DataBuffer.TYPE_SHORT
类型的 BufferedImage
,它包装了支持原始 ImagePlus
对象的相同 short[]
数组。不幸的是,由于 ImageJ 对带符号 16 位数据的内部表示,这些值将偏离常量偏移量 32768,例如,原始值 -444 将作为 32324 存储在 ImageJ 的 short[]
数组中。因此,您必须在包装为 BufferedImage
之前手动调整所有值。
这里是一些示例代码:
import io.scif.gui.AWTImageTools;
...
final ImagePlus imp =
IJ.openImage("http://imagej.net/images/ct.dcm.zip");
// get pixels array reference
final short[] pix = (short[]) imp.getProcessor().getPixels();
final int w = imp.getWidth();
final int h = imp.getHeight();
final boolean signed = imp.getCalibration().isSigned16Bit();
if (signed) {
// adjust raw pixel values
for (int i=0; i<pix.length; i++) {
pix[i] -= 32768;
}
}
// convert to BufferedImage
final BufferedImage image = AWTImageTools.makeImage(pix, w, h, signed);
对于 short[]
到 BufferedImage
的实际转换,此代码使用 SCIFIO图书馆的AWTImageTools.makeImage实用方法。 SCIFIO 包含在 Fiji distribution of ImageJ 中。或者,它只是几行代码,可以很容易地从相关例程中复制和粘贴。
关于java - Imagej 16 位有符号缓冲图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23266560/
我在 fiji/imagej 中制作了一个宏,我想通过终端在 shell 脚本中激活它。就目前而言,宏不需要任何输入,我只想让斐济在从终端激活时运行宏,并将其输出保存在输出文件夹中。宏的脚本如下所示:
我在使用 ImageJ 宏时遇到问题。函数 selectImage(id) 和 selectWindow(name) 导致 ImageJ 完全崩溃,甚至我必须完全重置 Unity(我使用的是 Ubun
在我的代码中使用外部库时,我非常新手。我一直在寻找如何将这个特定的库实际添加到我的构建路径中,这令人尴尬。 我的主要问题是我找不到 .jar 文件,或者我不知道如何从克隆的 git 存储库转到 jar
问题的逆向是: 如何从 ImageJ 宏调用/执行 java 程序? 每当我写 imagej 时,我指的是斐济。 当然,一个简单的解决方案是从 java 字符串创建一个 .ijm 并使用以 .ijm
我在 ImageJ 中编写了一个宏来在 BMP 图像文件列表上运行批量“测量”。我正在使用 headless.jar 以 headless 模式在远程 linux 机器上运行代码。 每当 ImageJ
在我正在编写的宏中,我尝试使用以下结构从插件导出结果: savePath = newfolder+"\\"+fileid; run("Export results", "filepath=savePa
问题:稳定一堆图像 问题:如何在没有关键点检测的情况下执行图像稳定?有什么办法吗? 我试过这个: http://www.cs.cmu.edu/~kangli/code/Image_Stabilizer
我正在开发一个用于压缩图像的插件。在“奇迹发生”之前,用户应该决定是否要使用具有三个或四个邻居的方法。为此,我创建了一个带有 RadioButtonGroup 的通用对话框。 这工作正常,我的问题是如
我在 Windows 上使用 Fiji/ImageJ 并遇到以下问题:当我关闭文件时,为该文件分配的内存未释放。 ImageJ 保留分配的内存,并在打开其他文件时重用它。 所以这并不是严格意义上的内存
我正在 Java 中使用 IJ 库。我打开了几张图像,我想保存最后一张 Activity 图像。但是,我只保存最后打开的图像而不是最后一个 Activity 图像。有什么解决办法吗? ImagePlu
我希望能够将图像校准到物理距离,以便我可以将图像裁剪到物理距离,而不是给出要裁剪的像素数。我已经在 ImageJ API 中看到了 Calibration 类,我可以设置校准来设置像素尺寸并通过设置
请问,怎样才能使图像透明? 实际上,我尝试从 IndexColorModel 读取 RGB 值 ImageProcessor ip1 = img1.getProcessor(); IndexColor
当我尝试使用 ImageJ 运行图片分析并尝试计算孔隙率时,出现了问题。 我记录了宏并在 java 中运行相同的过程。这两次执行的结果不同,我不知道为什么。你能帮忙吗? 我尝试使用 ImageJ AP
我正在使用 ImageJ 进行类(class)的图像处理,并且我已经创建小插件几个星期了。这让我很沮丧,因为我从未见过任何 java 错误消息,例如第 3 行的语法错误等等。当我的插件无法编译(由于某
我正在尝试构建一个简单的java应用程序,它可以对粒子进行计数,然后显示它们的数量。我正在使用 imagej (ij.jar) 库,一切都很完美,直到应该显示带有结果的小框。有人可以向我解释一下我该如
我的程序遇到了一个小问题,因为它似乎无法找到直方图中的最高值来计算直方图应该的比例,所以现在整个直方图超出了范围 我真的希望有人能帮助我,因为这让我发疯 import ij.*; import ij.
所以我想我问了一个新问题,这是我的旧问题的延伸。因此,我能够将 ImageJ 窗口中的内容放入桌面 Pane 内的 JInternal 框架中。但图像不会随着帧尺寸的放大而缩放。我发现了几种主要使用
我已经下载了ImageJ源代码并编译并运行了ImageJ源代码。我按照签名制作了 ij.jar。但是,当我尝试在网页中嵌入 ImageJ 小程序时,图像窗口将作为弹出窗口出现,而不是粘在浏览器上。 非
我正在 ImageJ 插件中使用“减去背景”操作,并且尝试使用 BackgroundSubtracter 类来执行此操作,但结果与使用宏语句时的结果不同。例如: IJ.run(img, "Subtra
给定两个 ImagePlus 或 BufferedImages(我不在乎)我如何匹配第一个与第二个的直方图? 我所说的匹配是指: 匹配一个的累积分布函数(CDF)图像到另一个的 CDF。 最佳答案 您
我是一名优秀的程序员,十分优秀!