Hello World for ImageJ Java Plugin
6528 단어 ImageJ,ImageProcessingJava
With that, the way to write and execute the simplest ImageJ Plugin in Java was kind of lost, at least to me. It certainly doesn't exist in the Scripting page . Maybe this is the page, but it's rather difficult to reach and doesn't seem to give you the simplest code example.
I've written an article about "Hello world" for ImageJ with Eclipse" , but this is way too complicated for a beginner and me.
So, here I show you how to write the simplest "Hello World"ImageJ Plugin.
1. Save the Java source code (.java)
1. File > New > Script... will open a new script document in the Script Editor.
2. In the Script Editor, select Templates > [by Language] > Java > Imagej 1.x > Skeltons > Bare Plugin.
3. You'll see this code.
4. Copy and paste the following code to the file.import ij.plugin.PlugIn;
import ij.IJ;
/**
* This is a template for a plugin that does not require one image
* (be it that it does not require any, or that it lets the user
* choose more than one image in a dialog).
*/
public class Bare_PlugIn implements PlugIn {
/**
* This method gets called by ImageJ / Fiji.
*
* @param arg can be specified in plugins.config
* @see ij.plugin.PlugIn#run(java.lang.String)
*/
@Override
public void run(String arg) {
IJ.showMessage("Hello World");
}
}
import ij.plugin.PlugIn;
import ij.IJ;
/**
* This is a template for a plugin that does not require one image
* (be it that it does not require any, or that it lets the user
* choose more than one image in a dialog).
*/
public class Bare_PlugIn implements PlugIn {
/**
* This method gets called by ImageJ / Fiji.
*
* @param arg can be specified in plugins.config
* @see ij.plugin.PlugIn#run(java.lang.String)
*/
@Override
public void run(String arg) {
IJ.showMessage("Hello World");
}
}
import ij.IJ;
run
method of the Bare_PlugIn
class, we added a line as below. This is the command you want to execute. IJ.showMessage("Hello World");
5. After the edit, it should look like this. 6. Save the
Bare_Plugin.java
to anywhere in your computer by File > Save.2. Save .jar in the plugins folder
7. Then, export the code as a Bare_Plugin.jar
file (Java Archive) in the plugins
folder ( Fiji.app\plugins
) by File > Export as .jar.
8. There will be a Java error, but just ignore it.
9. Now you can find the Bare_plugin.jar
file in the plugins folder.
3. Run the plugin
10. Re-lauch ImageJ/Fiji.
11. Go Plugins > Bare Plugin to run the plugin.
12. There you go! You can see the Hello World message showing up.
Reference
이 문제에 관하여(Hello World for ImageJ Java Plugin), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/kouichi-c-nakamura/items/5f9b2114bb3521f50ae4
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
10. Re-lauch ImageJ/Fiji.
11. Go Plugins > Bare Plugin to run the plugin.
12. There you go! You can see the Hello World message showing up.
Reference
이 문제에 관하여(Hello World for ImageJ Java Plugin), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/kouichi-c-nakamura/items/5f9b2114bb3521f50ae4텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)