|
From: Perry G. <pe...@st...> - 2005-02-09 23:05:52
|
John Hunter wrote:
> >>>>> "Teemu" == Teemu Rinne <Tee...@he...> writes:
>
>
> Teemu> How to do this? Do I have to combine the RGB values of the
> Teemu> two images 'manually'?
>
> Basically what you are talking about is adding an alpha channel to the
> color map, and setting it to be transparent for image values less than
> a certain value. Perry Greenfield is the colormap implementer and
> resident expert.
>
> Perry -- how hard would it be to either subclass or extend the current
> framework to include an alpha channel? I think it could be done in
> just a few lines of code actually. Eg, something like
>
> self._alpha_lut = makeMappingArray(self.N,
> self._segmentdata.get('blue', [1.0, 1.0])
>
> and then modifying
>
> def __call__(self, X, alpha=1.0):
>
> to deal with it.
>
> Perry do you have time to take a crack at this? I think this would be
> very useful.
>
Offhand it doesn't look like it should be a problem, but I need to clarify
some things about your suggestion and the user interface.
Should self._alpha_lut always copy the blue segment data (or are you showing
what the user would have to do?) I would have guessed that it would default
to being always 1 (I think that's the intent above but how does one then
define it independently outside of the class definition.
Secondly, this example asks for a threshold based on prenormalized data
values (i.e., image value of 30). To get what the user wants, the user must
either define the alpha map to match the normalized value of 30 or normalize
the data to match 30 to the alpha map threshold. It's not so obvious to me
how this is best handled. A fancier normalization function that uses
data-based thresholds to map to color map thresholds? Otherwise, it may be
fairly painful to apply in practice. A convenient way to define a color map
based on data values and how the data will be normalized?
But maybe I'm suffering from flu-induced confusion.
Perry
|