3

I'm trying to create a .bat file to read .bsv files and turn them into color pngs. The first part of that is using imagej to open the .bsv, and then using a "save all" plugin I added. I tried making a macro but it just gives me errors. How would I, in command prompt, with image j, do:

File->import->raw->myfile.bsv and select 8-bit, width: 4000, height: 2672, offset to first image: 0, number of images: 40, gap between images: 0, little-endian byte order.

then

plugins->Save All

Thanks for any help you can offer!

singmotor
  • 3,930
  • 12
  • 45
  • 79
  • Stack Overflow is a question and answer site for professional and enthusiast programmers. Questions must **demonstrate a minimal understanding of the problem being solved**. Tell us what you've tried to do, why it didn't work, and how it _should_ work. See also: [Stack Overflow question checklist](http://meta.stackexchange.com/questions/156810/stack-overflow-question-checklist). – Endoro Aug 09 '13 at 22:41
  • 1
    I'm sorry for failing to demonstrate my efforts @Endoro. But, I have extensively tried to build this .bat file. I tried making a macro (a few actually) and using the command code "-macro nameofMacro.ijm" and "-batch nameofMacro.ijm". I've also read up on running inage j through command prompt, and tried a few things, but can't find any imagej command for importing .raw data. I have built the entire rest of the .bat file (after saving the grayscale images I have to modify them all and send them to other programs) I just need help with this part. I'd appreciate if you removed your down vote! – singmotor Aug 10 '13 at 22:15
  • The command line documentation for the software is here: http://rsbweb.nih.gov/ij/docs/guide/146-18.html – 576i Aug 10 '13 at 22:31
  • @576i, I've read it already. As I mentioned in my comment, I tried the macro commands and they didn't work. And the "run" command for menu items can specify the data inputs for the raw data – singmotor Aug 11 '13 at 03:40

1 Answers1

2

Using the macro recorder (Plugins > Macros > Record...) in ImageJ, your described procedure produces the following code:

run("Raw...", "open=/path/to/myfile.bsv image=8-bit width=4000 height=2672 offset=0 number=40 gap=0 little-endian");
run("Save All");

If you save this macro file e.g. as mymacro.ijm, you should be able to run ImageJ with the macro option like this (depending on your platform):

-macro mymacro.ijm

Hope that helps.

Jan Eglinger
  • 3,995
  • 1
  • 25
  • 51
  • That's what i've been doing, but it doesn't seem to work. It just says: '-macro' is not recognized as an internal or external command, operable program or batch file. – singmotor Aug 14 '13 at 18:38
  • Did you try `java -jar ij.jar -macro mymacro.ijm`? Alternatively, you can try the [Fiji](http://fiji.sc) distribution which provides handy launchers for every platform. – Jan Eglinger Aug 14 '13 at 20:03
  • that returns "Error: unable to access jarfile ij.jar – singmotor Aug 16 '13 at 13:37
  • Make sure you are running the command in the same folder where ij.jar is located, or otherwise provide the full path to your ij.jar. In case you are using Fiji, just use `fiji-win32 mymacro.ijm` (or adjust the launcher name according to your platform). – Jan Eglinger Aug 19 '13 at 14:48