run("pip") ip1_orig = load_image("{data}/img/img1.png") ip1 = ip1_orig.duplicate() #Decomposing color channels ip1.show() create_stack([get_channel(ip1, "red"), get_channel(ip1, "green"), get_channel(ip1, "blue"), get_channel(ip1, "alpha"), grayscale(get_channel(ip1, "brightness"), False)]).show() ip2 = ip1_orig.duplicate() grayscale(ip2) r,g,b = [],[],[] for i in range(256): r.append(0) g.append(0) b.append(i) set_lut(ip2, r, g, b) ip2.show() """ #gaussian_blur(ip1) #invert(ip1) #smooth(ip1) #sharpen(ip1) #edge(ip1) #add(ip1) #noise(ip1, 100) plot(get_histogram(ip1)) #plot(get_array(ip1)) #plot(get_line(ip1, 0,0, 100,100)) #plot(get_pixels(ip1)) #plot (get_col(ip1,1)) print get_pixel_range(ip1) print get_num_channels(ip1) print get_pixel(ip1,0,0) print get_pixel_array(ip1,0,0) stats = get_statistics(ip1) print stats s2 = get_statistics(ip1,Measurements.CENTER_OF_MASS | Measurements.CENTROID ) print s2 print s2.xCenterOfMass, s2.yCenterOfMass print s2.xCentroid , s2.yCentroid #pr1.subtract(80) #pr1.setMinAndMax(20,80) #pr1.rotate(20) """ ip1_orig = load_image("{data}/img/img1.png") ip1_grayscale = ip1_orig.duplicate() grayscale(ip1_grayscale) pr1 = ip1_grayscale.getProcessor() #ip1 = threshold(ip1, 150, 255) #auto_threshold(ip1) #pr1.dilate() #pr1.erode() """ #print pr1.getAutoThreshold() pr1.resetBinaryThreshold() pr1.setAutoThreshold(ImageProcessor.ISODATA2, ImageProcessor.NO_LUT_UPDATE) #pr1.setAutoThreshold(AutoThresholder.getMethods()[0], True , ImageProcessor.NO_LUT_UPDATE); minThreshold = pr1.getMinThreshold(); maxThreshold = pr1.getMaxThreshold(); pr1.resetThreshold() #pr1.threshold(80) fcolor=255 bcolor=0 lut = [] for i in range(256): if minThreshold <= i <=maxThreshold: lut.append(fcolor) else: lut.append(bcolor) pr1.applyTable(lut); #pr1.autoThreshold() #pr1.setBinaryThreshold() min_threshold, max_threshold = 50, 200 pr1.setThreshold(min_threshold, max_threshold, ImageProcessor.NO_LUT_UPDATE); WindowManager.setTempCurrentImage(ip1); thresholder=Thresholder(); thresholder.run("mask"); bp = WindowManager.getCurrentImage().getProcessor(); ip1 = ImagePlus(ip1.getTitle() + " binary", bp); """ #shadows(ip1_grayscale, "north") #voronoi(ip1_grayscale) #ip1_grayscale.show()