[vtkusers] Not able to blend properly

Jagjeet Nain jagjeet.nain at gmail.com
Mon Oct 1 10:05:19 EDT 2012


Hi,
it works following way:
Normal (default) : This is the standard blending mode used by OpenGL and
other graphics packages. The output always has the same number of
components and the same extent as the first input. *The alpha value of the
first input is not used in the blending computation, instead it is copied
directly to the output.*

output <- input[0]
foreach input i {
  foreach pixel px {
    r <- input[i](px)(alpha) * opacity[i]
    f <- (255 - r)
    output(px) <- output(px) * f + input(px) * r
  }
}

Cheers
On Mon, Oct 1, 2012 at 7:40 AM,  <anupriya.sharma at accenture.com> wrote:
> Hi
>
>
>
> I am trying to blend two different raw files. I have used vtkImageReader
to
> read both the files. I have applied two different lookup tables on both
the
> file
>
> I have also  used          vtkImageMapToColors ColorMapper = new
> vtkImageMapToColors();
>
>
>
>                 vtkImageMapToColors ColorMapper = new
vtkImageMapToColors();
>
>                 ColorMapper.SetInput(reader1.GetOutput());
>
>                 ColorMapper.SetLookupTable(table);
>
>
>
>                 vtkImageMapToColors ColorMapper1 = new
> vtkImageMapToColors();
>
>                 ColorMapper1.SetInput(reader2.GetOutput());
>
>                 ColorMapper1.SetLookupTable(table1);
>
>
>
> “table is the Lookuptable applied on first file and table1 is the lookup
> table applied on second file”.
>
>
>
> After setting the lookuptable I have created instance of vtkImage blend.
>
>
>
> vtkImageBlend blend = new vtkImageBlend();
>
> blend.setOpacity(0,0);
>
> blend.setOpacity(1,0);
>
> blend.AddInputConnection(ColorMapper.GetOutputPort);
>
> blend.AddInputConnection(ColorMapper1.GetOutputPort);
>
>
>
> I have later given the output of blend to the Input Connection of Viewer.
>
> Viewer.SetInputConnection(blend.GetOutputPort());
>
>
>
> But the problem is the opacity results are coming incorrect.
>
>
>
> If the opacity of first file is 0 and the opacity of second file is also 0
> then no output should be displayed but the output is getting displayed
with
> color of first LUT i.e Green.
>
> If the opacities are 0.5 and 0.5(0.5 opacity for both the files) then the
> fused color (dark green ) is getting displayed. The same color is getting
> displayed at opacities 0 and 0.5(0 for first file and 0.5 for second).The
> same thing is happening with opacities 1 and 0.5(1 for first file and 0.5
> for second).
>
>
>
> Could anyone please explain how this Opacity function is working and how
to
> blend two different files with different color tables.
>
>
>
>
>
>
>
> Regards
>
> Anupriya Sharma
>
>
>
>
> ________________________________
> Subject to local law, communications with Accenture and its affiliates
> including telephone calls and emails (including content), may be monitored
> by our systems for the purposes of security and the assessment of internal
> compliance with Accenture policy.
>
______________________________________________________________________________________
>
> www.accenture.com
>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121001/139cdd65/attachment.htm>


More information about the vtkusers mailing list