Run External Java File in Macro

Hi!
I want to complete my jobs in macro. Recently I found a very useful code but written in java which is ND_.java (here is the link)

What I want to do is simply;

  1. run the java code
  2. save the results file

I wanted to implement below code but I have an error screen.

open("/Applications/Fiji.app/macros/ND_.java");
run("script:/Applications/Fiji.app/macros/ND_.java");
name = getTitle;
            dotIndex = indexOf(name, ".tif");
            title = substring(name, 0, dotIndex); 
//edit the file path before you 
getPixelSize(unit, pw, ph, pd);
saveAs("Results", "/Users/macbook/Desktop/"+title+"-dist"+"_"+unit+".csv");

Can anybody help me on this?

Thanks a lot in advance!

Podi

Although I don’t know the specific Java-code, it must first be compiled to become the “ND_.class”-file. It then represents an ImageJ-plugin. Such plugins, if installed properly, can be called from ImageJ-macros.

As far as I can see, the code doesn’t use a “GenericDialog()”-method which means that you won’t receive help with specifying parameters by use of the Macro-recorder.

1 Like

@notQRV thanks for your reply.
I couldn’t compile with Fiji it gives an error. But I succeed to compile in ImageJ so I simply used compiled version in Fiji back again as a plugin. Now I can run that plugin by;

run("ND ");