\\ vs \ for macro converting h5 to vtk

Posted by vinaympai on
URL: http://imagej.273.s1.nabble.com/vs-for-macro-converting-h5-to-vtk-tp3684246.html

Hi,

Am a newbie to IJ macros, so do apologize (but did not find this on IJ forum or through google).  Anyway, am using IJ to convert HDF5 files to VTK (for downstream processing via ParaView).  When I use recorder to do it for 1 file (say "test.h5"), I get the following output:
run("Load HDF5 File", "open=C:\\Data\\test.h5 2d"); //since the 2d part of the data is being loaded by HDF.
run("VTK Writer...","save=[C:\\Data\\test.h5 data.vtk] save=[C:\\Data\\test.h5 data.vtk] save=[C:\\Data\\test.h5. data.vtk] save=[C:\\Data\\test.h5 data.vtk]");

However, when I construct a macro so that it can do bunch of files using:
head=getDirectory("Choose directory");
setBatchMode(true);
children=getFileList(head);
<start for loop>
 curChild=head+children[loopcounter];
 nuCur = curChild + " 2d";
 run("Load HDF5 File", "open=nuChild");
<end for loop>

the process does not work; there is no error, but nothing happens.  When I run debug, the curChild value is: C:\Data\test.h5
instead of C:\\Data\\test.h5  
Just to check, I went back to the command that ran under recorder and when I run it with single slash rather than double slash it does not work.  I tried using replace to switch the \ to \\ but I get the error "Number or numeric function expected".  I had typed it in as

replace(curChild,"\","\\");

Any suggestions/guidance would be really helpful...