[vtkusers] Change visibilty of datasets with zero value

David Gobbi david.gobbi at gmail.com
Mon Sep 18 16:13:34 EDT 2017


Hi Alexander,

I meant just vtkThreshold, by itself, before vtkDataSetMapper.  This will
show only the points that are within the threshold.  In comparison,
vtkImageThreshold does not remove points.  All it can do is change the
color of the points.

However, what you do with vtkImageThreshold can also work, but you must
always set a range for the lookup table, e.g. lookupTable.SetRange(0, 1000).

 - David


On Mon, Sep 18, 2017 at 8:40 AM, Alexander Mizuk <amizuk at uni-osnabrueck.de>
wrote:

> Hi David,
>
> thank you for your fast respond.
> I used the following code:
>
>             vtkImageThreshold threshold = vtkImageThreshold.New();
>             threshold.SetInputConnection(reader.GetOutputPort());
>             threshold.ThresholdByLower(500);
>             threshold.ReplaceInOn();
>             threshold.SetInValue(0);
>             threshold.ReplaceOutOn();
>             threshold.SetOutValue(1);
>             threshold.Update();
>
>             vtkLookupTable lookupTable = vtkLookupTable.New();
>             lookupTable.SetTableValue(0, 0.0, 0.0, 0.0, 0.0);
>             lookupTable.Build();
>
>             vtkImageMapToColors mapTransparency =
> vtkImageMapToColors.New();
>             mapTransparency.SetLookupTable(lookupTable);
>             mapTransparency.SetInput(threshold.GetOutput());
>
> and send then the mapTransparency to the mapper. My result is still a
> black cube with a white contour in it. But I just want to display the white
> contour.
>
> Is it possible to display only a specific part of a dataset or have I
> always to render everything?
>
> Thank you for your help
>
> Alexander
>
> Am 18.09.2017 um 15:24 schrieb David Gobbi:
>
> Hi Alexander,
>
> You can use vtkThreshold to set the threshold, or perhaps you can use a
> lookup table that sets the opacity of those scalars to zero, i.e. use
> table->SetTableValue(0, 0.0, 0.0, 0.0, 0.0).
>
>  - David
>
> On Mon, Sep 18, 2017 at 2:22 AM, Alexander Mizuk <amizuk at uni-osnabrueck.de
> > wrote:
>
>> Hi there,
>>
>> I want to display a 3D point-cloud. If read a DICOM series with
>> vtkDICOMImageReader, set a threshold and change the value range from HU to
>> 255 bit grayscale.
>> Now I can display the hole dataset with:
>>
>>              // Visualize
>>             vtkDataSetMapper mapper = vtkDataSetMapper.New();
>> mapper.SetInputConnection(shiftScaleFilter.GetOutputPort());
>>             //mapper.ScalarVisibilityOff();
>>
>>             vtkActor actor = vtkActor.New();
>>             actor.SetMapper(mapper);
>>
>>             actor.GetProperty().SetPointSize(4);
>>             vtkRenderWindow renderWindow = renderWindowControl1.RenderWin
>> dow;
>>
>>             vtkRenderer renderer = renderWindow.GetRenderers().Ge
>> tFirstRenderer();
>>
>>             renderer.SetBackground(0.2, 0.3, 0.4);
>>             renderer.AddActor(actor);
>>
>>             renderer.ResetCamera();
>>
>> With mapper.ScalarVisibilityOff(); I can set the visibility of the hole
>> dataset of, but I only want to set the visibiliy for voxels with a value
>> under a specific threshold for example all voxel with the value of zero.
>> How can I realize it?
>>
>> best regards
>>
>> Alexander
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170918/ec70bd60/attachment.html>


More information about the vtkusers mailing list