// Sept 25 2006 //T.J.Collins, MacBiophotonics, McMaster University, Hamilton, Canada.' //www.macbiophotonics.ca //Calculates the mean intensity of the input image using the area outside the //input objects list. This value is then subtracted from the whole image //and a new image (BGCimage) is output along with the mean background value value //errors corrected by Dr. Karsten Kottig,Evotec Technologies GmbH,Schnackenburgallee 114, //D-22525 Hamburg,Germany //package(McMaster) // having namespace package in Acapella 2.0, remove for Acapella 1.0 Proc MBF_Background_Subtraction( image origImage in "Original image to be BG corrected", cells objects in "Foreground area objects", //output image BGCimage out "Background Corrected image", double meanBG out "Background value that has been subrtacted from input image", ) { set(BGmask=!objects.body.mask) maskmeanintensity(image=origImage, mask=BGmask) set(meanBG=MaskMeanIntensity) minus(origImage, meanBG, neg_method = "zero") rename(BGCimage = result) } Proc MBF_Rollingball( image im_cur=image in "Original image to be BG corrected", int resizefactor=4 in "Original image is resized by this factor, before BG subtraction - positive integer", int ballradius=15 in "radius of the ball in rolling ball algorithm", //output image BGCimage out "Background Corrected image", image BGimage out "Background image that has been subrtacted from input image" ) "Performs a rolling ball background subtraction from the image" { resize(1/resizefactor, image=im_cur, yfactor=1/resizefactor) eros(edge=ballradius) resize(resizefactor, image=image, yfactor=resizefactor) set(backval = image.mean) set(xslip = (im_cur.width - image.width)/2) set(yslip = (im_cur.height - image.height)/2) redimension(im_cur.width, im_cur.height, xslip, yslip, backval, image=image, BackgroundMethod="mirror") set(BGimage = image) minus(im_cur, BGimage, neg_method="zero") set(BGCimage=result) //set(image=im_cur-BGimage ) //minus(image, 0, neg_method="zero"|BGCimage=result) }