Hi,
First time macro user on ImageJ so very much learning as I go. I'd like to process a series of images where i stack pairs, run functions such as smoothen etc, stack>images then divide one by the other. Each image ends with w3YFP_t1 or w2CFPexYFPem_t1. I've tried browsing online to find a solution to this with no success. Essentially the issue is in the image calculator function, where I can't define images with a variable prefix for the image calculator. Below is what I have so far. name = getTitle(); prefix = substring (name, 0, lastIndexOf(name, " ")); run("Images to Stack", "name=Stack title=[] use"); run("Smooth", "stack"); run("Subtract Background...", "rolling=125 stack"); run("32-bit"); run("16 colors"); run("Stack to Images"); imageCalculator("Divide create", "+prefix+" w3YFP_t1, "+prefix+" w2CFPexYFPem_t1); selectWindow("Result of DPI 002 18hpa x4obj Eve Dead_w3YFP_t1"); Any advice on how to resolve this would be massively appreciated. Thanks! |
Hi,
I put a correction interleaved in your code below. On 25/08/2016 3:34 AM, mfbx9nn4 wrote: > Hi, > > First time macro user on ImageJ so very much learning as I go. > I'd like to process a series of images where i stack pairs, run functions > such as smoothen etc, stack>images then divide one by the other. Each image > ends with w3YFP_t1 or w2CFPexYFPem_t1. > > I've tried browsing online to find a solution to this with no success. > Essentially the issue is in the image calculator function, where I can't > define images with a variable prefix for the image calculator. Below is what > I have so far. > > > name = getTitle(); > prefix = substring (name, 0, lastIndexOf(name, " ")); > run("Images to Stack", "name=Stack title=[] use"); > run("Smooth", "stack"); > run("Subtract Background...", "rolling=125 stack"); > run("32-bit"); > run("16 colors"); Why do you change to 16 colors? You should leave it as 32 bit, or even just create a 32-bit result with the imageCalculator as in imageCaculator(Divide create 32-bit stack", ... in which case you may not need to run("32-bit") > run("Stack to Images"); Why are you converting to images? Why not divide the entire stack at once? imageCalculator can do that is you at the stack keyword in the command. For example: imageCaculator(Divide create stack", ... > imageCalculator("Divide create", "+prefix+" w3YFP_t1, "+prefix+" > w2CFPexYFPem_t1); Try: imageCalculator("Divide create", prefix + "w3YFP_t1", prefix + "w2CFPexYFPem_t1"); or imageCalculator("Divide create 32-bit stack", prefix + "w3YFP_t1", prefix + "w2CFPexYFPem_t1"); you quoted your variable and left the string unquoted. This is backwards of what you intended. --aryeh > selectWindow("Result of DPI 002 18hpa x4obj Eve Dead_w3YFP_t1"); > > Any advice on how to resolve this would be massively appreciated. Thanks! > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/image-calculator-batch-macro-help-required-tp5017110.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |