[vtkusers] How to overlay two images with different opacities, ..

Miguel Angel Rodriguez Florido marf at itccanarias.org
Fri Aug 14 07:17:29 EDT 2009


	Hi all,

	Finally, I got the solution that I was looking for. Thanks to everybody 
that gave me inputs.

	How I thought it was easier than I was doing (using textures, etc.).

	Basically, the idea is:

	1) Read the original image (color/grayscale) to be overlayed. I have 
used the pipeline: vtkStructuredPointsReader->vtkImageActor->Render

	2) Read the segmented image (labels). In my case, 
vtkStructuredPointsReader.

	3) Define a vtkLookupTable to link labels to colors. Put the alpha 
value to 0.0 for all the labels/colors.

	4) Define a vtkImageMapToColors with the (2) step dataset like input, 
and using the (3) lut.

	5) Insert the vtkImageMapToColors object in a vtkImageActor -> Render.

	At this point, we have rendered both images, but we see the original 
one (the segmented has alpha = 0.0 for all its labels).

	Then, you can see any label/color overlayed to the original one if you 
change the alpha value to 1.0 for the wished label.

	Again, thank you very much for people (Anka, Vikrant, John and Karthik) 
that answers to my email.

	I hope to help to the community with this email.

	Best.

Karthik Krishnan wrote:
> You'll find some examples that do precisely this in VTKEdge. 
> (vtkedge.org <http://vtkedge.org>). Look at PaintbrushTest*.cxx. It 
> overlays a label map segmentation on a graylevel image. The opacity of 
> the label map, or each label individually is controlled using "<" and 
> ">" keys, so as to fade the segmentations in and out.
> 
> The classes that do the blending are based on VTK..
> 
> --
> karthik
> 
> 2009/8/13 Miguel Angel Rodriguez Florido <marf at itccanarias.org 
> <mailto:marf at itccanarias.org>>
> 
>            Hi all,
> 
>            Perhaps this is an obvious question, but I've been playing
>     with textures and lookuptables but I didn't get what I was looking
>     for. I don't know where I'm wrong.
> 
>            I would like to overlay two images (a color/graylevel image
>     and its segmented version), and then I would like to change the
>     opacity of any label or change its color. Could anybody give me any
>     hint?.
> 
>            Thank you very much.
>            Best regards.
> 
>     -- 
>     Miguel Angel Rodríguez Florido
>     Departamento de Ingeniería del Software
>     División de Investigación y Desarrollo Tecnológico
>     INSTITUTO TECNOLOGICO DE CANARIAS, S.A. - GOBIERNO DE CANARIAS
>     www.itccanarias.org <http://www.itccanarias.org> t: +34 928
>     727548/457462, f: +34 928 727517
> 
>     --------------------------------------------------------------------------
>     AVISO LEGAL:
>     Este mensaje y los ficheros adjuntos si los hubiere, se dirigen
>     exclusivamente a su destinatario y puede contener información
>     privilegiada o confidencial. La transmisión errónea del presente
>     mensaje en ningún momento supone renuncia a su confidencialidad. Si
>     no es vd. el destinatario indicado, queda notificado de que la
>     utilización, divulgación y/o copia sin autorización está prohibida
>     en virtud de la legislación vigente. Si ha recibido este mensaje por
>     error, le rogamos que nos lo comunique inmediatamente por esta misma
>     vía y proceda a su destrucción.
> 
>     LEGAL WARNING:
>     This message and the files attached if there were any, are intended
>     exclusively for its addressee and may contain information that is
>     CONFIDENTIAL and protected by professional privilege. A wrong
>     transmission to this message don't suppose we relinquished to It's
>     confidential. If you are not the intended recipient you are hereby
>     notified that any dissemination, copy or disclosure of this
>     communication is strictly prohibited by law. If this message has
>     been received in error, please immediately notify us via e-mail and
>     delete it.
> 
> 
> 
> 
> 
>     _______________________________________________
>     Powered by www.kitware.com <http://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
> 
>     Follow this link to subscribe/unsubscribe:
>     http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 
> 
> 
> -- 
> Karthik Krishnan
> R&D Engineer,
> Kitware Inc.
> Ph: 518 881 4919
> Fax: 518 371 4573

-- 
Miguel Angel Rodríguez Florido
Departamento de Ingeniería del Software
División de Investigación y Desarrollo Tecnológico
INSTITUTO TECNOLOGICO DE CANARIAS, S.A. - GOBIERNO DE CANARIAS
www.itccanarias.org t: +34 928 727548/457462, f: +34 928 727517

--------------------------------------------------------------------------
AVISO LEGAL:
Este mensaje y los ficheros adjuntos si los hubiere, se dirigen 
exclusivamente a su destinatario y puede contener información 
privilegiada o confidencial. La transmisión errónea del presente mensaje 
en ningún momento supone renuncia a su confidencialidad. Si no es vd. el 
destinatario indicado, queda notificado de que la utilización, 
divulgación y/o copia sin autorización está prohibida en virtud de la 
legislación vigente. Si ha recibido este mensaje por error, le rogamos 
que nos lo comunique inmediatamente por esta misma vía y proceda a su 
destrucción.

LEGAL WARNING:
This message and the files attached if there were any, are intended 
exclusively for its addressee and may contain information that is 
CONFIDENTIAL and protected by professional privilege. A wrong 
transmission to this message don't suppose we relinquished to It's 
confidential. If you are not the intended recipient you are hereby 
notified that any dissemination, copy or disclosure of this 
communication is strictly prohibited by law. If this message has been 
received in error, please immediately notify us via e-mail and delete it.




-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3262 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090814/2fa0688e/attachment.bin>


More information about the vtkusers mailing list