batch processing macro problem.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

batch processing macro problem.

jacob goodwin
Hi everyone,

I have used imagej a bit in the past (not much, and very basic) but I have absolutely no ideas about how to approach this problem.

We recently had a 384 well, 4 channel microscopy screen performed on drug treatment of cells.  We received data files that were 12bit images, that I was able to convert to 8bit tiffs so we could view the grey scale images. (the company has done some analysis, but we still want to view the image files, to see if we can get any further data from it.

The data is in one folder, and the order of the image files is A1-1 to A1-6, A2-1 to A2-6 etc

each file name then having the wavelength name at the end (in the following order)
488
555
647
Dapi

What I would like to do, is pseudo colour all the images, make an overlay, and then if I am not pushing my luck too far, to make a montage of all the images while keeping the A1-1 name.

So far I am unable to record a macro that allows me to do this, to keep it simple first I open the 4 images, then start recording the macro.  I convert the images to a stack, then hyperstack, make it composite with display mode set to colour.  I then Arrange the colours so that they are in the correct order, split the channels again then merge the images (while keeping the source images) to create the combined image (which is still in a stack). To get rid of the stack I convert the merged image to a RGB colour file and close the merged stack.

This leaves me with 5 open files, four individual colours plus the merged.  I then turn this into a stack, and then create a montage (with 5 columns and 1 row).  I then save the montage file, and close down the stack.  End the recording, create and save the macro to the macro folder.

To me this seems a very convoluted process, but I cannot find a simpler method.  If I do this manually as described, I save the image that I want (the montage of 4+1merge), however, if I open up another 4 images and then run the macro a number of issues occur.

First the macro stops at the Arrange channels, so I then have to go and reassign the colours.  After that it goes through and makes the montage, but now all images in the montage are all of one colour (whichever is the first in the arrange channel)

This also doesn't solve the problem of applying this to the whole folder

If anyone has any ideas that would be great, and I am sorry if anything I have asked has been solved previously, I was unable to find what I needed.

Cheers

Jacob


This is the macro as it stands now.
run("Images to Stack", "name=Stack title=[] use");
run("Stack to Hyperstack...", "order=xyczt(default) channels=1 slices=4 frames=1 display=Color");
run("Make Composite", "display=Color");
run("Arrange Channels...");
run("Stack to Images");
run("Merge Channels...", "c1=Stack-0003 c2=Stack-0002 c3=Stack-0001 c6=Stack-0004 create keep");
run("RGB Color");
run("Close");
run("Images to Stack", "name=Stack title=[] use");
run("Make Montage...", "columns=5 rows=1 scale=1 first=1 last=5 increment=1 border=0 font=12");
saveAs("Tiff", "C:\\Users\\Jacob\\Desktop\\Montage new macro.tif");
run("Close");
run("Close");

Reply | Threaded
Open this post in threaded view
|

Re: batch processing macro problem.

Christine Labno-2
Hi Jacob,

I think I can help you, but I had to make some guesses about what you wanted based on your description and macro code.  

I think the code below does what you want as far as creating the montage.  It's not in batch mode yet, but I can get it there pretty easily.  I just want to make sure this does what you want before we get into batch processing.  

Your method is a little convoluted, but not by much.  I modified your code a bit to keep from having to go in and out of stacks so much.  

First I grab the name for you and modify it slightly so that the montage is saved as "original name montage.tif"  Not knowing your exact file name format it may not come out exactly right, but it can be modified.  Then I rearrange the stack to the order (I think) you want.  It should proceed automatically now, with the addition of the "new=" code.  If you need a different order, modify the numbers in this line.  run("Arrange Channels...", "new=3214");

Then I set up the colors, again guessing based on what I think you want, create the merged image by having the hyperstack spit out an RGB, convert the original hyperstack to RGB as well, add a new blank frame to the end of this hyperstack into which I paste the merged image (so you don't have to go out of stack, merge and back into stack).  Then I make the montage and rename it in preparation for saving.  

Does this all make sense to you?  Can you modify it to be closer to exactly what you want in terms of colors and names, test and then post/send it back?  Then I can help you get the code into batch mode (or you could try this code with the Process --> Batch --> Macro feature and see if you can automate whole folder processing that way).  

Best,
Christine

------------------------begin macro after this line--------------------------
   t=getTitle();                                                                        
   s=lastIndexOf(t, '.');                          
   t=substring(t, 0,s);
   t=replace(t," ","_");
 
t2= t +' montage.tif';              
run("Images to Stack", "name=Stack title=[] use");
run("Stack to Hyperstack...", "order=xyczt(default) channels=4 slices=1 frames=1 display=Composite");
run("Arrange Channels...", "new=3214");
Stack.setDisplayMode("color");
Stack.setChannel(1);
run("Red");
Stack.setChannel(2);
run("Green");
Stack.setChannel(3);
run("Blue");
Stack.setChannel(4);
run("Magenta");
Stack.setDisplayMode("composite");
run("Stack to RGB");
rename("merge");
selectWindow("Stack");
Stack.setDisplayMode("color");
run("RGB Color");
run("Add Slice");
selectWindow("merge");
run("Copy");
selectWindow("Stack (RGB)");
run("Paste");
run("Make Montage...", "columns=5 rows=1 scale=1 first=1 last=5 increment=1 border=0 font=12");
rename(t2);                                      

------------------------end macro after this line--------------------------

--------------------------------------------
Christine Labno, Ph.D.
Asst. Technical Director
Light Microscopy Core
University of Chicago
Office of Shared Research Facilities
KCBD 1250 900 E. 57th St.
(773) 834-9040 (phone)

________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of jacob goodwin [[hidden email]]
Sent: Monday, February 16, 2015 1:58 PM
To: [hidden email]
Subject: batch processing macro problem.

Hi everyone,

I have used imagej a bit in the past (not much, and very basic) but I have
absolutely no ideas about how to approach this problem.

We recently had a 384 well, 4 channel microscopy screen performed on drug
treatment of cells.  We received data files that were 12bit images, that I
was able to convert to 8bit tiffs so we could view the grey scale images.
(the company has done some analysis, but we still want to view the image
files, to see if we can get any further data from it.

The data is in one folder, and the order of the image files is A1-1 to A1-6,
A2-1 to A2-6 etc

each file name then having the wavelength name at the end (in the following
order)
488
555
647
Dapi

What I would like to do, is pseudo colour all the images, make an overlay,
and then if I am not pushing my luck too far, to make a montage of all the
images while keeping the A1-1 name.

So far I am unable to record a macro that allows me to do this, to keep it
simple first I open the 4 images, then start recording the macro.  I convert
the images to a stack, then hyperstack, make it composite with display mode
set to colour.  I then Arrange the colours so that they are in the correct
order, split the channels again then merge the images (while keeping the
source images) to create the combined image (which is still in a stack). To
get rid of the stack I convert the merged image to a RGB colour file and
close the merged stack.

This leaves me with 5 open files, four individual colours plus the merged.
I then turn this into a stack, and then create a montage (with 5 columns and
1 row).  I then save the montage file, and close down the stack.  End the
recording, create and save the macro to the macro folder.

To me this seems a very convoluted process, but I cannot find a simpler
method.  If I do this manually as described, I save the image that I want
(the montage of 4+1merge), however, if I open up another 4 images and then
run the macro a number of issues occur.

First the macro stops at the Arrange channels, so I then have to go and
reassign the colours.  After that it goes through and makes the montage, but
now all images in the montage are all of one colour (whichever is the first
in the arrange channel)

This also doesn't solve the problem of applying this to the whole folder

If anyone has any ideas that would be great, and I am sorry if anything I
have asked has been solved previously, I was unable to find what I needed.

Cheers

Jacob


This is the macro as it stands now.
run("Images to Stack", "name=Stack title=[] use");
run("Stack to Hyperstack...", "order=xyczt(default) channels=1 slices=4
frames=1 display=Color");
run("Make Composite", "display=Color");
run("Arrange Channels...");
run("Stack to Images");
run("Merge Channels...", "c1=Stack-0003 c2=Stack-0002 c3=Stack-0001
c6=Stack-0004 create keep");
run("RGB Color");
run("Close");
run("Images to Stack", "name=Stack title=[] use");
run("Make Montage...", "columns=5 rows=1 scale=1 first=1 last=5 increment=1
border=0 font=12");
saveAs("Tiff", "C:\\Users\\Jacob\\Desktop\\Montage new macro.tif");
run("Close");
run("Close");





--
View this message in context: http://imagej.1557.x6.nabble.com/batch-processing-macro-problem-tp5011621.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
Reply | Threaded
Open this post in threaded view
|

RE: batch processing macro problem.

jacob goodwin
Thanks Christine for all of your help.

The macro that you wrote works great for the 4 images when I run it through 4 open images.  I rearranged the order to make the images appear int he right order (from 3214 to 4123) and then I altered the channel colours to match what I needed. 

I may have over simplified the naming of these files so that I could try and say what I have without it getting too confusing.  Here is the first two sets of images.  The A1 is the well number, the W00001 is the position in that well (each well had six images taken).

A1--W00001--P00001--Z00000--T00000--Alexa488
A1--W00001--P00001--Z00000--T00000--Alexa555
A1--W00001--P00001--Z00000--T00000--Alexa647
A1--W00001--P00001--Z00000--T00000--DAPI
A1--W00001--P00002--Z00000--T00000--Alexa488
A1--W00001--P00002--Z00000--T00000--Alexa555
A1--W00001--P00002--Z00000--T00000--Alexa647
A1--W00001--P00002--Z00000--T00000--DAPI

After we get to the 6th image for that well it then starts over with A2--W00002--P00001----etc

At the end of this, I want to have just the montages of all files so that we can group them together in their respective treatments and if we want to use any particular image set then we can go back to the files and work on them one by one, so I do not need to save the stacks etc (I only have so much hard drive space).  So I would like to have the files be converted to the montage and then this image saved into a sub folder within the folder that contains the original images.  Currently the image montage saves as

A1--W00001--P00001--Z00000--T00000--DAPI montage.tif 

So I am very happy with that, thanks.

If I then Directly take your macro and try to do the Batch>macro from the image folder to a output folder on the desktop it comes up with a window that says Hyperstack converter, then channels x slices x frames <> stack size

Thanks again for your help Christine and if you could help get this into batch mode I would be really grateful. I will also have a play with it but I am not hopeful, when it comes to this sort of thing I am pretty useless.

Here is the code as it is


   t=getTitle();                                                                       
   s=lastIndexOf(t, '.');                         
   t=substring(t, 0,s);
   t=replace(t," ","_");
 
t2= t +' montage.tif';             
run("Images to Stack", "name=Stack title=[] use");
run("Stack to Hyperstack...", "order=xyczt(default) channels=4 slices=1 frames=1 display=Composite");
run("Arrange Channels...", "new=4123");
Stack.setDisplayMode("color");
Stack.setChannel(1);
run("Blue");
Stack.setChannel(2);
run("Green");
Stack.setChannel(3);
run("Red");
Stack.setChannel(4);
run("Magenta");
Stack.setDisplayMode("composite");
run("Stack to RGB");
rename("merge");
selectWindow("Stack");
Stack.setDisplayMode("color");
run("RGB Color");
run("Add Slice");
selectWindow("merge");
run("Copy");
selectWindow("Stack (RGB)");
run("Paste");
run("Make Montage...", "columns=5 rows=1 scale=1 first=1 last=5 increment=1 border=0 font=12");
rename(t2);                                     


Thanks again,

Jacob Goodwin




From: Christine Labno-2 [via ImageJ] [ml-node+[hidden email]]
Sent: Tuesday, 17 February 2015 6:28 PM
To: Jacob Goodwin
Subject: Re: batch processing macro problem.

Hi Jacob,

I think I can help you, but I had to make some guesses about what you wanted based on your description and macro code.  

I think the code below does what you want as far as creating the montage.  It's not in batch mode yet, but I can get it there pretty easily.  I just want to make sure this does what you want before we get into batch processing.  

Your method is a little convoluted, but not by much.  I modified your code a bit to keep from having to go in and out of stacks so much.  

First I grab the name for you and modify it slightly so that the montage is saved as "original name montage.tif"  Not knowing your exact file name format it may not come out exactly right, but it can be modified.  Then I rearrange the stack to the order (I think) you want.  It should proceed automatically now, with the addition of the "new=" code.  If you need a different order, modify the numbers in this line.  run("Arrange Channels...", "new=3214");

Then I set up the colors, again guessing based on what I think you want, create the merged image by having the hyperstack spit out an RGB, convert the original hyperstack to RGB as well, add a new blank frame to the end of this hyperstack into which I paste the merged image (so you don't have to go out of stack, merge and back into stack).  Then I make the montage and rename it in preparation for saving.  

Does this all make sense to you?  Can you modify it to be closer to exactly what you want in terms of colors and names, test and then post/send it back?  Then I can help you get the code into batch mode (or you could try this code with the Process --> Batch --> Macro feature and see if you can automate whole folder processing that way).  

Best,
Christine

------------------------begin macro after this line--------------------------
   t=getTitle();                                                                        
   s=lastIndexOf(t, '.');                          
   t=substring(t, 0,s);
   t=replace(t," ","_");
 
t2= t +' montage.tif';              
run("Images to Stack", "name=Stack title=[] use");
run("Stack to Hyperstack...", "order=xyczt(default) channels=4 slices=1 frames=1 display=Composite");
run("Arrange Channels...", "new=3214");
Stack.setDisplayMode("color");
Stack.setChannel(1);
run("Red");
Stack.setChannel(2);
run("Green");
Stack.setChannel(3);
run("Blue");
Stack.setChannel(4);
run("Magenta");
Stack.setDisplayMode("composite");
run("Stack to RGB");
rename("merge");
selectWindow("Stack");
Stack.setDisplayMode("color");
run("RGB Color");
run("Add Slice");
selectWindow("merge");
run("Copy");
selectWindow("Stack (RGB)");
run("Paste");
run("Make Montage...", "columns=5 rows=1 scale=1 first=1 last=5 increment=1 border=0 font=12");
rename(t2);                                      

------------------------end macro after this line--------------------------

--------------------------------------------
Christine Labno, Ph.D.
Asst. Technical Director
Light Microscopy Core
University of Chicago
Office of Shared Research Facilities
KCBD 1250 900 E. 57th St.
(773) 834-9040 (phone)

________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of jacob goodwin [[hidden email]]
Sent: Monday, February 16, 2015 1:58 PM
To: [hidden email]
Subject: batch processing macro problem.

Hi everyone,

I have used imagej a bit in the past (not much, and very basic) but I have
absolutely no ideas about how to approach this problem.

We recently had a 384 well, 4 channel microscopy screen performed on drug
treatment of cells.  We received data files that were 12bit images, that I
was able to convert to 8bit tiffs so we could view the grey scale images.
(the company has done some analysis, but we still want to view the image
files, to see if we can get any further data from it.

The data is in one folder, and the order of the image files is A1-1 to A1-6,
A2-1 to A2-6 etc

each file name then having the wavelength name at the end (in the following
order)
488
555
647
Dapi

What I would like to do, is pseudo colour all the images, make an overlay,
and then if I am not pushing my luck too far, to make a montage of all the
images while keeping the A1-1 name.

So far I am unable to record a macro that allows me to do this, to keep it
simple first I open the 4 images, then start recording the macro.  I convert
the images to a stack, then hyperstack, make it composite with display mode
set to colour.  I then Arrange the colours so that they are in the correct
order, split the channels again then merge the images (while keeping the
source images) to create the combined image (which is still in a stack). To
get rid of the stack I convert the merged image to a RGB colour file and
close the merged stack.

This leaves me with 5 open files, four individual colours plus the merged.
I then turn this into a stack, and then create a montage (with 5 columns and
1 row).  I then save the montage file, and close down the stack.  End the
recording, create and save the macro to the macro folder.

To me this seems a very convoluted process, but I cannot find a simpler
method.  If I do this manually as described, I save the image that I want
(the montage of 4+1merge), however, if I open up another 4 images and then
run the macro a number of issues occur.

First the macro stops at the Arrange channels, so I then have to go and
reassign the colours.  After that it goes through and makes the montage, but
now all images in the montage are all of one colour (whichever is the first
in the arrange channel)

This also doesn't solve the problem of applying this to the whole folder

If anyone has any ideas that would be great, and I am sorry if anything I
have asked has been solved previously, I was unable to find what I needed.

Cheers

Jacob


This is the macro as it stands now.
run("Images to Stack", "name=Stack title=[] use");
run("Stack to Hyperstack...", "order=xyczt(default) channels=1 slices=4
frames=1 display=Color");
run("Make Composite", "display=Color");
run("Arrange Channels...");
run("Stack to Images");
run("Merge Channels...", "c1=Stack-0003 c2=Stack-0002 c3=Stack-0001
c6=Stack-0004 create keep");
run("RGB Color");
run("Close");
run("Images to Stack", "name=Stack title=[] use");
run("Make Montage...", "columns=5 rows=1 scale=1 first=1 last=5 increment=1
border=0 font=12");
saveAs("Tiff", "C:\\Users\\Jacob\\Desktop\\Montage new macro.tif");
run("Close");
run("Close");





--
View this message in context: http://imagej.1557.x6.nabble.com/batch-processing-macro-problem-tp5011621.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



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/batch-processing-macro-problem-tp5011621p5011640.html
To unsubscribe from batch processing macro problem., click here.
NAML
Reply | Threaded
Open this post in threaded view
|

RE: batch processing macro problem.

jacob goodwin
Sorry, I made an error. There must have already been some macro in the batch macro window.

If I copy and paste your macro in there, it comes up with a window that says

Images to stack
There must be at least 2 open images.

Thanks

Jacob
Reply | Threaded
Open this post in threaded view
|

Re: batch processing macro problem.

Christine Labno-2
Hi Jacob.

I think the error window in the batch macro window is due to the macro only opening a single image, not a group of images.

It took me a bit to get this working, but assuming the Alexa488 image is the first in every group, the following code (based on your corrected single process code) will batch process a whole folder of your choosing, saving into the folder of your choosing.  The macro will ask you to choose the folder to process and then the folder for saving once at the beginning of the macro.  

Good luck!
Christine

______________begin_______________

  dir = getDirectory("Choose a Directory to PROCESS");      
     list = getFileList(dir);                                            
  dir2 = getDirectory("Choose a Directory for SAVING THE MONTAGES");

setBatchMode(true);              
    for (f=0; f<list.length; f++) {
        path = dir+list[f];              

end = endsWith(path, "8.tif"); {
 if (end==true)  {
    run("Image Sequence...", "open=path number=4 starting=f sort");
    t=getInfo("slice.label");
//t=getTitle();
  s=lastIndexOf(t, 'A');
  t=substring(t, 0, s);
  t=replace(t," ","_");
t2= t +' montage.tif';
print(t);

rename("Stack");
run("Stack to Hyperstack...", "order=xyczt(default) channels=4 slices=1 frames=1 display=Composite");
run("Arrange Channels...", "new=4123");
Stack.setDisplayMode("color");
Stack.setChannel(1);
run("Blue");
Stack.setChannel(2);
run("Green");
Stack.setChannel(3);
run("Red");
Stack.setChannel(4);
run("Magenta");
Stack.setDisplayMode("composite");
run("Stack to RGB");
rename("merge");
selectWindow("Stack");
Stack.setDisplayMode("color");
run("RGB Color");
run("Add Slice");
selectWindow("merge");
run("Copy");
selectWindow("Stack (RGB)");
run("Paste");
run("Make Montage...", "columns=5 rows=1 scale=1 first=1 last=5 increment=1 border=0 font=12");

rename(t2);
   saveAs("Tiff",  dir2 + t2 + ".tif");          
run("Close All");                                                
}
                                 

if (end==false) {
//print("nope");
run("Close All");    
  }
     }
           }    

________________end_________________
--------------------------------------------
Christine Labno, Ph.D.
Asst. Technical Director
Light Microscopy Core
University of Chicago
Office of Shared Research Facilities
KCBD 1250 900 E. 57th St.
(773) 834-9040 (phone)

________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of jacob goodwin [[hidden email]]
Sent: Wednesday, February 18, 2015 5:05 AM
To: [hidden email]
Subject: Re: batch processing macro problem.

Sorry, I made an error. There must have already been some macro in the batch
macro window.

If I copy and paste your macro in there, it comes up with a window that says

Images to stack
There must be at least 2 open images.

Thanks

Jacob



--
View this message in context: http://imagej.1557.x6.nabble.com/batch-processing-macro-problem-tp5011621p5011658.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
Reply | Threaded
Open this post in threaded view
|

RE: batch processing macro problem.

jacob goodwin
Thanks again for your help Christine,

The macro still comes up with an error. After I do put in the macro and input (i made up a new folder with only two sets of images to see if it works)/output folders and start it up, it starts to go through the first set of images, however it stops, and comes up with two windows. 

The first is a log window which has one line of text

A1--W00001-P00001--Z00001-- T00000--

And a second window that says Macro error that reads

Stack required in line 36.
Stack . <setDisplayMode> (''color'') ;
 
and if I then show the debug window, this is wh

Name * Value





Memory * 56MB of 640MB (8%)




nImages() * 4





getTitle() * Stack





i * 0





dir * C:\Users\Jacob\Desktop\New folder (3)\


list * array[24]





dir2 * C:\Users\Jacob\Desktop\New Folder (4)\


f * 0





path * C:\Users\Jacob\Desktop\New folder (3)\A1--W00001--P00001--Z00000--T00000--Alexa4...
end * 1





t * A1--W00001--P00001--Z00000--T00000--


s * 36





t2 * A1--W00001--P00001--Z00000--T00000-- montage.tif




























I have really no idea, how to change what is there, from your code it seems like it should have made the stack already, so I am a little confused.

Reply | Threaded
Open this post in threaded view
|

Re: batch processing macro problem.

Christine Labno-2
Hi Jacob,

Since the macro works smoothly for me in both ImageJ 1.49j and a freshly updated Fiji 1.49m I'm guessing there's something going on with your installation of ImageJ.  From the looks of the error message it doesn't recognize the image on top during line 36 as being a stack, which means it's either not selecting the stack when the macro tells it to select Window "Stack" and so it's still looking at the single channel RGB image, or it's not recognizing Stack as a stack because it's a hyperstack.  Either way I think that could be considered a bug.  What installation of ImageJ / Fiji are you on?  Can you update / revert to be closer to mine or to the current version and does that fix the problem?

Best,
Christine

--------------------------------------------
Christine Labno, Ph.D.
Asst. Technical Director
Light Microscopy Core
University of Chicago
Office of Shared Research Facilities
KCBD 1250 900 E. 57th St.
(773) 834-9040 (phone)

________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of jacob goodwin [[hidden email]]
Sent: Monday, February 23, 2015 9:10 AM
To: [hidden email]
Subject: Re: batch processing macro problem.

Thanks again for your help Christine,

The macro still comes up with an error. After I do put in the macro and input (i made up a new folder with only two sets of images to see if it works)/output folders and start it up, it starts to go through the first set of images, however it stops, and comes up with two windows.

The first is a log window which has one line of text

A1--W00001-P00001--Z00001-- T00000--

And a second window that says Macro error that reads

Stack required in line 36.
Stack . <setDisplayMode> (''color'') ;

and if I then show the debug window, this is wh

Name    *       Value






Memory  *       56MB of 640MB (8%)





nImages()       *       4






getTitle()      *       Stack






i       *       0






dir     *       C:\Users\Jacob\Desktop\New folder (3)\



list    *       array[24]






dir2    *       C:\Users\Jacob\Desktop\New Folder (4)\



f       *       0






path    *       C:\Users\Jacob\Desktop\New folder (3)\A1--W00001--P00001--Z00000--T00000--Alexa4...
end     *       1






t       *       A1--W00001--P00001--Z00000--T00000--



s       *       36






t2      *       A1--W00001--P00001--Z00000--T00000-- montage.tif
































I have really no idea, how to change what is there, from your code it seems like it should have made the stack already, so I am a little confused.





--
View this message in context: http://imagej.1557.x6.nabble.com/batch-processing-macro-problem-tp5011621p5011728.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
Reply | Threaded
Open this post in threaded view
|

RE: batch processing macro problem.

jacob goodwin
Hi Christine,

Unfortunately no luck.  I was running the most recent version of imagej on both mac (os  x 10.8.5) and pc (windows 8), and also tried the other versions that were on the website.  I downloaded Fiji, both the continuous release and the Fiji life line November25th version for mac.   The continuous version didn't work, but the Nov 25th version did... almost.

So when I select process>batch>macro, I then put in the input and output folders, say that I want to save as a tiff, and the open up the macro that you wrote, then click ok.  It then asks me again for an input folder, and then for an ouput folder. It starts to process everything and then it asks me again for an input/output folder, if I let it it will continuously ask for this. The only way to stop it is to actually force quit the program.  The more I put in the input/ouput folders the more single images it now saves to my output folder.

I set up the input folder with 3 sets of images to process, if I look at the output folder after I first start it, there are 3 montages and one normal 488 image saved to the folder.  The first montage is correct, the second and third are mixed around.  The dapi image from A1, is placed as a 488 image in A2, and then the dapi image from A2 is placed in the 488 image for A3.

The PC version of Fiji doesn't even get that far, it makes the first montage and then only ever saves single images.

 

A1--W00001--P00001--Z00000--T00000-- montage.jpg (434K) Download Attachment
A1--W00001--P00001--Z00000--T00000--D montage.jpg (252K) Download Attachment
A1--W00001--P00002--Z00000--T00000--D montage.jpg (274K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: batch processing macro problem.

Christine Labno-2
Hi Jacob,

Sorry for the confusion.  Don't use Process -> Batch Macro with the new version of the macro.  Just open the macro and then from the Macro window choose Macro -> Run Macro.   It's meant to stand alone, not work through the Batch.  You will only be able to process one folder at a time, not a folder with a bunch of subfolders.  See if that works.  If that doesn't work I don't know what to do for you, not being able to see what's going on on your machine.  

Best,
Christine


--------------------------------------------
Christine Labno, Ph.D.
Asst. Technical Director
Light Microscopy Core
University of Chicago
Office of Shared Research Facilities
KCBD 1250 900 E. 57th St.
(773) 834-9040 (phone)

________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of jacob goodwin [[hidden email]]
Sent: Tuesday, February 24, 2015 4:02 AM
To: [hidden email]
Subject: Re: batch processing macro problem.

Hi Christine,

Unfortunately no luck.  I was running the most recent version of imagej on both mac (os  x 10.8.5) and pc (windows 8), and also tried the other versions that were on the website.  I downloaded Fiji, both the continuous release and the Fiji life line November25th version for mac.   The continuous version didn't work, but the Nov 25th version did... almost.

So when I select process>batch>macro, I then put in the input and output folders, say that I want to save as a tiff, and the open up the macro that you wrote, then click ok.  It then asks me again for an input folder, and then for an ouput folder. It starts to process everything and then it asks me again for an input/output folder, if I let it it will continuously ask for this. The only way to stop it is to actually force quit the program.  The more I put in the input/ouput folders the more single images it now saves to my output folder.

I set up the input folder with 3 sets of images to process, if I look at the output folder after I first start it, there are 3 montages and one normal 488 image saved to the folder.  The first montage is correct, the second and third are mixed around.  The dapi image from A1, is placed as a 488 image in A2, and then the dapi image from A2 is placed in the 488 image for A3.

The PC version of Fiji doesn't even get that far, it makes the first montage and then only ever saves single images.




A1--W00001--P00001--Z00000--T00000-- montage.jpg (434K) <http://imagej.1557.x6.nabble.com/attachment/5011749/0/A1--W00001--P00001--Z00000--T00000--%20montage.jpg>
A1--W00001--P00001--Z00000--T00000--D montage.jpg (252K) <http://imagej.1557.x6.nabble.com/attachment/5011749/1/A1--W00001--P00001--Z00000--T00000--D%20montage.jpg>
A1--W00001--P00002--Z00000--T00000--D montage.jpg (274K) <http://imagej.1557.x6.nabble.com/attachment/5011749/2/A1--W00001--P00002--Z00000--T00000--D%20montage.jpg>




--
View this message in context: http://imagej.1557.x6.nabble.com/batch-processing-macro-problem-tp5011621p5011749.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
Reply | Threaded
Open this post in threaded view
|

RE: batch processing macro problem.

jacob goodwin
Hi Christine,

Thanks again for you help.  I ran this through the macro menu on my PC and no luck, but on the Mac using Fiji it is almost there.  It now no longer asks me to select input and output files and gives me the correct number of montages.  but I am still having the issue where it puts the dapi from the previous set into the green channel of the next montage.

It does the first montage fine, but it seems as though when it selects the next set of 4 images it collects and starts with the dapi,  to explain further if I have three sets of 4 images and i will label them from 1-12 the first round picks up 1-4, the second round picks up 4-7, the third round picks up 8-11

I guess that the issue lies somewhere in this part of the macro. 

setBatchMode(true);            
    for (f=0; f<list.length; f++) {
        path = dir+list[f];              

end = endsWith(path, "8.tif"); {
 if (end==true)  {
    run("Image Sequence...", "open=path number=4 starting=f sort");
    t=getInfo("slice.label");
//t=getTitle();
  s=lastIndexOf(t, 'A');
  t=substring(t, 0, s);
  t=replace(t," ","_");
t2= t +' montage.tif';
print(t);

But I really don't know where.  I was having a look at another image to stack macro for three channels, and they included  this

 n = list.length;
      if ((n%3)!=0)
         exit("The number of files must be a multiple of 3"); 

which I guess tells the macro that the images are in threes, could this be applied to your macro but incorporate 4 instead?  The macro, at least on my computer, cannot seem to pick up the right images for processing.

Thanks again for all of your help,

Jacob

Reply | Threaded
Open this post in threaded view
|

RE: batch processing macro problem.

jacob goodwin
In reply to this post by Christine Labno-2
https://www.dropbox.com/s/qostkw77rmqogqg/Getting%20Started.pdf?dl=0

Above is a link to a dropbox that has the image input folder that I have been using.  Maybe you will see the same thing as I do if you run my images on your computer.

I am really sorry to be such a bother Christine