ImageJ does not work from the command line if image name contains parenthesis

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

ImageJ does not work from the command line if image name contains parenthesis

Stein Rørvik
I am experiencing this problem in all versions of ImageJ/Fiji that I have tested:

I am unable to launch ImageJ from the command line on Windows if the image of interest contains parenthesis characters.
The error message I get is "Macro or script not found" and a messed up path, which indicates that the input strings are not parsed correctly in this case. See for yourself by testing something similar. It seems to be related to the "Single Instance Listener" function, because it works fine if ImageJ is not already running.

Here is an example:

This works ok:
"C:\Program Files\ImageJ\ImageJ.exe" -macro "C:\MyPath\Test Macro.ijm" "C:\MyPath\MyImage.tif"

This does not work:
"C:\Program Files\ImageJ\ImageJ.exe" -macro "C:\MyPath\Test Macro.ijm" "C:\MyPath\MyImage (2).tif"

It fails if "Single Instance Listener" is on and ImageJ is running.
It works if "Single Instance Listener" is on and ImageJ is not running.
It works if "Single Instance Listener" is off and ImageJ is running. ImageJ is then (as expected) launched twice.

Is this a bug?  If not, does anyone have a suggestion for a workaround?
I cannot rename my input images because they are on a file system which is read-only.
I prefer to have Single Instance Listener on because a lot of my workflow is based on scripts running from the command line.

This is a generic launch problem, the contents of the macro file does not matter.

Stein

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ does not work from the command line if image name contains parenthesis

Gabriel Landini
On Monday 21 Dec 2015 13:56:59 Stein Rørvik wrote:
> > This does not work:
> "C:\Program Files\ImageJ\ImageJ.exe" -macro "C:\MyPath\Test Macro.ijm"
> "C:\MyPath\MyImage (2).tif"

Is that a parenthesis issue or is it the spaces in the name?
There are often problems and unexpected behaviour when using files that have
spaces.

I do not know if it is a bug, but in the mean time, maybe you can create a Win
batch script that first copies the file from the read-only system into a
writeable location and then runs ImageJ on that location.

Cheers

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ does not work from the command line if image name contains parenthesis

Stein Rørvik
It is a parenthesis problem. It works fine with spaces.
I haven't tested all other possible special characters but in general ImageJ is quite flexible in what it accepts in filenames.

I just tested with space in filename
"C:\Program Files\ImageJ\ImageJ.exe" -macro " C:\MyPath \Test Macro.ijm" "C:\MyPath\MyImage 2.tif"
and it works fine.

Stein

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Gabriel Landini
Sent: 21. desember 2015 15:08
To: [hidden email]
Subject: Re: ImageJ does not work from the command line if image name contains parenthesis

On Monday 21 Dec 2015 13:56:59 Stein Rørvik wrote:
> > This does not work:
> "C:\Program Files\ImageJ\ImageJ.exe" -macro "C:\MyPath\Test Macro.ijm"
> "C:\MyPath\MyImage (2).tif"

Is that a parenthesis issue or is it the spaces in the name?
There are often problems and unexpected behaviour when using files that have spaces.

I do not know if it is a bug, but in the mean time, maybe you can create a Win batch script that first copies the file from the read-only system into a writeable location and then runs ImageJ on that location.

Cheers

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ does not work from the command line if image name contains parenthesis

Stein Rørvik
I also tried to remove the space but keep the parenthesis, it still does not work. So it is a parenthesis issue:
"C:\Program Files\ImageJ\ImageJ.exe" -macro " C:\MyPath\Test Macro.ijm" " C:\MyPath\MyImage(2).tif"

The files I need to access are very large stacks of µCT files; hundreds of thousands of slices, several hundred gigabytes large so copying them to my feeble laptop with an SSD to rename them there is not an option. I can physically go to the computer they are stored and rename them there in a batch process, but the string inside the parenthesis contains important sample info, and the alternative characters {} and [] are not allowed by the CT software so I try to avoid that option.

Stein

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Stein Rørvik
Sent: 21. desember 2015 15:17
To: [hidden email]
Subject: Re: ImageJ does not work from the command line if image name contains parenthesis

It is a parenthesis problem. It works fine with spaces.
I haven't tested all other possible special characters but in general ImageJ is quite flexible in what it accepts in filenames.

I just tested with space in filename
"C:\Program Files\ImageJ\ImageJ.exe" -macro " C:\MyPath \Test Macro.ijm" "C:\MyPath\MyImage 2.tif"
and it works fine.

Stein

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Gabriel Landini
Sent: 21. desember 2015 15:08
To: [hidden email]
Subject: Re: ImageJ does not work from the command line if image name contains parenthesis

On Monday 21 Dec 2015 13:56:59 Stein Rørvik wrote:
> > This does not work:
> "C:\Program Files\ImageJ\ImageJ.exe" -macro "C:\MyPath\Test Macro.ijm"
> "C:\MyPath\MyImage (2).tif"

Is that a parenthesis issue or is it the spaces in the name?
There are often problems and unexpected behaviour when using files that have spaces.

I do not know if it is a bug, but in the mean time, maybe you can create a Win batch script that first copies the file from the read-only system into a writeable location and then runs ImageJ on that location.

Cheers

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ does not work from the command line if image name contains parenthesis

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Stein Rørvik

> On 2015-12-21 13:56:59 GMT, Stein Rørvik wrote:
>
> I am unable to launch ImageJ from the command line on Windows if the image of interest contains parenthesis characters.
> The error message I get is "Macro or script not found" and a messed up path, which indicates that the input
> strings are not parsed correctly in this case. See for yourself by testing something similar. It seems to
> be related to the "Single Instance Listener" function, because it works fine if ImageJ is not already running.

This bug is fixed in the latest ImageJ daily build (1.50f30). It caused macros and scripts run from the command line to fail if the argument contained a “(“ character.

-wayne

> Here is an example:
>
> This works ok:
> "C:\Program Files\ImageJ\ImageJ.exe" -macro "C:\MyPath\Test Macro.ijm" "C:\MyPath\MyImage.tif"
>
> This does not work:
> "C:\Program Files\ImageJ\ImageJ.exe" -macro "C:\MyPath\Test Macro.ijm" "C:\MyPath\MyImage (2).tif"
>
> It fails if "Single Instance Listener" is on and ImageJ is running.
> It works if "Single Instance Listener" is on and ImageJ is not running.
> It works if "Single Instance Listener" is off and ImageJ is running. ImageJ is then (as expected) launched twice.
>
> Is this a bug?  If not, does anyone have a suggestion for a workaround?
> I cannot rename my input images because they are on a file system which is read-only.
> I prefer to have Single Instance Listener on because a lot of my workflow is based on scripts running from the
> command line.
>
> This is a generic launch problem, the contents of the macro file does not matter.
>
> Stein
>
>


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html