Macros for Colour Deconvolution plugin - saving multiple files
Posted by drew_c on Oct 30, 2013; 4:16pm
URL: http://imagej.273.s1.nabble.com/Macros-for-Colour-Deconvolution-plugin-saving-multiple-files-tp5005383.html
Hi All,
I'm new to writing macros for image j so please bare with me. I'm trying to process a batch of images with multiple savepoints and with the colour deconvolution plugin. Any help with this is greatly appreciated.
The workflow that I would like to do is as follows:
1. select the input directory
2. select the output directory
3. run("Subtract Background...", "rolling=50 light");
4. run("Colour Deconvolution", "vectors=[H DAB]");
At this point I would like to save colour1 as ''original image name_colour1'', and colour2 as ''original image name_colour2''. I do not need colour3.
Now don't mind ending the macro here and starting up a new macro becuase as colour1 and colour2 images need to be treated differently in terms of thresholding and particle analysis so it might get complicated within the same macro. What I do need to next do is:
(5. select the input directory)
(6. select the output directory)
7. setAutoThreshold("Default");
8. //run("Threshold...");
9. setThreshold(0, 146);
10. run("Convert to Mask");
11. run("Fill Holes");
12. run("Convert to Mask");
13. run("Watershed");
14. run("Set Scale...", "distance=63 known=10 pixel=1 unit=um");
15. run("Analyze Particles...", "size=30.00-300.00 circularity=0.00-1.00 show=Outlines display exclude summarize");
Here again I would like to save 2 images: The modified (thresholded, holed, masked, and watershedded) image as ''original image name_colour1_modified'' and the new outline image as ''original image name_outline''
I would really appreciate any help I can get - I've tried all sorts of things such as:
selectWindow(imgName + " (Colour[3])");
close();
But I get errors saying that there is no such window, and the closest that I'm getting to is being able to save 1 random window only.
Hope there is someone there who can spare some time!
BW
Andrew