Hi Steve,
there is one problem: You should not use clone() but duplicate().
clone() is just a shallow clone, i.e., all objects of the cloned ImageProcessor are the same as those of the original. So the copy gets the same array of pixels, and modification of the image data will modify the original data.
You won't see that the original got modified, however, until you zoom in or out on the original image, so its display has to be refreshed on the screen.
Maybe that explains your problem?
(You might also duplicate the ImagePlus, then it will inherit the calibration and more properties from the original).
Michael
________________________________________________________________
On Mar 14, 2014, at 11:52, Influenza wrote:
> Hello everyone,
>
> I postede this question a few months ago, but couldn't get any help until
> now and didn't find a similiar thread, so I just try again:
>
> I'm trying to use the BackgroundSubtracter class in a PlugIn without calling
> the IJ.command.
> I tried to do the following:
>
>
> ImagePlus imp = WindowManager.getCurrentImage();
> ImagePlus copy = new
> ImagePlus("title",(ImageProcessor)imp.getProcessor().clone());
> double rad= 10;
> ImageProcessor ip = copy.getProcessor();
>
> BackgroundSubtracter bs =new BackgroundSubtracter();
> bs.rollingBallBackground(ip, rad , false, false, false,
> false, false);
> //bs.run(ip);
> copy.updateAndDraw();
> copy.show();
>
> But equal to whether I use the .run() or the .rolingBallbackground() method,
> both outcoming images are just plain black.
> Can anyone help me wiht the correct use, or find my mistake?
>
> Best regards
> Steve
>
>
>
> --
> View this message in context:
http://imagej.1557.x6.nabble.com/Background-Subtractor-makes-Image-black-tp5006912.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