IJ.getDirectory("plugins") should do it
> ImageProcessor IP2 = MyImage.getProcessor();
FloatProcessor fp = (FloatProcessor)IP2.convertToFloat(); BlockStatistics BS = new BlockStatistics(fp); BS.std(3,3);
Thank you guys…!
It’s Ok . If I find something I will definitely post that on the forum.
In this case, I would recommend to not use “Starting from within your IDE” as the standard way of using your software .
- make it an ImageJ plugin, i.e. build it using Maven, and deploy it using an update site, or
- if you want it to run standalone and use ImageJ as a library, use any deployment strategy you like, but make sure that the runtime classpath is correct (again, ideally using Maven).
Thank you very much for the idea…
This also working 100% correctly. I don’t know how to thank you specially @emartini and @bogovicj. You guys almost saved my life. Because this was a major problem I had to overcome when I using plugins who wrote by 3rd parties (not imagej core plugins).
I appreciate if you can comment more on this when you have time.
Basically this thing work perfectly when I use the plugin directory as this?
I have copied plugin folder to the place where my java programme runs and tried, this
String pluginsDir ="\\test2\\src\\main\\java\\test2\\plugins";
It is not working. If there is a method to overcome this above problem will be solved.
Which plugins folder? The one from Fiji?
If so why not point to the Fiji folder directly?
How do you intend to distribute the code? I hope you’ll consider @imagejan’s suggestions above.
@emartini is it possible to set up path for two classes that I have done below.
Because this time I am going to use some morphological operators from MorphoLibJ in a different class. but as same as above without indicating any error function don’t apply on the image.
IJ.run(Image, "Gray Scale Attribute Filtering", "operation=Opening attribute=Area minimum=200 connectivity=8");
I think the error may be in setting the directory??
The same thing can be done as follows also. But there we cant indicate the connectivity.
ImageProcessor imgPro1 = Image.getProcessor(); ImageProcessor img2 = AttributeFiltering.areaOpening(imgPro1,200);
Find Connected component Plugin
In your example, you do not actually use the
clazz1 classes anywhere. Why are you even referencing them? In your code, the plugins directory is being set (twice!) to the same directory. And that directory is a
src/main/java folder, which typically contains .java files, not .class files.
ImageJ 1.x normally supports only one
plugins.dir location, which must contain all ImageJ1-style plugins. However, ImageJ2 adds a feature via ImageJ-Legacy that enables multiple ImageJ1 plugins directories: the
ij1.plugin.dirs system property, which may contain a list of such directories (use your OS-dependent separator: this is
; on Windows,
: on *nix).
However, I would strongly advise you—rather than struggling with the complexity described above—to simply write SciJava-style plugins instead of ImageJ1-style ones. See here for an example. And your SciJava-style plugins may still use
ij.ImagePlus and friends instead of, or in addition to, the ImageJ2 and ImgLib2 classes.
Thank you very much. It seems good. I have not tried it. But I will, Yeah some times I struggle like hell.:). I really appreciate your kind words…