Hi all
I have a plugin that iterates in a while loop until convergence occurs and I'd like to monitor the values graphically. I can draw a Plot of the values once the while loop has finished, but if I try to redraw the plot with multiple calls to my graphResults() method I get a rather large number of Plot windows. How can I update a plot window with new data? I'm collecting the Y data in a Vector (because I can add values to it in the while loop). My plotting method is as follows: private void graphResults(Vector<Double> anisotropyHistory){ double[] yVariables = new double[anisotropyHistory.size()]; double[] xVariables = new double[anisotropyHistory.size()]; Enumeration<Double> e = anisotropyHistory.elements(); int i = 0; while (e.hasMoreElements()){ yVariables[i] = e.nextElement(); xVariables[i] = (double)i; i++; } Plot plot = new Plot("Anisotropy", "Number of repeats", "Anisotropy", xVariables, yVariables); plot.addPoints(xVariables, yVariables, Plot.X); plot.setLimits(0, anisotropyHistory.size(), 0, 1); plot.show(); } Michael |
Hi Michael,
instead of plot.show() you can use plot.getProcessor(); and then in the corresponding ImagePlus (which must exist already) update the image: plotImagePlus.setProcessor(null, ip); The Dynamic Profiler is an example for this: http://rsbweb.nih.gov/ij/plugins/dynamic-profiler.html Michael ________________________________________________________________ On 18 Aug 2009, at 18:36, Michael Doube wrote: > Hi all > > I have a plugin that iterates in a while loop until convergence > occurs and I'd like to monitor the values graphically. I can draw > a Plot of the values once the while loop has finished, but if I try > to redraw the plot with multiple calls to my graphResults() method > I get a rather large number of Plot windows. > > How can I update a plot window with new data? I'm collecting the Y > data in a Vector (because I can add values to it in the while > loop). My plotting method is as follows: > > > private void graphResults(Vector<Double> anisotropyHistory){ > double[] yVariables = new double[anisotropyHistory.size()]; > double[] xVariables = new double[anisotropyHistory.size()]; > Enumeration<Double> e = anisotropyHistory.elements(); > int i = 0; > while (e.hasMoreElements()){ > yVariables[i] = e.nextElement(); > xVariables[i] = (double)i; > i++; > } > Plot plot = new Plot("Anisotropy", "Number of repeats", "Anisotropy", > xVariables, yVariables); > plot.addPoints(xVariables, yVariables, Plot.X); > plot.setLimits(0, anisotropyHistory.size(), 0, 1); > plot.show(); > } > > > Michael |
Michael,
I just tried the The Dynamic Profiler. Its works as described when you move the profile. But, when I use Process/Smooth, Sharpen, or Find Edges, the profile selection (I used a line) disappears and the profile plot doesn't change. David Webster On Tue, Aug 18, 2009 at 10:00 AM, Michael Schmid <[hidden email]>wrote: > Hi Michael, > > instead of > plot.show() > you can use > plot.getProcessor(); > and then in the corresponding ImagePlus (which must exist already) update > the image: > plotImagePlus.setProcessor(null, ip); > > The Dynamic Profiler is an example for this: > http://rsbweb.nih.gov/ij/plugins/dynamic-profiler.html > > Michael > ________________________________________________________________ > > On 18 Aug 2009, at 18:36, Michael Doube wrote: > > Hi all >> >> I have a plugin that iterates in a while loop until convergence occurs and >> I'd like to monitor the values graphically. I can draw a Plot of the values >> once the while loop has finished, but if I try to redraw the plot with >> multiple calls to my graphResults() method I get a rather large number of >> Plot windows. >> >> How can I update a plot window with new data? I'm collecting the Y data >> in a Vector (because I can add values to it in the while loop). My plotting >> method is as follows: >> >> >> private void graphResults(Vector<Double> anisotropyHistory){ >> double[] yVariables = new double[anisotropyHistory.size()]; >> double[] xVariables = new double[anisotropyHistory.size()]; >> Enumeration<Double> e = anisotropyHistory.elements(); >> int i = 0; >> while (e.hasMoreElements()){ >> yVariables[i] = e.nextElement(); >> xVariables[i] = (double)i; >> i++; >> } >> Plot plot = new Plot("Anisotropy", "Number of repeats", >> "Anisotropy", >> xVariables, yVariables); >> plot.addPoints(xVariables, yVariables, Plot.X); >> plot.setLimits(0, anisotropyHistory.size(), 0, 1); >> plot.show(); >> } >> >> >> Michael >> > |
On Aug 18, 2009, at 3:14 PM, David Webster wrote:
> Michael, > > I just tried the The Dynamic Profiler. Its works as described when > you move > the profile. But, when I use Process/Smooth, Sharpen, or Find Edges, > the > profile selection (I used a line) disappears and the profile plot > doesn't > change. > > David Webster There is an updated Dynamic Profiler at http://rsb.info.nih.gov/ij/plugins/dynamic-profiler.html that fixes this bug. -wayne > > On Tue, Aug 18, 2009 at 10:00 AM, Michael Schmid <[hidden email] > >wrote: > >> Hi Michael, >> >> instead of >> plot.show() >> you can use >> plot.getProcessor(); >> and then in the corresponding ImagePlus (which must exist already) >> update >> the image: >> plotImagePlus.setProcessor(null, ip); >> >> The Dynamic Profiler is an example for this: >> http://rsbweb.nih.gov/ij/plugins/dynamic-profiler.html >> >> Michael >> ________________________________________________________________ >> >> On 18 Aug 2009, at 18:36, Michael Doube wrote: >> >> Hi all >>> >>> I have a plugin that iterates in a while loop until convergence >>> occurs and >>> I'd like to monitor the values graphically. I can draw a Plot of >>> the values >>> once the while loop has finished, but if I try to redraw the plot >>> with >>> multiple calls to my graphResults() method I get a rather large >>> number of >>> Plot windows. >>> >>> How can I update a plot window with new data? I'm collecting the >>> Y data >>> in a Vector (because I can add values to it in the while loop). >>> My plotting >>> method is as follows: >>> >>> >>> private void graphResults(Vector<Double> anisotropyHistory){ >>> double[] yVariables = new double[anisotropyHistory.size()]; >>> double[] xVariables = new double[anisotropyHistory.size()]; >>> Enumeration<Double> e = anisotropyHistory.elements(); >>> int i = 0; >>> while (e.hasMoreElements()){ >>> yVariables[i] = e.nextElement(); >>> xVariables[i] = (double)i; >>> i++; >>> } >>> Plot plot = new Plot("Anisotropy", "Number of repeats", >>> "Anisotropy", >>> xVariables, yVariables); >>> plot.addPoints(xVariables, yVariables, Plot.X); >>> plot.setLimits(0, anisotropyHistory.size(), 0, 1); >>> plot.show(); >>> } >>> >>> >>> Michael >>> >> |
Thanks Wayne!
On Tue, Aug 18, 2009 at 7:19 PM, Wayne Rasband <[hidden email]> wrote: > On Aug 18, 2009, at 3:14 PM, David Webster wrote: > > Michael, >> >> I just tried the The Dynamic Profiler. Its works as described when you >> move >> the profile. But, when I use Process/Smooth, Sharpen, or Find Edges, the >> profile selection (I used a line) disappears and the profile plot doesn't >> change. >> >> David Webster >> > > There is an updated Dynamic Profiler at > > http://rsb.info.nih.gov/ij/plugins/dynamic-profiler.html > > that fixes this bug. > > -wayne > > > > >> On Tue, Aug 18, 2009 at 10:00 AM, Michael Schmid <[hidden email] >> >wrote: >> >> Hi Michael, >>> >>> instead of >>> plot.show() >>> you can use >>> plot.getProcessor(); >>> and then in the corresponding ImagePlus (which must exist already) update >>> the image: >>> plotImagePlus.setProcessor(null, ip); >>> >>> The Dynamic Profiler is an example for this: >>> http://rsbweb.nih.gov/ij/plugins/dynamic-profiler.html >>> >>> Michael >>> ________________________________________________________________ >>> >>> On 18 Aug 2009, at 18:36, Michael Doube wrote: >>> >>> Hi all >>> >>>> >>>> I have a plugin that iterates in a while loop until convergence occurs >>>> and >>>> I'd like to monitor the values graphically. I can draw a Plot of the >>>> values >>>> once the while loop has finished, but if I try to redraw the plot with >>>> multiple calls to my graphResults() method I get a rather large number >>>> of >>>> Plot windows. >>>> >>>> How can I update a plot window with new data? I'm collecting the Y data >>>> in a Vector (because I can add values to it in the while loop). My >>>> plotting >>>> method is as follows: >>>> >>>> >>>> private void graphResults(Vector<Double> anisotropyHistory){ >>>> double[] yVariables = new double[anisotropyHistory.size()]; >>>> double[] xVariables = new double[anisotropyHistory.size()]; >>>> Enumeration<Double> e = anisotropyHistory.elements(); >>>> int i = 0; >>>> while (e.hasMoreElements()){ >>>> yVariables[i] = e.nextElement(); >>>> xVariables[i] = (double)i; >>>> i++; >>>> } >>>> Plot plot = new Plot("Anisotropy", "Number of repeats", >>>> "Anisotropy", >>>> xVariables, yVariables); >>>> plot.addPoints(xVariables, yVariables, Plot.X); >>>> plot.setLimits(0, anisotropyHistory.size(), 0, 1); >>>> plot.show(); >>>> } >>>> >>>> >>>> Michael >>>> >>>> >>> |
In reply to this post by Michael Schmid
Hi Michael,
Thanks for the hint, it works really well! Michael Michael Schmid wrote: > Hi Michael, > > instead of > plot.show() > you can use > plot.getProcessor(); > and then in the corresponding ImagePlus (which must exist already) > update the image: > plotImagePlus.setProcessor(null, ip); > > The Dynamic Profiler is an example for this: > http://rsbweb.nih.gov/ij/plugins/dynamic-profiler.html > > Michael > ________________________________________________________________ > On 18 Aug 2009, at 18:36, Michael Doube wrote: > >> Hi all >> >> I have a plugin that iterates in a while loop until convergence >> occurs and I'd like to monitor the values graphically. I can draw >> a Plot of the values once the while loop has finished, but if I try >> to redraw the plot with multiple calls to my graphResults() method >> I get a rather large number of Plot windows. >> >> How can I update a plot window with new data? I'm collecting the Y >> data in a Vector (because I can add values to it in the while >> loop). My plotting method is as follows: >> >> >> private void graphResults(Vector<Double> anisotropyHistory){ >> double[] yVariables = new double[anisotropyHistory.size()]; >> double[] xVariables = new double[anisotropyHistory.size()]; >> Enumeration<Double> e = anisotropyHistory.elements(); >> int i = 0; >> while (e.hasMoreElements()){ >> yVariables[i] = e.nextElement(); >> xVariables[i] = (double)i; >> i++; >> } >> Plot plot = new Plot("Anisotropy", "Number of repeats", "Anisotropy", >> xVariables, yVariables); >> plot.addPoints(xVariables, yVariables, Plot.X); >> plot.setLimits(0, anisotropyHistory.size(), 0, 1); >> plot.show(); >> } >> >> >> Michael |
In reply to this post by David Webster
Dear all,
the macro function File.name used to return the file name without the directory before the name. This appears to have changed with the newest release. I know that it is possible to work around this issue in a macro, however, I suppose it is much easier the other way around, namely to add the directory whenever needed... Thanks Johannes ________________________________________ Johannes-P. KOCH University of Vienna, MFPL Department of Biochemistry and Cell Biology Dr. Bohrgasse 9/5 A-1030 Vienna Austria phone: 00431427752809 fax: 0043142779528 mail to: [hidden email] -- Ich verwende die kostenlose Version von SPAMfighter für private Anwender, die bei mir bis jetzt 802 Spammails entfernt hat. Rund 6 Millionen Leute nutzen SPAMfighter schon. Laden Sie SPAMfighter kostenlos herunter: http://www.spamfighter.com/lde |
On Aug 19, 2009, at 10:46 AM, Johannes-P. KOCH wrote:
> Dear all, > > the macro function File.name used to return the file name without the > directory before the name. This appears to have changed with the > newest release. I know that it is possible to work around this issue > in a macro, however, I suppose it is much easier the other way around, > namely to add the directory whenever needed... This bug is fixed in the 1.43f daily build. It only occurred on Windows and only after using the open(path) macro function. -wayne ImageJ.jpg (19K) Download Attachment |
Free forum by Nabble | Edit this page |