ImageJ二次开发学习纪录之初步体会
2015-09-01 20:51
453 查看
ImageJ的相关信息可以直接从其官网了解,从这个网站上可以下载到其运行程序,并可以得到相关的源码,在源码的基本上我们可以进行插件开发。
1)了解插件的类型及其接口:
a) PlugIn:启动该插件时不需要打开一幅图象
b) PlugInFilter:启动该插件时,需要传递给该插件一幅打开图象的指针。该插件的操作将施加在该图象上。
c) PlugInFrame:该插件可以扩展一个独立的操作交互界面。
2)相关程序的运行方式,只要将相关的插件的.java和.class放在源码目录source/plugins下就可以了,可以使用再往下一级的目录进行存放,然后重新编译运行整个ImageJ源码就可以了,它会自己识别source/plugins下的插件,并将插件显示在运行后的程序的Plugins栏目下;
3)为了便于在同一个目录下进行编译和运行,使用了如下的build.xml(引用了整体程序的build.xml),plugins下使用一级目录
source/build.xml
source/plugins/Plugin/build.xml
1)了解插件的类型及其接口:
a) PlugIn:启动该插件时不需要打开一幅图象
b) PlugInFilter:启动该插件时,需要传递给该插件一幅打开图象的指针。该插件的操作将施加在该图象上。
c) PlugInFrame:该插件可以扩展一个独立的操作交互界面。
2)相关程序的运行方式,只要将相关的插件的.java和.class放在源码目录source/plugins下就可以了,可以使用再往下一级的目录进行存放,然后重新编译运行整个ImageJ源码就可以了,它会自己识别source/plugins下的插件,并将插件显示在运行后的程序的Plugins栏目下;
3)为了便于在同一个目录下进行编译和运行,使用了如下的build.xml(引用了整体程序的build.xml),plugins下使用一级目录
source/build.xml
<!-- Ant makefile for ImageJ --> <project name="ImageJ" default="run"> <target name="compile" description="Compile everything."> <!-- First, ensure the build directory exists. --> <mkdir dir="build" /> <!-- Build everything; add debug="on" to debug --> <javac srcdir="." destdir="build" optimize="on" source="1.5" target="1.5" debug="on" includeantruntime="false"> <!-- The plugins directory only needs to be present at runtime, not at build time. --> <exclude name="plugins/**"/> </javac> </target> <target name="build" depends="compile" description="Build ij.jar."> <!-- Copy needed files into the build directory. --> <copy file="IJ_Props.txt" todir="build" /> <copy file="images/microscope.gif" tofile="build/microscope.gif" /> <copy file="images/about.jpg" tofile="build/about.jpg" /> <copy file="plugins/MacAdapter.class" tofile="build/MacAdapter.class" /> <copy file="plugins/MacClipboard.class" tofile="build/MacClipboard.class" /> <copy todir="build/macros"><fileset dir="macros"/></copy> <!-- Build ij.jar. --> <jar jarfile="ij.jar" basedir="build" manifest="MANIFEST.MF" /> </target> <target name="clean" description="Delete the build files."> <delete dir="build" /> <delete file="ij.jar" /> <delete file="./../ij.jar" /> <delete dir="./../api" /> </target> <target name="run" depends="build" description="Build and run ImageJ."> <copy file="ij.jar" toDir=".." /> <java maxmemory="640m" jar="ij.jar" fork="yes" /> </target> <target name="run2" depends="build" description="Build and run ImageJ."> <!-- Run in ImageJ directory --> <copy file="ij.jar" toDir=".." /> <java maxmemory="640m" dir=".." jar="ij.jar" fork="yes" /> </target> <target name="zip" depends="clean" description="Build zrc.zip."> <zip zipfile="../src.zip" basedir=".." includes="source/**" /> </target> <target name="javadocs" description="Build the JavaDocs."> <delete dir="../api" /> <mkdir dir="../api" /> <javadoc sourcepath="." packagenames="ij.*" destdir="../api" author="true" version="true" use="true" windowtitle="ImageJ API"> </javadoc> </target> </project>
source/plugins/Plugin/build.xml
<?xml version="1.0"?> <project default="compile" name="Plugin Project" basedir="."> <description>My plugin</description> <property name="srcDir" location="."/> <property name="runDir" location="./../.." /> <path id="ij"> <pathelement path=".:./../../ij.jar"/> </path> <target name="init"> </target> <target name="compile" depends="init"> <javac srcdir="${srcDir}" destdir="${srcDir}"> <classpath> <path refid="ij" /> </classpath> </javac> </target> <target name="run" description="run the ImageJ with the external build.xml"> <antcall target="compile"/> <ant antfile="build.xml" dir="${runDir}" inheritall="true" target="run"> </ant> </target> <target name="clean"> <delete> <fileset dir="." includes="*.class"/> </delete> </target> <target name="cleanAll"> <antcall target="clean" /> <ant antfile="build.xml" dir="${runDir}" inheritall="true" target="clean"> </ant> </target> </project>
相关文章推荐
- 反转一个链表并输出各个结点的值
- oracle查看表占用磁盘空间
- 省市联动
- ajax异步请求
- Spring AOP 静态代理与动态代理
- POJ 1741 Tree(树分治)
- JavaWeb笔记——ajax异步请求
- #pragma 预处理指令详解
- UIToolbar工具栏类
- 二进制读取jpg和写jpg图
- javascript经典面试题 全局变量和局部变量 变量作用域
- TQ2440 学习笔记—— 11、嵌入式编程基础知识【arm-linux-objcopy、objdump选项】
- LeetCode Candy Greedy
- 输入一个有序数组和一个数字,在数组中查找两个数,使得它们的和正好是输入的那个数字
- 编程珠玑 第十五章 散列表应用 hash字符串
- ASD控制的小球_EasyX教程作业
- POJ3270 数学题置换
- Welcome to JAVA!(第一课课后练习)
- Armijo线搜索
- 我有DIY一Android遥控-所有开源