imagej / imagej/imagej2

Command line invocation of macros with parameters containing a parenthesis will fail if Imagej is already open

Open
#164 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
350
PR merge metrics
No merged PRs in 30d

Description

The issue is related to the following earlier issue:

[https://list.nih.gov/cgi-bin/wa.exe?A2=ind1512&L=IMAGEJ&P=R29972&1=IMAGEJ&9=A&J=on&d=No+Match%3BMatch%3BMatches&z=4](https://list.nih.gov/cgi-bin/wa.exe?A2=ind1512&L=IMAGEJ&P=R29972&1=IMAGEJ&9=A&J=on&d=No+Match%3BMatch%3BMatches&z=4)

This was fixed, thus now something like:

`imagej-win64.exe -macro "mymacro.ijm" "tmp[A(.dcm"`

will not result in an error on the first invocation.

However, if one leaves the **instance of ImageJ running** and repeats this process, there will still be an "Macro or script not found" error, with the relevant part of the debug log showing:

```
[DEBUG] SocketServer.sendArgument: "user.dir C:\Programs\ImageJ"
[DEBUG] SocketServer.sendArgument: "macro ImportDicom.ijm(tmp[A()"
```

After this failure, a second instance of ImageJ is opened handling the macro execution correctly.

I assume this happens because the way macros are executed when there is already a running instance of ImageJ is different.

This issue is very annoying when dealing with e.g. DICOM files containing square brackets and parentheses since it effectively prevents the user from opening handling multiple datasets effectively as starting a new ImageJ instance is quite slow at the moment.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the command-line path that invokes SocketServer.sendArgument when an ImageJ instance is already running, comparing it with the first-invocation path. Reproduce the repeated invocation using a macro parameter containing parentheses, then verify that the macro runs without a "Macro or script not found" error and receives the parameter intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
cli, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.