OS dependent problem in bioFormats.

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

OS dependent problem in bioFormats.

Aryeh Weiss
We are having a problem reading a series of files using the following code:

This code expects files with the following names:
Image0001_001.oib
Image0002_001.oib
Image0003_001.oib
Image0003_001.oib

Each of these is the first of a series of files named (for example)
Image0001_002.oib, Image0001_003.oib, etc until N_IMAGES (in this case
555). So our pattern should be Image0001_<001-555>.oib

//==========================================
// here is the code snippet, what out for split lines
//==========================================

S0001 = "0001"; // first track in a sequence of foury
S0002 = "0002";
S0003 = "0003";
S0004 = "0004";

N_IMAGES=555;  // number of images in each track

sep="/";
// same behavior if we use sep="\\";


run("Close All");
run("Bio-Formats Macro Extensions");
path1 = File.openDialog("Click on any image");
path1_dir = File.getParent(path1);


fileName1 = File.getName(path1);
imageName1 = replace(fileName1, "_001", "_<001-"+d2s(N_IMAGES,0)+">");
pattern1=path1_dir +sep+ replace(fileName1, "_001",
"_<001-"+d2s(N_IMAGES,0)+">");
print(pattern1);

run("Bio-Formats Importer", "open=["+path1+"] color_mode=Grayscale
group_files split_channels view=Hyperstack stack_order=XYCZT
axis_1_number_of_images="+d2s(N_IMAGES,0)+" axis_1_axis_first_image=1
axis_1_axis_increment=1 file=[] pattern=["+pattern1+"]");

//=============end of code snippet======================

This code works properly using the FIJI distribution under OSX, and
WinXP64. However, on a machine running Windows 7 (64 bit), the following
error is reported:

java.util.regex.PatternSyntaxException: Illegal/unsupported escape
sequence near index 3

F:\Oded_movies_confocal\Oded S_20111103_151619\Track0001\series
    ^
        at java.util.regex.Pattern.error(Pattern.java:1713)
        at java.util.regex.Pattern.escape(Pattern.java:2177)
        at java.util.regex.Pattern.atom(Pattern.java:1952)
        at java.util.regex.Pattern.sequence(Pattern.java:1885)
        at java.util.regex.Pattern.expr(Pattern.java:1752)
        at java.util.regex.Pattern.compile(Pattern.java:1460)
        at java.util.regex.Pattern.<init>(Pattern.java:1133)
        at java.util.regex.Pattern.compile(Pattern.java:823)
        at loci.formats.FilePattern.buildFiles(FilePattern.java:579)
        at loci.formats.FilePattern.<init>(FilePattern.java:161)
        at loci.formats.FilePattern.findSeriesPatterns(FilePattern.java:471)
        at loci.formats.FilePattern.findSeriesPatterns(FilePattern.java:447)
        at loci.formats.FileStitcher.findPatterns(FileStitcher.java:224)
        at loci.formats.FileStitcher.findPatterns(FileStitcher.java:228)
        at loci.formats.FileStitcher.initFile(FileStitcher.java:735)
        at loci.formats.FileStitcher.setId(FileStitcher.java:701)
        at loci.plugins.in.ImportProcess.initializeStack(ImportProcess.java:490)
        at loci.plugins.in.ImportProcess.execute(ImportProcess.java:142)
        at loci.plugins.in.Importer.showDialogs(Importer.java:125)
        at loci.plugins.in.Importer.run(Importer.java:77)
        at loci.plugins.LociImporter.run(LociImporter.java:77)
        at ij.IJ.runUserPlugIn(IJ.java:193)
        at ij.IJ.runPlugIn(IJ.java:154)
        at ij.Executer.runCommand(Executer.java:147)
        at ij.Executer.run(Executer.java:78)
        at ij.IJ.run(IJ.java:269)
        at ij.macro.Functions.doRun(Functions.java:561)
        at ij.macro.Functions.doFunction(Functions.java:79)
        at ij.macro.Interpreter.doStatement(Interpreter.java:203)
        at ij.macro.Interpreter.doStatements(Interpreter.java:191)
        at ij.macro.Interpreter.run(Interpreter.java:102)
        at ij.macro.Interpreter.run(Interpreter.java:72)
        at CLI.Refresh_Macros.runScript(Refresh_Macros.java:56)
        at common.RefreshScripts.runScript(RefreshScripts.java:307)
        at fiji.scripting.TextEditor$Tab$6.execute(TextEditor.java:1197)
        at fiji.scripting.TextEditor$Executer$1.run(TextEditor.java:1756)


So it looks like it is choking on the filename/pattern, and does not
like the \. The strange thing is that on the WinXP64 machine, we are
running off the very same disk that was attached to the Windows 7
machine, so they must be seeing the exact same directory and name.

As a work around, the person for whom I wrote this may move from Windows
to Linux -- an outcome for which he should thank this problem.
Even so, I am curious what is going on.

--aryeh
--
Aryeh Weiss
School of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051
Reply | Threaded
Open this post in threaded view
|

Re: OS dependent problem in bioFormats.

Melissa Linkert-2
Hi Aryeh,

> We are having a problem reading a series of files using the following code:
>
> This code expects files with the following names:
> Image0001_001.oib
> Image0002_001.oib
> Image0003_001.oib
> Image0003_001.oib
>
> Each of these is the first of a series of files named (for example)
> Image0001_002.oib, Image0001_003.oib, etc until N_IMAGES (in this
> case 555). So our pattern should be Image0001_<001-555>.oib
*snip*
> This code works properly using the FIJI distribution under OSX, and
> WinXP64. However, on a machine running Windows 7 (64 bit), the
> following error is reported:
>
> java.util.regex.PatternSyntaxException: Illegal/unsupported escape
> sequence near index 3
>
> F:\Oded_movies_confocal\Oded S_20111103_151619\Track0001\series
>    ^
*snip*
> So it looks like it is choking on the filename/pattern, and does not
> like the \. The strange thing is that on the WinXP64 machine, we are
> running off the very same disk that was attached to the Windows 7
> machine, so they must be seeing the exact same directory and name.

Could you please double check that your Fiji is up to date?  I just
tried your macro with a fully updated copy of Fiji on Windows 7 64-bit,
and could not duplicate the problem.  Note that when you select
"Help > About Plugins > LOCI Plugins" in an up-to-date instance of Fiji, you
should see that the revision is b34ac5d, the build date is 4 October 2011, and
the release is 4.3.3-DEV.

Regards,
-Melissa

On Fri, Nov 11, 2011 at 08:05:42AM +0200, Aryeh Weiss wrote:

> We are having a problem reading a series of files using the following code:
>
> This code expects files with the following names:
> Image0001_001.oib
> Image0002_001.oib
> Image0003_001.oib
> Image0003_001.oib
>
> Each of these is the first of a series of files named (for example)
> Image0001_002.oib, Image0001_003.oib, etc until N_IMAGES (in this
> case 555). So our pattern should be Image0001_<001-555>.oib
>
> //==========================================
> // here is the code snippet, what out for split lines
> //==========================================
>
> S0001 = "0001"; // first track in a sequence of foury
> S0002 = "0002";
> S0003 = "0003";
> S0004 = "0004";
>
> N_IMAGES=555;  // number of images in each track
>
> sep="/";
> // same behavior if we use sep="\\";
>
>
> run("Close All");
> run("Bio-Formats Macro Extensions");
> path1 = File.openDialog("Click on any image");
> path1_dir = File.getParent(path1);
>
>
> fileName1 = File.getName(path1);
> imageName1 = replace(fileName1, "_001", "_<001-"+d2s(N_IMAGES,0)+">");
> pattern1=path1_dir +sep+ replace(fileName1, "_001",
> "_<001-"+d2s(N_IMAGES,0)+">");
> print(pattern1);
>
> run("Bio-Formats Importer", "open=["+path1+"] color_mode=Grayscale
> group_files split_channels view=Hyperstack stack_order=XYCZT
> axis_1_number_of_images="+d2s(N_IMAGES,0)+"
> axis_1_axis_first_image=1 axis_1_axis_increment=1 file=[]
> pattern=["+pattern1+"]");
>
> //=============end of code snippet======================
>
> This code works properly using the FIJI distribution under OSX, and
> WinXP64. However, on a machine running Windows 7 (64 bit), the
> following error is reported:
>
> java.util.regex.PatternSyntaxException: Illegal/unsupported escape
> sequence near index 3
>
> F:\Oded_movies_confocal\Oded S_20111103_151619\Track0001\series
>    ^
> at java.util.regex.Pattern.error(Pattern.java:1713)
> at java.util.regex.Pattern.escape(Pattern.java:2177)
> at java.util.regex.Pattern.atom(Pattern.java:1952)
> at java.util.regex.Pattern.sequence(Pattern.java:1885)
> at java.util.regex.Pattern.expr(Pattern.java:1752)
> at java.util.regex.Pattern.compile(Pattern.java:1460)
> at java.util.regex.Pattern.<init>(Pattern.java:1133)
> at java.util.regex.Pattern.compile(Pattern.java:823)
> at loci.formats.FilePattern.buildFiles(FilePattern.java:579)
> at loci.formats.FilePattern.<init>(FilePattern.java:161)
> at loci.formats.FilePattern.findSeriesPatterns(FilePattern.java:471)
> at loci.formats.FilePattern.findSeriesPatterns(FilePattern.java:447)
> at loci.formats.FileStitcher.findPatterns(FileStitcher.java:224)
> at loci.formats.FileStitcher.findPatterns(FileStitcher.java:228)
> at loci.formats.FileStitcher.initFile(FileStitcher.java:735)
> at loci.formats.FileStitcher.setId(FileStitcher.java:701)
> at loci.plugins.in.ImportProcess.initializeStack(ImportProcess.java:490)
> at loci.plugins.in.ImportProcess.execute(ImportProcess.java:142)
> at loci.plugins.in.Importer.showDialogs(Importer.java:125)
> at loci.plugins.in.Importer.run(Importer.java:77)
> at loci.plugins.LociImporter.run(LociImporter.java:77)
> at ij.IJ.runUserPlugIn(IJ.java:193)
> at ij.IJ.runPlugIn(IJ.java:154)
> at ij.Executer.runCommand(Executer.java:147)
> at ij.Executer.run(Executer.java:78)
> at ij.IJ.run(IJ.java:269)
> at ij.macro.Functions.doRun(Functions.java:561)
> at ij.macro.Functions.doFunction(Functions.java:79)
> at ij.macro.Interpreter.doStatement(Interpreter.java:203)
> at ij.macro.Interpreter.doStatements(Interpreter.java:191)
> at ij.macro.Interpreter.run(Interpreter.java:102)
> at ij.macro.Interpreter.run(Interpreter.java:72)
> at CLI.Refresh_Macros.runScript(Refresh_Macros.java:56)
> at common.RefreshScripts.runScript(RefreshScripts.java:307)
> at fiji.scripting.TextEditor$Tab$6.execute(TextEditor.java:1197)
> at fiji.scripting.TextEditor$Executer$1.run(TextEditor.java:1756)
>
>
> So it looks like it is choking on the filename/pattern, and does not
> like the \. The strange thing is that on the WinXP64 machine, we are
> running off the very same disk that was attached to the Windows 7
> machine, so they must be seeing the exact same directory and name.
>
> As a work around, the person for whom I wrote this may move from
> Windows to Linux -- an outcome for which he should thank this
> problem.
> Even so, I am curious what is going on.
>
> --aryeh
> --
> Aryeh Weiss
> School of Engineering
> Bar Ilan University
> Ramat Gan 52900 Israel
>
> Ph:  972-3-5317638
> FAX: 972-3-7384051