Im trying to analyze a series of frames from a video of what is essentially a laser point. I need to be able to analyze the distance between two such points but first I need to find the exact centers of the two points. I also need to be able to determine if the points move at all. for me the simplest way of doing this is by finding the maximum pixel by first blurring the photos to remove any extraneous maxima and then to use the find maxima function and have it output a list. However, whenever i use the built in find maxima process it deletes the previous list of maxima. essentially what i need is a list of the xy values for the maxima all in one list so that i can do a real analysis. I also have the FindMaxima for Stacks Macro but that doesnt have an option to create a list. The macro looks like this:
// Find Stack Maxima // // This macro runs the Process>Binary>Find Maxima // command on all the images in a stack. Dialog.create("Find Maxima"); Dialog.addNumber("Noise Tolerance:", 20); Dialog.addChoice("Output Type:", newArray("Single Points", "Maxima Within Tolerance", "Segmented Particles", "Count")); Dialog.addCheckbox("Exclude Edge Maxima", false); Dialog.addCheckbox("Light Background", false); Dialog.show(); tolerance = Dialog.getNumber(); type = Dialog.getChoice(); exclude = Dialog.getCheckbox(); light = Dialog.getCheckbox(); options = ""; if (exclude) options = options + " exclude"; if (light) options = options + " light"; setBatchMode(true); input = getImageID(); n = nSlices(); for (i=1; i<=n; i++) { showProgress(i, n); selectImage(input); setSlice(i); run("Find Maxima...", "noise="+ tolerance +" output=["+type+"]"+options); if (i==1) output = getImageID(); else if (type!="Count") { run("Select All"); run("Copy"); close(); selectImage(output); run("Add Slice"); run("Paste"); } } run("Select None"); setBatchMode(false); The macro seems to be using an older version of the FindMaxima built in process which was previously a part of the process>binary menu. As such it doesnt have the ability to export a list. I know i can theoretically just go picture by picture and copy and paste the lists but i have hundreds of thousands of frames to go through. Can anyone offer another way to do this analysis or help me fix the Macro so that i can have it output as a list. thanks |
On Jul 2, 2010, at 10:37 AM, marisbest2 wrote:
> Im trying to analyze a series of frames from a video of what is essentially a > laser point. I need to be able to analyze the distance between two such > points but first I need to find the exact centers of the two points. I also > need to be able to determine if the points move at all. for me the simplest > way of doing this is by finding the maximum pixel by first blurring the > photos to remove any extraneous maxima and then to use the find maxima > function and have it output a list. However, whenever i use the built in > find maxima process it deletes the previous list of maxima. essentially what > i need is a list of the xy values for the maxima all in one list so that i > can do a real analysis. I also have the FindMaxima for Stacks Macro but that > doesnt have an option to create a list. The macro looks like this: Here is a macro that uses the Find Maxima command, in "Point Selection" mode, to generate a list (in the Results table) of the XY coordinates of the maxima in each of the images of a stack. tolerance = 20; type = "Point Selection"; excludeEdgeMaxima = false; lightBackground = false; options = ""; if (excludeEdgeMaxima) options = options + " exclude"; if (lightBackground) options = options + " light"; run("Clear Results"); for (n=1; n<=nSlices; n++) { showProgress(n, nSlices); setSlice(n); run("Find Maxima...", "noise=&tolerance output=&type"+options); counter = nResults(); if (selectionType<0) { setResult("px0", counter, -1); setResult("py0", counter, -1); } else { getSelectionCoordinates(x, y); count = x.length; if (count>25) exit("Too many maxima: "+count); for (i=0; i<count; i++) { setResult("px"+i, counter, x[i]); setResult("py"+i, counter, y[i]); } } } updateResults; run("Select None"); -wayne > // Find Stack Maxima > // > // This macro runs the Process>Binary>Find Maxima > // command on all the images in a stack. > > Dialog.create("Find Maxima"); > Dialog.addNumber("Noise Tolerance:", 20); > Dialog.addChoice("Output Type:", newArray("Single Points", "Maxima Within > Tolerance", "Segmented Particles", "Count")); > Dialog.addCheckbox("Exclude Edge Maxima", false); > Dialog.addCheckbox("Light Background", false); > Dialog.show(); > tolerance = Dialog.getNumber(); > type = Dialog.getChoice(); > exclude = Dialog.getCheckbox(); > light = Dialog.getCheckbox(); > options = ""; > if (exclude) options = options + " exclude"; > if (light) options = options + " light"; > setBatchMode(true); > input = getImageID(); > n = nSlices(); > for (i=1; i<=n; i++) { > showProgress(i, n); > selectImage(input); > setSlice(i); > run("Find Maxima...", "noise="+ tolerance +" > output=["+type+"]"+options); > if (i==1) > output = getImageID(); > else if (type!="Count") { > run("Select All"); > run("Copy"); > close(); > selectImage(output); > run("Add Slice"); > run("Paste"); > } > } > run("Select None"); > setBatchMode(false); > > > > The macro seems to be using an older version of the FindMaxima built in > process which was previously a part of the process>binary menu. As such it > doesnt have the ability to export a list. I know i can theoretically just go > picture by picture and copy and paste the lists but i have hundreds of > thousands of frames to go through. Can anyone offer another way to do this > analysis or help me fix the Macro so that i can have it output as a list. > thanks > -- > View this message in context: http://imagej.588099.n2.nabble.com/Find-Maxima-for-Multiple-Images-tp5247964p5247964.html > Sent from the ImageJ mailing list archive at Nabble.com. |
Free forum by Nabble | Edit this page |