ROI and IJ.run()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ROI and IJ.run()

Eddie Iannuccelli
Hello,
my plugin use a Wand method in order to get particles ROI for further
processing . Some of these processing are done using IJ.run () calls,
but it does not seem to be effective in results. Here is my code :

// ipProcess is my source ImageProcessor containing particles
// impProcess is my source ImagePlus containing particles
// x and y are coordinate of my first particle

WindowManager.setTempCurrentImage(impProcess);  //show nothing
Wand myWand = new Wand(ipProcess);  
myWand.autoOutline((int)x,(int)y);
PolygonRoi myROI= new PolygonRoi(myWand.xpoints,
myWand.ypoints,myWand.npoints, Roi.TRACED_ROI);          
impProcess.setRoi(myROI);
IJ.run("Convex Hull");                          --> do nothing  !
IJ.run("Enlarge...", "enlarge=100");       --> do nothing  !

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: ROI and IJ.run()

dscho
Hi,

On Thu, 30 Nov 2006, Eddie Iannuccelli wrote:

> WindowManager.setTempCurrentImage(impProcess);  //show nothing
> Wand myWand = new Wand(ipProcess);   myWand.autoOutline((int)x,(int)y);
> PolygonRoi myROI= new PolygonRoi(myWand.xpoints,
> myWand.ypoints,myWand.npoints, Roi.TRACED_ROI);
> impProcess.setRoi(myROI);
> IJ.run("Convex Hull");                          --> do nothing  !
> IJ.run("Enlarge...", "enlarge=100");       --> do nothing  !

I suspect that you need to call impProcess.updateAndDraw() after
IJ.run(...).

Hth,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: ROI and IJ.run()

Eddie Iannuccelli
Thanks for your response,

impProcess.updateAndDraw() still do nothing .... but if I show
impProcess instead of masking it  (by replacing
WindowManager.setTempCurrentImage(impProcess)  by impProcess.show() at
the first line),  it's fine !
My processing become a bit "verbose" but it does the job, I am still
interested for a silent solution ...
Thanks


Johannes Schindelin a écrit :

> Hi,
>
> On Thu, 30 Nov 2006, Eddie Iannuccelli wrote:
>
>  
>> WindowManager.setTempCurrentImage(impProcess);  //show nothing
>> Wand myWand = new Wand(ipProcess);   myWand.autoOutline((int)x,(int)y);
>> PolygonRoi myROI= new PolygonRoi(myWand.xpoints,
>> myWand.ypoints,myWand.npoints, Roi.TRACED_ROI);
>> impProcess.setRoi(myROI);
>> IJ.run("Convex Hull");                          --> do nothing  !
>> IJ.run("Enlarge...", "enlarge=100");       --> do nothing  !
>>    
>
> I suspect that you need to call impProcess.updateAndDraw() after
> IJ.run(...).
>
> Hth,
> Dscho
>
>  
Reply | Threaded
Open this post in threaded view
|

Re: ROI and IJ.run()

Eddie Iannuccelli
In reply to this post by Eddie Iannuccelli
Wayne,
you are right  but it still does not "Convex Hull" or "enlarge" my roi
when using setTempCurrentImage. Everything is ok when ImagePlus is shown .
Here is there new snippet (ipProcess is impProcess imageProcessor):

                WindowManager.setTempCurrentImage(impProcess);
                //impProcess.show();
                IJ.doWand((int)x,(int)y);
                IJ.run("Convex Hull");
                IJ.run("Enlarge...", "enlarge=" + EXTENSION);
                PolygonRoi myROI= (PolygonRoi)
impProcess.getRoi();            
                ipProcess.setValue(128);
                ipProcess.fillPolygon(myROI.getPolygon());  
                ipMask=impProcess.getMask();
                ...        

Thanks


Rasband, Wayne (NIH/NIMH) [E] a écrit :

>> Hello,
>> my plugin use a Wand method in order to get particles ROI for further processing .
>> Some of these processing are done using IJ.run () calls, but it does not seem to be
>> effective in results. Here is my code :
>>    
>
>  
>> // ipProcess is my source ImageProcessor containing particles
>> // impProcess is my source ImagePlus containing particles
>> // x and y are coordinate of my first particle
>>    
>
>  
>> WindowManager.setTempCurrentImage(impProcess);  //show nothing
>> Wand myWand = new Wand(ipProcess);   myWand.autoOutline((int)x,(int)y);
>> PolygonRoi myROI= new PolygonRoi(myWand.xpoints, myWand.ypoints,myWand.npoints, Roi.TRACED_ROI);
>> impProcess.setRoi(myROI);
>> IJ.run("Convex Hull");                          --> do nothing  !
>> IJ.run("Enlarge...", "enlarge=100");       --> do nothing  !
>>    
>
> This code seems to work okay and is simpler and easier to understand.
>
>    IJ.doWand(x, y);
>    IJ.run("Convex Hull");
>    IJ.run("Enlarge...", "enlarge=100");
>
> -wayne
>