1Hist_new_item = class 2 Menuaction "_New Histogram" "make a new histogram" { 3 action = class 4 _result { 5 _vislevel = 3; 6 7 depth = Option "Depth" ["8 bit", "16 bit"] 0; 8 black = Slider 0 100 0; 9 white = Slider 0 100 100; 10 11 shadow_point = Slider 0.1 0.3 0.2; 12 mid_point = Slider 0.4 0.6 0.5; 13 highlight_point = Slider 0.7 0.9 0.8; 14 15 shadow_adjust = Slider (-15) 15 0; 16 mid_adjust = Slider (-30) 30 0; 17 highlight_adjust = Slider (-15) 15 0; 18 19 _result = tone_build fmt 20 black white 21 shadow_point mid_point highlight_point 22 shadow_adjust mid_adjust highlight_adjust 23 { 24 fmt = [Image_format.UCHAR, Image_format.USHORT]?depth; 25 } 26 } 27} 28 29Hist_find_item = class 30 Menupullright "_Find Histogram" "find a histogram" { 31 Oned_item = class 32 Menuaction "_One Dimension" 33 "for a n-band image, make an n-band 1D histogram" { 34 action x = map_unary hist_find x; 35 } 36 37 Nd_item = class 38 Menuaction "_Many Dimensions" 39 "for a n-band image, make an n-dimensional histogram" { 40 action x = class 41 _result { 42 _vislevel = 3; 43 44 // default to something small-ish 45 bins = Expression "Number of bins in each dimension" 8; 46 47 _result 48 = map_unary process x 49 { 50 process in 51 = hist_find_nD bins in; 52 } 53 } 54 } 55} 56 57Hist_map_item = class 58 Menuaction "_Map Histogram" "map an image through a histogram" { 59 action x y 60 = map_binary map x y 61 { 62 map a b 63 = hist_map hist im 64 { 65 args = sortc (const is_hist) [a, b]; 66 im = args?0; 67 hist = args?1; 68 } 69 } 70} 71 72Hist_eq_item = Filter_enhance_item.Hist_equal_item; 73 74#separator 75 76Hist_cum_item = class 77 Menuaction "_Cumulativise Histogram" 78 "form cumulative histogram from frequency histogram" { 79 action x = map_unary hist_cum x; 80} 81 82Hist_norm_item = class 83 Menuaction "N_ormalise Histogram" "normalise a histogram" { 84 action x = map_unary hist_norm x; 85} 86 87Hist_match_item = class 88 Menuaction "Ma_tch Histogram" 89 "find LUT which will match first histogram to second" { 90 action in ref = map_binary hist_match in ref; 91} 92 93#separator 94 95Hist_profile_item = class 96 Menuaction "Find _Profile" 97 "search from image edges for non-zero pixels" { 98 action x = class 99 _result { 100 _vislevel = 3; 101 102 edge = Option "Search from" [ 103 "Top edge down", 104 "Left edge to right", 105 "Bottom edge up", 106 "Right edge to left" 107 ] 2; 108 109 _result 110 = map_unary profile x 111 { 112 profile image 113 = (image_set_type Image_type.HISTOGRAM @ Image) [ 114 im_profile image.value 0, 115 im_profile image.value 1, 116 im_profile (fliptb image.value) 0, 117 im_profile (fliplr image.value) 1 118 ]?edge; 119 } 120 } 121} 122 123Hist_graph_item = class 124 Menuaction "_Slice Image" "slice an image along a guide" { 125 action x 126 = map_unary process x 127 { 128 process guide 129 = image_set_type Image_type.HISTOGRAM slice 130 { 131 slice 132 = extract_area 133 0 guide.top guide.width 1 guide.image, 134 is_HGuide guide 135 = extract_area 136 guide.left 0 1 guide.height guide.image; 137 } 138 } 139} 140