Hi,
I'm trying to make a macro for batch processing images taken with Volocity. But I stumbled on the first step - I can't get the macro to open the files! Other imaging software save a bunch of files in a folder and I can direct the macro there, but Volocity creates a .mvd2 file and a separate folder containing the data. I can manually open the files in imageJ using the Bio-Formats Importer and asking it to open the .mvd2 file, but the problem is to get this into a macro. Usually I would start the macro something like this: dir=getDirectory("Choose Source Directory"); savedir=getDirectory("Choose a Storage Directory"); list = getFileList(dir); setBatchMode(true) for (i=0; i<list.length; i++) { inputPath = dir + list[i]; if (endsWith(inputPath, ".mvd2")) { run("Bio-Formats Importer", "open=[inputPath autoscale color_mode=Grayscale view=Hyperstack stack_order=XYCZT"); ...but I think I might need a completely different approach with the Volocity files since it's not a list of .mvd2 files. Any ideas would be appreciated! Thanks, Marina _________________________________________________________________________ Marina Franck, PhD Department of Neuroscience Uppsala University BMC, Box 593, Husargatan 3 751 23 Uppsala Sweden -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Marina,
> I think I might need a completely different approach with the Volocity > files since it's not a list of .mvd2 files. Actually, I think your strategy should work just fine, as long as the user chooses the directory containing the .mvd2 files when prompted. > run("Bio-Formats Importer", "open=[inputPath autoscale color_mode=Grayscale view=Hyperstack stack_order=XYCZT"); Note that the above line of macro code will not work as written; it should rather be something like: run("Bio-Formats Importer", "open=[" + inputPath + "] autoscale color_mode=Grayscale view=Hyperstack stack_order=XYCZT"); Regards, Curtis On Fri, Feb 13, 2015 at 8:38 AM, Marina Franck <[hidden email]> wrote: > Hi, > > I'm trying to make a macro for batch processing images taken with > Volocity. But I stumbled on the first step - I can't get the macro to open > the files! Other imaging software save a bunch of files in a folder and I > can direct the macro there, but Volocity creates a .mvd2 file and a > separate folder containing the data. I can manually open the files in > imageJ using the Bio-Formats Importer and asking it to open the .mvd2 file, > but the problem is to get this into a macro. > > Usually I would start the macro something like this: > > dir=getDirectory("Choose Source Directory"); > savedir=getDirectory("Choose a Storage Directory"); > list = getFileList(dir); > setBatchMode(true) > > for (i=0; i<list.length; i++) { > inputPath = dir + list[i]; > if (endsWith(inputPath, ".mvd2")) { > run("Bio-Formats Importer", "open=[inputPath > autoscale color_mode=Grayscale view=Hyperstack stack_order=XYCZT"); > > > ...but I think I might need a completely different approach with the > Volocity files since it's not a list of .mvd2 files. Any ideas would be > appreciated! > > Thanks, > Marina > _________________________________________________________________________ > Marina Franck, PhD > Department of Neuroscience > Uppsala University > BMC, Box 593, Husargatan 3 > 751 23 Uppsala > Sweden > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi,
Thanks Curtis for your input, unfortunately it didn't solve the problem. This in now a simple example macro that would just rename the files and save them as .tif, but it doesn't do its job - only the first image in a set gets processed. I think it just thinks there is only one file to process because there is only one .mvd2 file, and I can't make it process all the images that file points to! Any ideas how to get around this? dir=getDirectory("Choose a Source Directory containing the .mvd2 file"); savedir=getDirectory("Choose a Storage Directory"); list = getFileList(dir); setBatchMode(true) for (i=0; i<list.length; i++) { inputPath = dir + list[i]; if (endsWith(inputPath, ".mvd2")) { run("Bio-Formats Importer", "open=[" + inputPath + "] autoscale color_mode=Grayscale view=Hyperstack stack_order=XYCZT"); title=getTitle(); title = replace(title," ","_"); title = replace(title,".","_"); savename=savedir+title+".tif"; saveAs("tiff", savename); close(); } } setBatchMode(false) Regards, Marina -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Curtis Rueden Sent: den 13 februari 2015 17:40 To: [hidden email] Subject: Re: Batch opening Volocity files Hi Marina, > I think I might need a completely different approach with the Volocity > files since it's not a list of .mvd2 files. Actually, I think your strategy should work just fine, as long as the user chooses the directory containing the .mvd2 files when prompted. > run("Bio-Formats Importer", "open=[inputPath autoscale color_mode=Grayscale view=Hyperstack stack_order=XYCZT"); Note that the above line of macro code will not work as written; it should rather be something like: run("Bio-Formats Importer", "open=[" + inputPath + "] autoscale color_mode=Grayscale view=Hyperstack stack_order=XYCZT"); Regards, Curtis On Fri, Feb 13, 2015 at 8:38 AM, Marina Franck <[hidden email]> wrote: > Hi, > > I'm trying to make a macro for batch processing images taken with > Volocity. But I stumbled on the first step - I can't get the macro to > open the files! Other imaging software save a bunch of files in a > folder and I can direct the macro there, but Volocity creates a .mvd2 > file and a separate folder containing the data. I can manually open > the files in imageJ using the Bio-Formats Importer and asking it to > open the .mvd2 file, but the problem is to get this into a macro. > > Usually I would start the macro something like this: > > dir=getDirectory("Choose Source Directory"); > savedir=getDirectory("Choose a Storage Directory"); list = > getFileList(dir); > setBatchMode(true) > > for (i=0; i<list.length; i++) { > inputPath = dir + list[i]; > if (endsWith(inputPath, ".mvd2")) { > run("Bio-Formats Importer", > "open=[inputPath autoscale color_mode=Grayscale view=Hyperstack > stack_order=XYCZT"); > > > ...but I think I might need a completely different approach with the > Volocity files since it's not a list of .mvd2 files. Any ideas would > be appreciated! > > Thanks, > Marina > ______________________________________________________________________ > ___ > Marina Franck, PhD > Department of Neuroscience > Uppsala University > BMC, Box 593, Husargatan 3 > 751 23 Uppsala > Sweden > > > -- > 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 |
Hi Marina,
> it doesn't do its job - only the first image in a set gets processed. > I think it just thinks there is only one file to process because there > is only one .mvd2 file, and I can't make it process all the images > that file points to! Ah, I think I understand now. It is probably a multi-series dataset. When you select the .mvd2 with the Bio-Formats Importer command, does it bring up a second dialog box with thumbnails so that you can choose the "image series" you want to import? If so, the macro becomes more complicated: https://gist.github.com/ctrueden/bb0c51bc8e93f7197143 Regards, Curtis On Mon, Feb 16, 2015 at 5:37 AM, Marina Franck <[hidden email]> wrote: > Hi, > > Thanks Curtis for your input, unfortunately it didn't solve the problem. > This in now a simple example macro that would just rename the files and > save them as .tif, but it doesn't do its job - only the first image in a > set gets processed. I think it just thinks there is only one file to > process because there is only one .mvd2 file, and I can't make it process > all the images that file points to! > Any ideas how to get around this? > > dir=getDirectory("Choose a Source Directory containing the .mvd2 file"); > savedir=getDirectory("Choose a Storage Directory"); > list = getFileList(dir); > > setBatchMode(true) > > for (i=0; i<list.length; i++) { > inputPath = dir + list[i]; > > if (endsWith(inputPath, ".mvd2")) { > run("Bio-Formats Importer", "open=[" + inputPath + "] autoscale > color_mode=Grayscale view=Hyperstack stack_order=XYCZT"); > title=getTitle(); > title = replace(title," ","_"); > title = replace(title,".","_"); > savename=savedir+title+".tif"; > saveAs("tiff", savename); > close(); > } > } > setBatchMode(false) > > > Regards, > Marina > > -----Original Message----- > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of > Curtis Rueden > Sent: den 13 februari 2015 17:40 > To: [hidden email] > Subject: Re: Batch opening Volocity files > > Hi Marina, > > > I think I might need a completely different approach with the Volocity > > files since it's not a list of .mvd2 files. > > Actually, I think your strategy should work just fine, as long as the user > chooses the directory containing the .mvd2 files when prompted. > > > run("Bio-Formats Importer", "open=[inputPath autoscale > color_mode=Grayscale view=Hyperstack stack_order=XYCZT"); > > Note that the above line of macro code will not work as written; it should > rather be something like: > > run("Bio-Formats Importer", "open=[" + inputPath + "] autoscale > color_mode=Grayscale view=Hyperstack stack_order=XYCZT"); > > Regards, > Curtis > > > > On Fri, Feb 13, 2015 at 8:38 AM, Marina Franck <[hidden email]> > wrote: > > > Hi, > > > > I'm trying to make a macro for batch processing images taken with > > Volocity. But I stumbled on the first step - I can't get the macro to > > open the files! Other imaging software save a bunch of files in a > > folder and I can direct the macro there, but Volocity creates a .mvd2 > > file and a separate folder containing the data. I can manually open > > the files in imageJ using the Bio-Formats Importer and asking it to > > open the .mvd2 file, but the problem is to get this into a macro. > > > > Usually I would start the macro something like this: > > > > dir=getDirectory("Choose Source Directory"); > > savedir=getDirectory("Choose a Storage Directory"); list = > > getFileList(dir); > > setBatchMode(true) > > > > for (i=0; i<list.length; i++) { > > inputPath = dir + list[i]; > > if (endsWith(inputPath, ".mvd2")) { > > run("Bio-Formats Importer", > > "open=[inputPath autoscale color_mode=Grayscale view=Hyperstack > > stack_order=XYCZT"); > > > > > > ...but I think I might need a completely different approach with the > > Volocity files since it's not a list of .mvd2 files. Any ideas would > > be appreciated! > > > > Thanks, > > Marina > > ______________________________________________________________________ > > ___ > > Marina Franck, PhD > > Department of Neuroscience > > Uppsala University > > BMC, Box 593, Husargatan 3 > > 751 23 Uppsala > > Sweden > > > > > > -- > > 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 > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |