@@ -6,23 +6,23 @@ using ImageSegmentation
66using ImageView
77using Random
88
9- function colorize (seg, segidxs:: AbstractSet{Int} , color:: Colorant )
10- label = seg. image_indexmap
11- img = similar (label, promote_type (typeof (color), valtype (seg. segment_means)))
12- fill! (img, zero (eltype (img)))
13- for idx in eachindex (label)
14- label[idx] ∈ segidxs || continue
15- img[idx] = color
16- end
17- return img
18- end
9+ # function colorize(seg, segidxs::AbstractSet{Int}, color::Colorant)
10+ # label = seg.image_indexmap
11+ # img = similar(label, promote_type(typeof(color), valtype(seg.segment_means)))
12+ # fill!(img, zero(eltype(img)))
13+ # for idx in eachindex(label)
14+ # label[idx] ∈ segidxs || continue
15+ # img[idx] = color
16+ # end
17+ # return img
18+ # end
1919
2020function linkpair (img, imgc)
21- gd = imshow (img)
22- zr = gd[ " roi " ][ " zoomregion " ]
23- slicedata = gd[" roi " ][" slicedata " ]
24- gdc = imshow (imgc, nothing , zr, slicedata)
25- return (gd, gdc)
21+ zr, slicedata = roi (img)
22+ gd = imshow_gui (( 800 , 800 ), ( 2 , 1 ); slicedata = slicedata)
23+ imshow ( gd[" frame " ][1 , 1 ], gd[ " canvas " ][ 1 , 1 ], img, nothing , zr, slicedata)
24+ imshow (gd[ " frame " ][ 2 , 1 ], gd[ " canvas " ][ 2 , 1 ], imgc, nothing , zr, slicedata)
25+ return gd
2626end
2727
2828# For visualization
3434CounterMarking. randshow (seg; kwargs... ) = imshow (map (i-> get_random_color (i), labels_map (seg)); kwargs... )
3535CounterMarking. meanshow (seg; kwargs... ) = imshow (map (i-> segment_mean (seg, i), labels_map (seg)); kwargs... )
3636
37+ CounterMarking. randshow (img, seg; kwargs... ) = linkpair (img, map (i-> get_random_color (i), labels_map (seg)); kwargs... )
38+ CounterMarking. meanshow (img, seg; kwargs... ) = linkpair (img, map (i-> segment_mean (seg, i), labels_map (seg)); kwargs... )
39+
3740end
0 commit comments