[vtkusers] A question about displaying Image using VTK
Cory Quammen
cory.quammen at kitware.com
Thu Jul 9 12:42:56 EDT 2015
Instead of using a vtkColorTransferFunction, try using
a vtkDiscretizableColorTransferFunction and setting the opacity function
via SetScalarOpacityFunction(), e.g.
vtkSmartPointer<vtkDiscretizableColorTransferFunction >
colorTransferFunction =
vtkSmartPointer<vtkDiscretizableColorTransferFunction >::New();
colorTransferFunction->AddRGBPoint(0,0,0.5,0);
colorTransferFunction->AddRGBPoint(60,1,0,0);
colorTransferFunction->AddRGBPoint(255,0.8,0.8,0.8);
colorTransferFunction->SetScalarOpacityFunction(opacityTransferFunction);
then enable opacity mapping with
colorTransferFunction->EnableOpacityMappingOn();
HTH,
Cory
On Thu, Jul 9, 2015 at 9:51 AM, 15891495523 at 126.com <15891495523 at 126.com>
wrote:
> Dear all
>
> I feel confused when display a CT image using VTK. How can I make
> those black and gray part in the following picture invisible ?
> The key part of my code is :
>
> vtkSmartPointer<vtkPiecewiseFunction> opacityTransferFunction =
> vtkSmartPointer<vtkPiecewiseFunction>::New();
> opacityTransferFunction->AddPoint(0,1200);
> opacityTransferFunction->AddPoint(1200,0.4);
> opacityTransferFunction->AddPoint(2000,0.2);
>
> vtkSmartPointer<vtkColorTransferFunction> colorTransferFunction =
> vtkSmartPointer<vtkColorTransferFunction>::New();
> colorTransferFunction->AddRGBPoint(0,0,0.5,0);
> colorTransferFunction->AddRGBPoint(60,1,0,0);
> colorTransferFunction->AddRGBPoint(255,0.8,0.8,0.8);
>
>
> Thank you in advanced!
>
> ZhangQiang
>
>
> ------------------------------
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
--
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150709/d40a6546/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: InsertPic_.jpg
Type: image/jpeg
Size: 100667 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150709/d40a6546/attachment.jpg>
More information about the vtkusers
mailing list