Hi list,
I am not sure if the first message got through so I'm sending this again. Is there a way to delete a row with a certain label from the results label? Something like IJ.deleterow() but with a string label instead of the number of the row? Iam looking around but I can't find any funcion that does the trick. Thanks a lot, Nikolaos -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On 2012.10.20, at 21:24 , Nikolaos Michelarakis wrote:
> > Is there a way to delete a row with a certain label from the results label? Something like IJ.deleterow() but with a string label instead of the number of the row? You can use it together with the getResultLabel macro function. Something like: // --------- label = getString("Delete rows containing:", ""); all = getBoolean("Delete all rows?\n(Choose No to delete only 1st occurrence)"); deleteChosenRows(label, all); function deleteChosenRows(string, recursive) { for (i=0; i<nResults; i++) { l = getResultLabel(i); if (indexOf(l, string)!=-1) { IJ.deleteRows(i, i); if (recursive) deleteChosenRows(string, true); else return; } } } // --------- Hope that helps, -tiago -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Thanks a lot, that¨s what I was looking for!
Nick ----- Message from [hidden email] --------- Date: Sun, 21 Oct 2012 02:44:54 -0400 From: Tiago Ferreira <[hidden email]> Reply-To: [hidden email] Subject: Re: Delete labelled rows from the results table To: [hidden email] > On 2012.10.20, at 21:24 , Nikolaos Michelarakis wrote: >> >> Is there a way to delete a row with a certain label from the >> results label? Something like IJ.deleterow() but with a string >> label instead of the number of the row? > > You can use it together with the getResultLabel macro function. > Something like: > > // --------- > label = getString("Delete rows containing:", ""); > all = getBoolean("Delete all rows?\n(Choose No to delete only 1st > occurrence)"); > > deleteChosenRows(label, all); > > function deleteChosenRows(string, recursive) { > for (i=0; i<nResults; i++) { > l = getResultLabel(i); > if (indexOf(l, string)!=-1) { > IJ.deleteRows(i, i); > if (recursive) > deleteChosenRows(string, true); > else > return; > } > } > } > > // --------- > Hope that helps, > -tiago > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > ----- End message from [hidden email] ----- -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Tiago Ferreira-2
Hello again,
I have been using this function for a while now and I just noticed that when there is a large number of results in the table it will give an error, saying stack overflow. I tried to change a few thing to solve it but I am quite novice and didn't manage to do anything. Any ideas what might be wrong and how to fix it? Thanks a lot Nick ----- Message from [hidden email] --------- Date: Sun, 21 Oct 2012 02:44:54 -0400 From: Tiago Ferreira <[hidden email]> Reply-To: [hidden email] Subject: Re: Delete labelled rows from the results table To: [hidden email] > On 2012.10.20, at 21:24 , Nikolaos Michelarakis wrote: >> >> Is there a way to delete a row with a certain label from the >> results label? Something like IJ.deleterow() but with a string >> label instead of the number of the row? > > You can use it together with the getResultLabel macro function. > Something like: > > // --------- > label = getString("Delete rows containing:", ""); > all = getBoolean("Delete all rows?\n(Choose No to delete only 1st > occurrence)"); > > deleteChosenRows(label, all); > > function deleteChosenRows(string, recursive) { > for (i=0; i<nResults; i++) { > l = getResultLabel(i); > if (indexOf(l, string)!=-1) { > IJ.deleteRows(i, i); > if (recursive) > deleteChosenRows(string, true); > else > return; > } > } > } > > // --------- > Hope that helps, > -tiago > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > ----- End message from [hidden email] ----- -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |