using ImageView, TestImages, Colors
# Prepare the data
mri = testimage("mri")
mriseg = RGB.(mri)
mriseg[mri .> 0.5] = colorant"red"
But get the following error when I try to replicate it:
MethodError: no method matching setindex_shape_check(::RGB{Normed{UInt8,8}}, ::Int64)
Closest candidates are:
setindex_shape_check(!Matched::AbstractArray{#s72,1} where #s72, ::Integer) at indices.jl:218
setindex_shape_check(!Matched::AbstractArray{#s72,1} where #s72, ::Integer, !Matched::Integer) at indices.jl:221
setindex_shape_check(!Matched::AbstractArray{#s72,2} where #s72, ::Integer, !Matched::Integer) at indices.jl:225
...
Stacktrace:
[1] macro expansion at .\multidimensional.jl:694 [inlined]
[2] _unsafe_setindex!(::IndexLinear, ::Array{RGB{Normed{UInt8,8}},2}, ::RGB{Normed{UInt8,8}}, ::Base.LogicalIndex{Int64,BitArray{2}}) at .\multidimensional.jl:689
[3] _setindex! at .\multidimensional.jl:684 [inlined]
[4] setindex!(::Array{RGB{Normed{UInt8,8}},2}, ::RGB{Normed{UInt8,8}}, ::BitArray{2}) at .\abstractarray.jl:1020
[5] top-level scope at In[66]:3