Hi,
I have a macro that opens a raw data file. It gets the path: path = File.openDialog("Select an image (16 bit raw)"); then uses the raw import to read the file: run("Raw...", "open=" + path + " image=[16-bit Unsigned] width=" + width + " height=" + height +" offset=0 number=1 gap=0 little-endian"); My problem is that spaces in the filename cause the raw import to fail. I have tried replacing them with "%20" and "\ ", neither works. Can anyone suggest a solution? Jon |
Hello Jon,
I think you just need to put bracket around you file name. run("Raw...", "open=[" + path + "] image=[16-bit Unsigned] width=" + width + " height=" + height +" offset=0 number=1 gap=0 little-endian"); Gabriel Lapointe Jon Harman wrote: > Hi, > > I have a macro that opens a raw data file. It gets the path: > path = File.openDialog("Select an image (16 bit raw)"); > > then uses the raw import to read the file: > run("Raw...", "open=" + path + " image=[16-bit Unsigned] width=" + > width + " height=" + height +" offset=0 number=1 gap=0 little-endian"); > > My problem is that spaces in the filename cause the raw import to fail. > I have tried replacing them with "%20" and "\ ", neither works. > > Can anyone suggest a solution? > > Jon > |
In reply to this post by Jon Harman-3
Hi Jon,
use square brackets around the filename: run("Raw...", "open=[" + path + "] image=[16-bit Unsigned] width=" + width + " height=" + height +" offset=0 number=1 gap=0 little-endian"); Michael ________________________________________________________________ On 9 Jun 2009, at 17:09, Jon Harman wrote: > Hi, > > I have a macro that opens a raw data file. It gets the path: > path = File.openDialog("Select an image (16 bit raw)"); > > then uses the raw import to read the file: > run("Raw...", "open=" + path + " image=[16-bit Unsigned] width=" + > width + " height=" + height +" offset=0 number=1 gap=0 little- > endian"); > > My problem is that spaces in the filename cause the raw import to > fail. > I have tried replacing them with "%20" and "\ ", neither works. > > Can anyone suggest a solution? > > Jon |
Dear ImageJ users
I seem to have encountered a similar problem as reported before, but I didn't find any solutions, so therefore I'll try to relaunch the question: I can no longer open a results file automatically when given a directory obtained by getDirectory(""); E.g. suppose a 'testresults.txt' file is to be opened. dir=getDirectory(""); path=dir+"testresults.txt"; run("Results...", "openasstring...=["+path+"]"); This piece of code results in a dialog that still demands the user to select the results file. Is this a bug or I'm a overlooking something trivial? I'm running imageJ 1.42q on a pc (vista). Thanks in advance. Regards, winnok Approved-By: [log in to unmask] Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-ID: <[log in to unmask]> Date: Tue, 24 Mar 2009 16:08:08 +0800 Reply-To: ImageJ Interest Group <[log in to unmask]> Sender: ImageJ Interest Group <[log in to unmask]> From: Adam Cliffe <[log in to unmask]> Subject: Opening Results Problem/Bug? Hi, Part of the macro I'm writing involves opening a results table which ImageJ saved previously. The section I'm having problems with is this: macro "bug example" { G_Ddir=getDirectory("choose folder"); G_jobName="test"; string="openasstring...=" + G_Ddir + G_jobName + "_basic.xls"; run("Results...", string); } It should open the results of an the Image called G_jobName, so in this case, a file called test_basic.xls This bit of code runs fine on my Mac (using IJ 1.42l and Java 1.5.0_16) but when I run the same piece of code on ImageJ on a PC it doesn't work... (64bit PC, ImageJ1.42I or 1.42k) not only that but it actually causes ImageJ to crash and close... Just before it crashes it opens a window called "documents" which looks a bit like the results table It returns this value as the variable string= openasstring...=C: \Documents and Settings\mikiko\Desktop\test_out\test\test_basic.xls Does anyone have any suggestions? Thanks Adam Dr Adam Cliffe Research Fellow Rørth Lab Cell Migration Group Temasek Lifescience Laboratory 1 Research Link National University of Singapore Singapore 117604 tel: (65) 6872 8406 fax: (65) 6872 7007 |
Dear List
Just after I sent this mail I found out that the ... should have been omitted after 'openasstring'. (run("Results...", "openasstring=["+path+"]");) This code was probably a remnant from an older version. Thanks anyway. Regards, WInnok -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Winnok De Vos (ugent) Sent: dinsdag 9 juni 2009 18:17 To: [hidden email] Subject: Opening results file in a macro Dear ImageJ users I seem to have encountered a similar problem as reported before, but I didn't find any solutions, so therefore I'll try to relaunch the question: I can no longer open a results file automatically when given a directory obtained by getDirectory(""); E.g. suppose a 'testresults.txt' file is to be opened. dir=getDirectory(""); path=dir+"testresults.txt"; run("Results...", "openasstring...=["+path+"]"); This piece of code results in a dialog that still demands the user to select the results file. Is this a bug or I'm a overlooking something trivial? I'm running imageJ 1.42q on a pc (vista). Thanks in advance. Regards, winnok Approved-By: [log in to unmask] Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-ID: <[log in to unmask]> Date: Tue, 24 Mar 2009 16:08:08 +0800 Reply-To: ImageJ Interest Group <[log in to unmask]> Sender: ImageJ Interest Group <[log in to unmask]> From: Adam Cliffe <[log in to unmask]> Subject: Opening Results Problem/Bug? Hi, Part of the macro I'm writing involves opening a results table which ImageJ saved previously. The section I'm having problems with is this: macro "bug example" { G_Ddir=getDirectory("choose folder"); G_jobName="test"; string="openasstring...=" + G_Ddir + G_jobName + "_basic.xls"; run("Results...", string); } It should open the results of an the Image called G_jobName, so in this case, a file called test_basic.xls This bit of code runs fine on my Mac (using IJ 1.42l and Java 1.5.0_16) but when I run the same piece of code on ImageJ on a PC it doesn't work... (64bit PC, ImageJ1.42I or 1.42k) not only that but it actually causes ImageJ to crash and close... Just before it crashes it opens a window called "documents" which looks a bit like the results table It returns this value as the variable string= openasstring...=C: \Documents and Settings\mikiko\Desktop\test_out\test\test_basic.xls Does anyone have any suggestions? Thanks Adam Dr Adam Cliffe Research Fellow Rørth Lab Cell Migration Group Temasek Lifescience Laboratory 1 Research Link National University of Singapore Singapore 117604 tel: (65) 6872 8406 fax: (65) 6872 7007 No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.339 / Virus Database: 270.12.58/2164 - Release Date: 06/08/09 17:59:00 |
Free forum by Nabble | Edit this page |