【问题标题】:Imagej interoperability: convert new ImgPlus to old ImagePlusImagej 互操作性:将新的 ImgPlus 转换为旧的 ImagePlus
【发布时间】:2019-08-20 14:44:05
【问题描述】:

我需要将新的net.imglib2.img.Img 转换为旧的ij.ImagePlus 类,因为我想使用一些旧的 ImageJ 1.x。

Supposedly,我可以用ImageJFunctions.wrap()

static <T extends NumericType<T>> ij.ImagePlus net.imglib2.img.display.imagej.ImageJFunctions.wrap(RandomAccessibleInterval, String)

因为net.imglib2.img.Img 继承自RandomAccessibleInterval

我遇到的问题是我无法导入ImageJFunctions

代码:

import net.imglib2.img.display.imagej.ImageJFunctions;

错误:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
ImageJFunctions cannot be resolved to a type

在我的pom.xml 中,我使用org.scijava&lt;version&gt;26.0.0&lt;/version&gt;

【问题讨论】:

    标签: imagej


    【解决方案1】:

    ImageJFunctions 位于the imglib2-ij repo,因此您需要将此依赖项添加到您的 pom:

    <dependency>
        <groupId>net.imglib2</groupId>
        <artifactId>imglib2-ij</artifactId>
    </dependency>
    

    编辑:

    如果您使用 pom-scijava 作为父级,则可以将版本留空。

    您的问题的部分内容有误,抱歉。您可能不需要以下信息,但无论如何我都会将其保留为完整性,希望没关系。

    如果您还没有,您可能还需要add the scijava maven repository

    <repositories>
        <repository>
            <id>scijava.public</id>
            <url>https://maven.scijava.org/content/groups/public</url>
        </repository>
    </repositories>
    

    您可以检查可用版本 here,尽管使用 pom-scijava 作为父 pom 通常很方便。

    【讨论】:

    • 我正在使用plugin example tutorial。我认为它已经包含所有依赖项。非常感谢您指出这一点!
    • example-imagej-command 只依赖于“纯 ImageJ2”,没有任何与 ImageJ1 相关的部分。 net.imglib2:imglib2-ij 组件(连同 net.imagej:imagej-legacy 和 net.imagej:ij)是 ImageJ1 相关部分之一。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-01
    • 2023-04-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多