Hello, I am new to ImageJ.
I am wondering if anyone can help? I am trying to use a batch option to process a macro to overlay a grid on an image. In this case a folder with 70 images. I can create a macro and I can see the batch option but is it possible to add a new macro to the batch option? Many thanks, Paul - -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Paul,
Process/Batch/Macro... allows you to write your macro (or open it if already written). To add an image in the overlay of all the image of a folder : run("Add Image...", "image=Untitled x=0 y=0 opacity=100 zero"); see enclosed exemple. Eric Denarier Grenoble Institut des Neurosciences Inserm U836 Chemin Fortuné Ferrini 38700 La Tronche France Tél :33 (0)4 56 52 05 38 Fax :33 (0)4 56 52 06 57 http://neurosciences.ujf-grenoble.fr/ Le 01/09/2014 11:00, Paul Dennis a écrit : > Hello, I am new to ImageJ. > > I am wondering if anyone can help? > > I am trying to use a batch option to process a macro to overlay a grid on an image. In this case a folder with 70 images. > > I can create a macro and I can see the batch option but is it possible to add a new macro to the batch option? > > Many thanks, > > Paul - > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html Capture.PNG (64K) Download Attachment |
In reply to this post by Paul Dennis
Hello Eric.
thank you for the quick reply! I have code for a macro to overlay a grid. // This macro demonstrates how to use the Image>Overlay>Add Selection // command to draw a line grid on an image in a non-destructive overlay. requires("1.43j"); color = "cyan"; nLines = 50; if (nImages==0) run("Boats (356K)"); run("Remove Overlay"); width = getWidth; height = getHeight; tileWidth = width/(nLines+1); tileHeight = tileWidth; xoff=tileWidth; while (true && xoff<width) { // draw vertical lines makeLine(xoff, 0, xoff, height); run("Add Selection...", "stroke="+color); xoff += tileWidth; } yoff=tileHeight; while (true && yoff<height) { // draw horizonal lines makeLine(0, yoff, width, yoff); run("Add Selection...", "stroke="+color); yoff += tileHeight; } run("Select None"); This works fine if I open an image and run the macro. If I open batch and then open the macro or paste the macro code in and process nothing happens. If I save the macro it doesn't show in the drop down list. I thought the macro would overlay/ save the grid on top of the image but maybe it's just intended to be used on an open file? Many thanks, Paul - -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
I got the following code to work on a folder.
(I removed from the while loop : true &&.) Hope it helps. color = "cyan"; nLines = 50; if (nImages==0) run("Boats (356K)"); run("Remove Overlay"); width = getWidth; height = getHeight; tileWidth = width/(nLines+1); tileHeight = tileWidth; xoff=tileWidth; while ( xoff<width) { // draw vertical lines makeLine(xoff, 0, xoff, height); run("Add Selection...", "stroke="+color); xoff += tileWidth; } yoff=tileHeight; while ( yoff<height) { // draw horizonal lines makeLine(0, yoff, width, yoff); run("Add Selection...", "stroke="+color); yoff += tileHeight; } run("Select None"); Eric Denarier Grenoble Institut des Neurosciences Inserm U836 Chemin Fortuné Ferrini 38700 La Tronche France Tél :33 (0)4 56 52 05 38 Fax :33 (0)4 56 52 06 57 http://neurosciences.ujf-grenoble.fr/ Le 01/09/2014 14:51, Paul Dennis a écrit : > // This macro demonstrates how to use the Image>Overlay>Add Selection > // command to draw a > > line grid on an image in a non-destructive overlay. > > requires("1.43j"); > color = "cyan"; > > > nLines = 50; > if (nImages==0) run("Boats (356K)"); > run("Remove Overlay"); > width = > > getWidth; > height = getHeight; > tileWidth = width/(nLines+1); > tileHeight = tileWidth; > > > xoff=tileWidth; > while (true && xoff<width) { // draw vertical lines > makeLine(xoff, 0, > > xoff, height); > run("Add Selection...", "stroke="+color); > xoff += tileWidth; > } > > > yoff=tileHeight; > while (true && yoff<height) { // draw horizonal lines > makeLine(0, > > yoff, width, yoff); > run("Add Selection...", "stroke="+color); > yoff += tileHeight; > > > } > run("Select None"); -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Paul Dennis
Hello Eric.
Thank you for the code. I am able to run that fine as a record / run macro. If I paste the code to the batch window and process (selected input and output folders) it closed the dialogue box and the images are not having the grid overlayed. If I use the drop down and select say Borders it processes just fine. I am sorry for the many questions! Thanks, Paul - -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
I can't understand the problem. I used either imageJ 1.49b3 or Fiji
1.48v. It works with both. Sorry but I can't find anything else !!!! Eric Denarier Grenoble Institut des Neurosciences Inserm U836 Chemin Fortuné Ferrini 38700 La Tronche France Tél :33 (0)4 56 52 05 38 Fax :33 (0)4 56 52 06 57 http://neurosciences.ujf-grenoble.fr/ Le 01/09/2014 16:08, Paul Dennis a écrit : > Hello Eric. > > Thank you for the code. > > I am able to run that fine as a record / run macro. > > If I paste the code to the batch window and process (selected input and output folders) it closed the dialogue box and the images are not having the grid overlayed. > > If I use the drop down and select say Borders it processes just fine. > > I am sorry for the many questions! > > Thanks, > > Paul - > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Paul Dennis
Hello Eric.
Thank you for the update. I realsie I am on version 148. I will download and test on 149. Thank you for your help! Paul - -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Paul Dennis
Hello Eric.
I just updated ImageJ to version 1.49 from the update menue item but have the same issue. When I click porcess nothing happens and the folders contents are unchanged :( Are your original images in a TIFF format? I wonder if that is the issue for me. Many thanks, Paul - -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
I have jpeg tiff and png images in the folder and even a stack!!!!
Are you sure your output format is .tif ???? Other format will not work !!! Eric Denarier Grenoble Institut des Neurosciences Inserm U836 Chemin Fortuné Ferrini 38700 La Tronche France Tél :33 (0)4 56 52 05 38 Fax :33 (0)4 56 52 06 57 http://neurosciences.ujf-grenoble.fr/ Le 01/09/2014 17:27, Paul Dennis a écrit : > Hello Eric. > > I just updated ImageJ to version 1.49 from the update menue item but have the same issue. When I click porcess nothing happens and the folders contents are unchanged :( Are your original images in a TIFF format? I wonder if that is the issue for me. > > Many thanks, > > Paul - > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Paul Dennis
Hello Eric.
I have been able to get batch to work but very odd. If I choose anything other than .TIFF as the output e.g. PNG JPG and so on it works fine no issues. If I select TIFF as the output nothing happens. I can use one of the other output formats so that is fine. Thank you for your help! Paul - -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Paul,
Although Fiji has a batch processing option in its Process menu, I use the Batch process folders macro template from the ImageJ Macros collection. Its very nice and i think you should give it a try. It's located here http://imagej.nih.gov/ij/macros/BatchProcessFolders.txt Best wishes Stoyan --- Dr. Stoyan P. Pavlov, MD, PhD Departament of Anatomy, Histology and Embryology Medical University "Prof. Dr. Paraskev Stoyanov", Varna Prof. Marin Drinov Str.55 9002 Varna Bulgaria Tel: +359 (0) 52 - 677 - 052 e-mail: [hidden email] [hidden email] 2014-09-02 10:09 GMT+03:00 Paul Dennis <[hidden email]>: > Hello Eric. > > I have been able to get batch to work but very odd. > > If I choose anything other than .TIFF as the output e.g. PNG JPG and so on it works fine no issues. If I select TIFF as the output nothing happens. > > I can use one of the other output formats so that is fine. > > Thank you for your help! > > Paul - > > -- > 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 |