Hi all,
I'm trying to make a bat file that converts tiffs to hyperstack tiffs. I basically just want to open the tiff file and run the command run("Stack to Hyperstack...", "order=xyczt(default) channels=1 slices=4 frames=1 display=Color"); I'd like to be able to control each of these parameters in this aswell so pass an argument to a macro is less desirable for me. So far I have this: java -jar "C:\Program Files (x86)\ImageJ\ij.jar" -open "C:\\Users\\Craggles\\Desktop\\asd.tiff" -run[order=xyzct channels=4 slices=1 frames=1 display=Color] "Stack to Hyperstack..." and this java -jar "C:\Program Files (x86)\ImageJ\ij.jar" -open "C:\\Users\\Craggles\\Desktop\\asd.tiff" -run "Stack to Hyperstack...,order=xyzct channels=4 slices=1 frames=1 display=Color" but I cannot get the command to accept the "Stack to Hyperstack..." command and then input its arguement either. Any help welcome! |
Hi Craig,
Do you really need to do this on the CLI, instead of from the UI? If it's just about processing many files at once, did you have a look at the Batch Processing [1] page? If you must use the CLI for some reason, I recommend using the "-macro macroFile.ijm" syntax [2] instead of passing the commands inline. > I'd like to be able to control each of these parameters in this aswell > so pass an argument to a macro is less desirable for me. Sorry, I do not understand what you mean by that. Do you want to interactively input the desired values? That cannot really be done from the command line. But you could smarten up your macro to detect the total number of planes of the just-opened TIFF, then try to divide it up sensibly somehow between Z, C and T... or extract those values from the metadata somehow... Incidently, have you had a look at the Bio-Formats plugin [3]? If your TIFFs came off of a multidimensional acquisition system, Bio-Formats may already determine the dimensions properly. Regards, Curtis [1] http://imagej.net/Batch_Processing [2] http://imagej.net/Headless#Running_macros_in_headless_mode [3] http://imagej.net/Bio-Formats On Sun, Oct 18, 2015 at 6:23 PM, ctr26 <[hidden email]> wrote: > Hi all, > > I'm trying to make a bat file that converts tiffs to hyperstack tiffs. > > I basically just want to open the tiff file and run the command > > run("Stack to Hyperstack...", "order=xyczt(default) channels=1 slices=4 > frames=1 display=Color"); > > I'd like to be able to control each of these parameters in this aswell so > pass an argument to a macro is less desirable for me. > > So far I have this: > java -jar "C:\Program Files (x86)\ImageJ\ij.jar" -open > "C:\\Users\\Craggles\\Desktop\\asd.tiff" -run[order=xyzct channels=4 > slices=1 frames=1 display=Color] "Stack to Hyperstack..." > > and this > > java -jar "C:\Program Files (x86)\ImageJ\ij.jar" -open > "C:\\Users\\Craggles\\Desktop\\asd.tiff" -run "Stack to > Hyperstack...,order=xyzct channels=4 slices=1 frames=1 display=Color" > > but I cannot get the command to accept the "Stack to Hyperstack..." command > and then input its arguement either. Any help welcome! > > > > > > -- > View this message in context: > http://imagej.1557.x6.nabble.com/ImageJ-Command-Line-Run-Arguements-tp5014676.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
I solved it for myself.
**************** Macro code **************** cmd = getArgument(); string = split(cmd, ","); print(cmd); order = string[0]; channels = parseInt(string[1]); slices = parseInt(string[2]); frames = parseInt(string[3]); dir = getDirectory("image") file = getInfo("image.filename") print("Creating hyper Stack"); print(dir+file) run("Stack to Hyperstack...", "order=&order channels=&channels slices=&slices frames=&frames display=Color"); print("Saving"); saveAs("Tiff", dir + file); print("Fin"); ********************************************* Which takes a single string argurment delimited by commas. *****************Batch file********************* setlocal cd /d %~dp0 java -jar ij.jar -open test.tif -batch hyper.ijm "xyczt(default),0001,0005,0002" ********************************************* This is the batch that converts tif stacks to hyperstacks. |
Free forum by Nabble | Edit this page |