Macro for plug-in orientationJ

I am not able to automatically save the results from a batch process using a plugin orientationJ. I am using the command selectwindow but it gives an error “window not found”. Please help

Good day Sintu Rongpipi,

you don’t tell us in which mode you use OrientationJ and what kind of result you like to save. What you need is just the names of the result images or plots.



Hi Herbie,

I am trying to use orientationJ dominant direction which gives a result window called ‘Results Orientation’. But when i write the command selectWindow(“Results Orientation”), it says no window found of that name. And I cannot save them.

Sintu Rongpipi,

thanks for providing the details!

In fact, the data displayed in the window in question is at least difficult to access. I wasn’t able to do so yet. ImageJ tells me that it is a window of type “Editor”, but I’m not aware of an ImageJ macro function that is able to access such a window.

It is possible however, to select the data manually (with the mouse) and copy it to the clipboard.

Sorry, no real help yet. Please contact the authors of “OrientationJ”.



Hi @Sintu_Rongpipi and @anon96376101,

I have invited the author of the OrientationJ plugin, Daniel Sage, to join this thread. If you do resolve this in private correspondance with Daniel, please share the solution here on the forum in case someone else runs into the same issue. :slight_smile:

1 Like

Anyone has found a solution for this? I have the same problem :frowning:

Hi again,

I am now trying to use an alternative type of analysis from this plugin, with the “measure” class. It is different from “dominant direction” but also gives me good results AND an accessible log window:

The problem is now that I must do something wrong and I have not been able to access the data from the “orientation” column properly. I seem to get an array with the orientation values like this:

table = getInfo("log"); 
lines = split(table, "\n");
for (a=1; a<lines.length; a+=2) {
	columns = split(lines[a], "\t"); //split columns every second lines, from the 2nd line to the last one
	angle = newArray(columns[6]); //array of values in the "Orientation" column


But I don’t manage to access (for example print) specific values in that array. I get an “index out of range” message. I have spent a long time doing some search in the manual and the forum but didn’t find a solution…


The author of the OrientationJ plugin, Daniel Sage, has released a modified version, with the dominant direction now into a log window.

The new version can be found here:

The code is now publicly available on a git repository:

1 Like

you can change the name of any non-standard results table and then access data as usual.

Here is a demo code:

run("OrientationJ Dominant Direction");
IJ.renameResults("Dominant Direction of "+T,"Results");
for (i=0; i<nResults; i++){
  OrientationJResults[i] = getResult("Orientation [Degrees]",i);

You can add a few more lines to temporarily rename any other results table and at the end rename it back so you will not loose previous results