Login  Register

Re: Reset variables ?

Posted by Krs5 on Apr 24, 2017; 7:32am
URL: http://imagej.273.s1.nabble.com/Reset-variables-tp5018587p5018597.html

Dear LP,

Not sure what the problem is but if I replace " with " the macro runs fine.

Kees

-----Original Message-----
From: LP [mailto:[hidden email]]
Sent: 21 April 2017 20:27
To: [hidden email]
Subject: Reset variables ?

Dear ImageJ community,

I'm writing a macro where I create multiple ROIs based on a threshold and then I want to select them all and combine them. And repeat this on multiple frames.

But unfortunately my macro only works for the first frame and then it says "
Invalid index: 0 in line 12. roiManager("select" ,array <)>; "

Maybe I should reset the array variable ? But I didn't manage to do it...

So far I have the following:
___________________________________________
Stack.getDimensions(width,height,channels,slices,frames);
for (t=1; t<=frames; t++) {
                setAutoThreshold("Yen dark");
                run("Analyze Particles...", "size=4-Infinity exclude add slice"); //Creates multiple ROIS

                                array=newArray("0"); //in order to be able to select all the ROIS
                                for (i=1;i<roiManager(&quot;count&quot;);i++){
                                                array=Array.concat(array,i);
                                                }
                                               
                roiManager(&quot;select&quot;,array); // selects all the ROIS
                roiManager(&quot;Combine&quot;); // Combines all the ROIS
                roiManager(&quot;Add&quot;);
               
                m = roiManager(&quot;count&quot;);
                roiManager(&quot;Select&quot;, m-1 ); // selects the last ROI
               
                roiManager(&quot;Measure&quot;); // measures the newly created ROI
                roiManager(&quot;Deselect&quot;);
                roiManager(&quot;Delete&quot;);
               
                run(&quot;Next Slice [>]");
                }
__________________________________________

Any suggestion and help will be very appreciated.
Thank you very much for your help in advance, LP




--
View this message in context: http://imagej.1557.x6.nabble.com/Reset-variables-tp5018587.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