[vtkusers] Changing level/window in LUT for ImageSlice: Unwanted clipping effects

David Gobbi david.gobbi at gmail.com
Thu Feb 2 12:08:01 EST 2017


Okay, here is a very simple work-around for this issue: Just call Build()
on the table after you have set all the other table parameters.  Please let
me know if this fixes the issue.

I've submitted a fix for mapper so that it will call Build()
automatically.  I'm not sure why it didn't do this before.

 - David


On Thu, Feb 2, 2017 at 8:41 AM, David Gobbi <david.gobbi at gmail.com> wrote:

> I've discovered more about this issue.  The Above/Below colors will work
> if you call SetNumberOfColors after turning them on:
>
> table->SetBelowRangeColor(1,0,0,1);
> table->SetAboveRangeColor(0,1,0,1);
> table->UseAboveRangeColorOn();
> table->UseBelowRangeColorOn();
> table->SetNumberOfColors(256);
>
> I'm still investigating to see why this happens.
>
>  - David
>
>
> On Thu, Feb 2, 2017 at 7:20 AM, David Gobbi <david.gobbi at gmail.com> wrote:
>
>>
>>
>> Hi Sophonet,
>>
>> I have confirmed that what you report is true: the vtkImageResliceMapper
>> (and vtkImageSliceMapper) seem to ignore the AboveRangeColor and the
>> BelowRangeColor.  This is also true for the current VTK master branch.  My
>> current theory is that the mapper clamps the scalars to the range before
>> they go through the lookup table.  Hopefully I'll have a fix for this soon.
>>
>> As a workaround (a inefficient workaround), you can use
>> vtkImageMapToColors to apply the lookup table to the image before it goes
>> to the mapper.
>>
>>  - David
>>
>>
>> On Thu, Feb 2, 2017 at 5:10 AM, Sophonet <vtk12af6bc42 at kant.sophonet.de>
>> wrote:
>>
>>> Dear list,
>>>
>>> for displaying images, I am using vtkImageResliceMapper. For changing
>>> the colormap, I set a dedicated color map to the imageSlice's property
>>> (which is a vtkLookupTable) and tell to use its scalar range:
>>>
>>> colorMap_->SetNumberOfTableValues(256);
>>> colorMap_->SetRange(0, 1);
>>>
>>> imageProperty_->SetLookupTable(colorMap_);
>>> imageProperty_->UseLookupTableScalarRangeOn();
>>>
>>>
>>> Now, when changing level/window interactively with the mouse, I am
>>> setting the range in the colorMap via
>>>
>>> double minmax[2];
>>> // set values of minmax correctly
>>> colorMap_->SetRange(minmax);
>>>
>>> The changes are displayed correctly - however, areas in which original
>>> scalars of the image are clipped, the resulting color is displayed as
>>> transparent. However, I would like to display the maximum / minimum value
>>> in the color table.
>>>
>>> I have tried using colorMap_->SetAboveRangeColor() and
>>> colorMap_->SetAboveRangeColorOn() (likewise for ...BelowRange...), with
>>> no apparent effect.
>>>
>>> Any advice?
>>>
>>> I am using VTK 7.1.0.
>>>
>>> Thanks,
>>>
>>>      Sophonet
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170202/9b16b6c9/attachment.html>


More information about the vtkusers mailing list