[vtkusers] Change visibilty of datasets with zero value

Alexander Mizuk amizuk at uni-osnabrueck.de
Mon Sep 18 10:40:46 EDT 2017


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 <mailto: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.RenderWindow;
>
>                 vtkRenderer renderer =
>     renderWindow.GetRenderers().GetFirstRenderer();
>
>                 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/82902ea6/attachment.html>


More information about the vtkusers mailing list