-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error with reinterpret when setting a scale #232
Comments
The argument you supply to |
Ah, thanks for that tip. I was always thinking of the However, I still seem to have the same problem here. I get an error with julia> using Images, ImageView, Color, FixedPointNumbers
julia> img = imread("BZ363A\ 1\ redgreen.tif")
Gray Image with:
data: 512x512x583 Array{Gray{UfixedBase{Uint16,16}},3}
properties:
timedim: 3
imagedescription: <suppressed>
spatialorder: x y
pixelspacing: 1 1
julia> img["scalei"] = ScaleMinMax(RGB24, 0.0, 0.05)
ScaleMinMax{RGB24,Float64,Float32}(0.0,0.05,20.0f0)
julia> view(img)
...works...
mapi => ScaleMinMax{RGB24,Float64,Float32}(0.0,0.05,20.0f0)
img => Gray Image with:
data: 512x512 SubArray{Gray{UfixedBase{Uint16,16}},2,Array{Gray{UfixedBase{Uint16,16}},3},(UnitRange{Int64},UnitRange{Int64},Int64)}
properties:
timedim: 0
scalei: ScaleMinMax{RGB24,Float64,Float32}(0.0,0.05,20.0f0)
imagedescription: <suppressed>
spatialorder: x y
pixelspacing: 1 1
(ImageCanvas,ImageSlice2d: zoom = BoundingBox(0.0,512.0,0.0,512.0), t = 1)
julia> img["scalei"] = ScaleAutoMinMax(RGB24)
ScaleAutoMinMax{RGB24}()
julia> view(img)
...fails...
mapi => ScaleAutoMinMax{RGB24}()
img => Gray Image with:
data: 512x512 SubArray{Gray{UfixedBase{Uint16,16}},2,Array{Gray{UfixedBase{Uint16,16}},3},(UnitRange{Int64},UnitRange{Int64},Int64)}
properties:
timedim: 0
scalei: ScaleAutoMinMax{RGB24}()
imagedescription: <suppressed>
spatialorder: x y
pixelspacing: 1 1
ERROR: reinterpret: expected bits type as first argument
in map! at /Users/rrock/.julia/v0.3/Images/src/map.jl:338
in uint32color! at /Users/rrock/.julia/v0.3/Images/src/map.jl:478
in anonymous at /Users/rrock/.julia/v0.3/ImageView/src/display.jl:317
in rerender at /Users/rrock/.julia/v0.3/ImageView/src/display.jl:689
in view at /Users/rrock/.julia/v0.3/ImageView/src/display.jl:327 |
I guess the real trouble is that I don't know where |
Yes, Regarding your error, that's quite puzzling. I don't have that particular file, but: julia> using Images, Color, FixedPointNumbers, ImageView
julia> img = grayim(rand(Uint16, 5,5,5))
Gray Image with:
data: 5x5x5 Array{UfixedBase{Uint16,16},3}
properties:
colorspace: Gray
spatialorder: x y z
julia> map(ScaleAutoMinMax(RGB24), img)
RGB24 Image with:
data: 5x5x5 Array{RGB24,3}
properties:
colorspace: Gray
spatialorder: x y z
julia> img["scalei"] = ScaleAutoMinMax(RGB24)
ScaleAutoMinMax{RGB24}()
julia> view(img)
(ImageCanvas,ImageSlice2d: zoom = BoundingBox(0.0,5.0,0.0,5.0), z = 1) works for me. Try showing |
Your test worked for me. Now I think I have a way for you to reproduce this. It does seem to need ImageView, because the final julia> using Images, Color, FixedPointNumbers, ImageView
julia> img = Image(reinterpret(Gray{Ufixed16}, rand(Uint16, 5, 5)))
Gray Image with:
data: 5x5 Array{Gray{UfixedBase{Uint16,16}},2}
properties:
julia> img["spatialorder"] = ["x", "y"]
2-element Array{ASCIIString,1}:
"x"
"y"
julia> img["scalei"] = ScaleAutoMinMax(RGB24)
ScaleAutoMinMax{RGB24}()
julia> view(img)
ERROR: reinterpret: expected bits type as first argument
in map! at /Users/rrock/.julia/v0.3/Images/src/map.jl:336
in uint32color! at /Users/rrock/.julia/v0.3/Images/src/map.jl:477
in anonymous at /Users/rrock/.julia/v0.3/ImageView/src/display.jl:317
in rerender at /Users/rrock/.julia/v0.3/ImageView/src/display.jl:689
in view at /Users/rrock/.julia/v0.3/ImageView/src/display.jl:327
julia> map(ScaleAutoMinMax(RGB24), img)
mi => ScaleMinMax{RGB24,Gray{UfixedBase{Uint16,16}},Float32}(Gray{Ufixed16}(0.1293),Gray{Ufixed16}(0.96741),1.1931725f0)
RGB24 Image with:
data: 5x5 Array{RGB24,2}
properties:
scalei: ScaleAutoMinMax{RGB24}()
spatialorder: x y |
P.S. I'll have to play around with those other uses of |
Sorry this took so long. It was drattedly subtle. The call chain turned out to be ImageView creates a SubArray (to handle zoom regions), which was the final ingredient to the puzzle. My main trick was to insert |
Thanks! Works great again. I did make it all the way to I also remember seeing that the |
Glad it's working. You may have also noted that this inspired JuliaLang/julia#9354 I haven't seen errors from |
I have an image where I can display it just fine, but when I attempt to assign a scale (
ScaleAutoMinMax(Ufixed16)
), I run into problems. The error seems to be inmap.jl
:339, throughtake()
at line 347, and up intoScaleMinMax
around line 161, but I lose track of things at that point. Here's a working example, followed by the scaling and the error:This also happens when I take a slice of this image stack, and apply the scaling to the slice.
Any ideas where to go from here?
The text was updated successfully, but these errors were encountered: