Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
517bdefe
Commit
517bdefe
authored
Oct 02, 2012
by
Johannes Schindelin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a main() method for convenient debugging
Signed-off-by:
Johannes Schindelin
<
johannes.schindelin@gmx.de
>
parent
9593a66b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
README.md
README.md
+5
-0
Process_Pixels.java
src/main/java/Process_Pixels.java
+27
-0
No files found.
README.md
View file @
517bdefe
...
@@ -22,5 +22,10 @@ directory, run _Help>Refresh Menus_ and the plugin will be available in
...
@@ -22,5 +22,10 @@ directory, run _Help>Refresh Menus_ and the plugin will be available in
_Process>Process Pixels_
(this can be changed by editing
_Process>Process Pixels_
(this can be changed by editing
_src/main/resources/plugins.config_
).
_src/main/resources/plugins.config_
).
Developing plugins in an IDE is convenient, especially for debugging. To
that end, the plugin contains a _main()_ method which sets the _plugins.dir_
system property (so that the plugin is added to the Plugins menu), starts
ImageJ, loads an image and runs the plugin.
Since this project is intended as a starting point for your own
Since this project is intended as a starting point for your own
developments, it is in the public domain.
developments, it is in the public domain.
src/main/java/Process_Pixels.java
View file @
517bdefe
import
ij.IJ
;
import
ij.IJ
;
import
ij.ImageJ
;
import
ij.ImagePlus
;
import
ij.ImagePlus
;
import
ij.gui.GenericDialog
;
import
ij.gui.GenericDialog
;
import
ij.plugin.filter.PlugInFilter
;
import
ij.plugin.filter.PlugInFilter
;
...
@@ -154,4 +155,30 @@ public class Process_Pixels implements PlugInFilter {
...
@@ -154,4 +155,30 @@ public class Process_Pixels implements PlugInFilter {
"a template for processing each pixel of an image"
"a template for processing each pixel of an image"
);
);
}
}
/**
* Main method for debugging.
*
* For debugging, it is convenient to have a method that starts ImageJ, loads an
* image and calls the plugin, e.g. after setting breakpoints.
*
* @param args unused
*/
public
static
void
main
(
String
[]
args
)
{
// set the plugins.dir property to make the plugin appear in the Plugins menu
Class
<?>
clazz
=
Process_Pixels
.
class
;
String
url
=
clazz
.
getResource
(
"/"
+
clazz
.
getName
().
replace
(
'.'
,
'/'
)
+
".class"
).
toString
();
String
pluginsDir
=
url
.
substring
(
5
,
url
.
length
()
-
clazz
.
getName
().
length
()
-
6
);
System
.
setProperty
(
"plugins.dir"
,
pluginsDir
);
// start ImageJ
new
ImageJ
();
// open the Clown sample
ImagePlus
image
=
IJ
.
openImage
(
"http://imagej.net/images/clown.jpg"
);
image
.
show
();
// run the plugin
IJ
.
runPlugIn
(
clazz
.
getName
(),
""
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment