On Thursday, November 12, 2015 12:15:46 PM Tobias Knopp wrote:
> Thanks Tim, I tried to look into the code of Overlay but it wasn't to clear
> to me. In particular I am missing where the RGB(A) data is combined.

Here: 
https://github.com/timholy/Images.jl/blob/cac28026250814f6ae6594dd26e927076177db60/src/overlays.jl#L60-L67

> Is it
> really as simple as adding the individual RGB values and preventing
> overflow by clamp?

Yes.

> Or is there some infrastructure for color mixing in Colors.jl

There is, but it's considerably slower. See the ColorVectorSpace.jl README for 
discussion.

> I further looked for functions for gray value mapping (Contrast/Brightness)
> in Colors.jl but could not find anything. This is of course not complicated
> to code but I don't want to miss an existing solution.

The whole "MapInfo" structure is a very flexible and powerful. Search for it on 
this page:
http://timholy.github.io/Images.jl/function_reference.html
>From my standpoint, the best feature is that it's "lazy": you specify the 
transformation you want, but don't execute it until you need it. For people 
like me who routinely browse 1TB images but probably look at <1% of the raw 
data in any given dataset (and who also don't have 1TB worth of RAM...), this 
is quite an advantage.

In my own work, I pretty routinely design custom MapInfo types/map functions 
for visualization purposes. For example, I can color individual blobs in each 
frame of a movie with something along the lines of

immutable ColorizeBlobs
    blobpixels::Vector   # of length nblobs
    blobcolors::Vector{RGB{U8}}  # color assigned to each blob
end

and passing that to ImageView using the "scalei" keyword argument (a legacy of 
the days when this was called ScaleInfo rather than MapInfo). It's a nice way 
of getting custom visualization while leaving all the stupid zoom & navigation 
functionality up to ImageView.

--Tim

> 
> Tobi
> 
> Am Donnerstag, 12. November 2015 16:42:00 UTC+1 schrieb Tim Holy:
> > Probably the easiest thing would be to just extend the code in Images and
> > submit a PR (the code is not very complicated).
> > 
> > However, you can do very fancy things with MapInfo objects. This is
> > untested,
> > but it should be close:
> > 
> > immutable TwoColormap <: MapInfo
> > 
> >     colormap1
> >     colormap2
> > 
> > end
> > 
> > function map!(dest, mapi::TwoColormap,
> > src::Tuple{AbstractArray,AbstractArray})
> > 
> >     img1, img2 = src
> >     for I in eachindex(dest)
> >     
> >         dest[I] = clamp(RGBmapi.colormap1[img1[I]] +
> > 
> > mapi.colormap2[img2[I]])
> > 
> >     end
> >     dest
> > 
> > end
> > 
> > --Tim
> > 
> > On Thursday, November 12, 2015 07:23:07 AM Tobias Knopp wrote:
> > > Hi,
> > > 
> > > I am using the OverlayImage type from the Images.jl package to overlay
> > 
> > two
> > 
> > > different grayscale images (tomographic data).
> > > If I understand it correctly OverlayImage is restricted to colormaps
> > 
> > that
> > 
> > > go from black to a certain RGB value. Has anybody an idea how this could
> > 
> > be
> > 
> > > extended to Colormaps provided by Colors.jl?
> > > 
> > > So my need is:
> > > Input: two 3D datasets (FloatingPoint) + two Colormaps + WindowWidth
> > > WindowLevel for each
> > > Output: Combined 3D dataset as RGBA values.
> > > 
> > > Thanks
> > > 
> > > Tobias

Reply via email to