Hi,
When I run a macro, it only works with the images I used to create it. When I try to run the macro in another images (with different names) it doesn't run and a legend appear telling me that the image is not open. How can I edit the macro in the way it can run with any image? I don't know anything about programing!!! Thanks a lot!!! Virginia Dra. Maria Virginia Borroni INIBIBB C La Carrindanga Km 7 CC857. B8000FWB. Bahia Blanca. Buenos Aires. Argentina. Tel.#: 54-291-4861201. interno 127 Fax#: 54-291-4861200 [hidden email] ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. |
If you used the macro recorder, then you're macro should have a line similar
to this. open("/Users/willashby/Desktop/MyFolder/MyImage.JPG"); If it doesn't make sure you use the open command to open your images rather than dragging and dropping them onto ImageJ which results in this. selectWindow("MyImage-1.JPG"); This command won't open images when you run a macro. When I started doing macros in ImageJ, I would record what I needed done using the recorder, create a macro from that, save it, and then open it in a texteditor. Using the texteditor, I would copy the macro as many times as I needed then use the find and replace function to replace the filename "MyImage.JPG" with the names of the other files I needed to process. This procedure might work for you. If your images are in different folders you'll need to change folders as well. For example if I needed to process an image named YourImage.JPG in a folder titled "YourFolder" that was on my Desktop, I woud edit the command to make it look like this open("/Users/willashby/Desktop/YourFolder/YourImage.JPG"); Of course there are more elegant ways of processing batches of images but it would take a while to explain. The BatchConvert.txt macro found in the ImageJ\Macros\folder is an example of this. Good Luck, Will Ashby Vanderbilt University Nashville, TN, USA On 10/8/09 9:49 AM, "Will Ashby" <[hidden email]> wrote: > If you used the macro recorder, then you're macro should have a line similar > to this. > open("/Users/willashby/Desktop/MyImage.JPG"); > > If it doesn't make sure you use the open command to open your images rather > than dragging and dropping them onto ImageJ which results in this. > selectWindow("MyImage-1.JPG"); > This command won't open images when you run a macro. > > When I started doing macros in ImageJ, I would record what I needed done using > the recorder, create a macro from that, save it, and then open it in a > texteditor. Using the texteditor, I would copy the macro as many times as I > needed then use the find and replace function to replace the filename > "MyImage.JPG" with the names of the other files I needed to process. This > procedure might work for you. > > Of course there are more elegant ways of processing batches of images but it > would take a while to explain. The BatchConvert macro found in the > ImageJ\Macros\folder is a good example of this. > > Good Luck, > Will Ashby > Vanderbilt University > Nashville, TN, USA > > On 10/8/09 8:33 AM, "Virginia Borroni" <[hidden email]> wrote: > >> Hi, >> When I run a macro, it only works with the images I used to create it. >> When I try to run the macro in another images (with different names) >> it doesn't run and a legend appear telling me that the image is not >> open. How can I edit the macro in the way it can run with any image? I >> don't know anything about programing!!! >> Thanks a lot!!! >> Virginia >> >> >> >> >> Dra. Maria Virginia Borroni >> INIBIBB >> C La Carrindanga Km 7 CC857. B8000FWB. >> Bahia Blanca. Buenos Aires. Argentina. >> Tel.#: 54-291-4861201. interno 127 >> Fax#: 54-291-4861200 >> [hidden email] >> >> >> ---------------------------------------------------------------- >> This message was sent using IMP, the Internet Messaging Program. |
In reply to this post by Virginia Borroni
It is difficult to know exactly what your macro is designed to do from the
information you provide. If we suppose you want to do a series of instructions on the currently selected image, one strategy is to start recording your macro sequence with an Image | Rename command and then rename the image something like TestImage. This will produce a macro line like: rename("TestImage"); This will rename any selected image to a common name before preforming the macro sequence and assures any macro commands doing a named reference will "know" what your image window is called. A more sophisticated approach is to assign the current image name to a variable, but this will take learning a little bit about programming. If you need a more specific answer, you need to provide us with your macro code. Rob ----- Original Message ----- From: "Virginia Borroni" <[hidden email]> To: <[hidden email]> Sent: Thursday, October 08, 2009 8:33 AM Subject: I can't run a macro > Hi, > When I run a macro, it only works with the images I used to create it. > When I try to run the macro in another images (with different names) it > doesn't run and a legend appear telling me that the image is not open. > How can I edit the macro in the way it can run with any image? I don't > know anything about programing!!! > Thanks a lot!!! > Virginia > > > > > Dra. Maria Virginia Borroni > INIBIBB > C La Carrindanga Km 7 CC857. B8000FWB. > Bahia Blanca. Buenos Aires. Argentina. > Tel.#: 54-291-4861201. interno 127 > Fax#: 54-291-4861200 > [hidden email] > > > ---------------------------------------------------------------- > This message was sent using IMP, the Internet Messaging Program. > |
In reply to this post by Virginia Borroni
On Oct 8, 2009, at 9:33 AM, Virginia Borroni wrote:
> Hi, > When I run a macro, it only works with the images I used to create it. > When I try to run the macro in another images (with different names) > it doesn't run and a legend appear telling me that the image is not > open. How can I edit the macro in the way it can run with any image? I > don't know anything about programing!!! > Thanks a lot!!! > Virginia You can use the Process>Batch>Macro command in ImageJ 1.43 to run a macro on all the images in a specified folder. -wayne |
Free forum by Nabble | Edit this page |