[vtkusers] Change visibilty of datasets with zero value
David Gobbi
david.gobbi at gmail.com
Tue Sep 19 13:58:59 EDT 2017
Hi Alexander,
If you want to display the data as points, then vtkDataSetMapper is the
right mapper to use. But if your data is too large, then maybe other
visualization methods would be better?
For example, volume rendering will probably use less than one third as much
memory:
https://lorensen.github.io/VTKExamples/site/Cxx/VolumeRendering/SmartVolumeMapper/
Or, if you just need to view surfaces, then you can use vtkMarchingCubes to
create surfaces from the volumes. The number of points in the surface is
far less than the number of points in the volume:
https://lorensen.github.io/VTKExamples/site/Cxx/Modelling/MarchingCubes/
- David
On Tue, Sep 19, 2017 at 6:48 AM, Alexander Mizuk <amizuk at uni-osnabrueck.de>
wrote:
> Hi David,
>
> Thank you for the information about vtkImageThreshold.
> If I use vtkThreshold then I get always the following error:
> vtkFloatArray (09B0E400): Unable to allocate 348585984 elements of size 4
> bytes.
> I think this happens cause of my dataset is to big?
>
> vtkThreshold th = vtkThreshold.New();
> th.SetInputConnection(reader.GetOutputPort());
> th.ThresholdByUpper(500);
> th.Update();
>
> This is how you recommend it, right?
>
> And when I use lookupTable.SetRange(0, 1000) without using
> vtkImageThreshold then it change my view and I can display different parts
> but I still get for my result a big black cube with some details in it. But
> I don't need this cube, just the contours in it.
>
> Maybe I use the wrong type for this. My Input looks like this
> vtkDICOMImageReader reader = new Kitware.VTK.vtkDICOMImageReader();
>
> Is vtkDatasetMapper the right mapper for displaying the points? Cause I
> think this render just the outer contours and left the inside empty.
> Because of this the lookupTable is not able to set the visibilty of the
> back area off.
> Is that possible?
>
> best regards
> Alexander
>
> Am 18.09.2017 um 22:13 schrieb David Gobbi:
>
> 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/20170919/ce37a71e/attachment.html>
More information about the vtkusers
mailing list