[Fwd: Re: [vtkusers] transparancy using vtkImageBlend]

Anka Kochanowska anka at bic.mni.mcgill.ca
Mon Aug 6 11:19:59 EDT 2007


Hi!
Please send the messages to vtkusers. I am on vacation and only 
accidentally got your message.
I think, your code is OK, but I am NOT an expert, just trying to develop 
some programs.
Anka


-------- Original Message --------
Subject: 	Re: [vtkusers] transparancy using vtkImageBlend
Date: 	Sun, 5 Aug 2007 21:35:05 +0200 (CEST)
From: 	José Santamaría López <jsantam at ugr.es>
Reply-To: 	jsantam at ugr.es
To: 	Anka Kochanowska <anka at bic.mni.mcgill.ca>
References: 
<94ca0b990704120518x796e9fa2o4ec50291c3ea924c at mail.gmail.com> 
<461E32C0.7080906 at bic.mni.mcgill.ca>



Dear Anka,

  I need to put the following camera's parameters (perspective projection
model):

* Viewplane at Z = 0
* Eyepoint or center of projection at Z = -0,839 (being the focal length of
the camera, noted d)
* Height (and width) of the RenderWindow = 2 (measured in millimeters)
* ViewUp (0,1,0)

Then, this is the code I used to develop the previous camera model with the
vtkCamera class:

vtkCamera *camera = vtkCamera::New();

camera->SetViewUp(0, 1, 0);             // ViewUp
camera->SetPosition(0, 0, -d);          // Eyepoint
camera->SetFocalPoint(0, 0, 0);         // Viewplane
camera->ComputeViewPlaneNormal();

double h = 2;       // h is the height of the RenderWindow
double d = 0,839;   // d is the distance from your eyes to the screen
double angleofview = 2. * atan((h/2.)/d);  // angleofview = 2*atan((h/2)/d)

camera->SetViewAngle(angleofview);

I tested it and It seems that it works, but I don't know if I'm properly
using the vtkCamera class to implement what I really need.

Any help will be grateful.

Best regards,

  Jose.


Anka Kochanowska
> Something like:
>
>         blendedImage = vtkImageBlend::New();
>         blendedImage->SetOpacity(0, 0.5);
>         blendedImage->SetOpacity(1, 0.5);
>         blendedImage->AddInput( 0, im1->GetOutput());
>         blendedImage->AddInput( 0, im2->GetOutput());
>         blendedImage->Update();
>
> Anka
>
> Luca Pamparana wrote:
>
>> Hi everyone,
>>
>> I am playing around with the vtkImageBlend filter and I am having
>> trouble with getting the underlying image to show through.
>>
>> So, the setup is as follows:
>>
>> I have two seperate image reslicers for the two input image volumes.
>> Their output port both connect to an input port of the vtkImageBlend
>> filter
>>
>> When I load the volumes, I center them in a viewing display. This is
>> achieved as follows:
>>
>> // Set the output extent to our viewer size
>> slicer1->SetOutputExtent(0, (int)m_sizeX - 1, 0, (int)m_sizeY -1, 0, 0);
>> slicer2->SetOutputExtent(0, (int)m_sizeX - 1, 0, (int)m_sizeY -1, 0, 0);
>>
>> // After this set the output origin to be the center of the view.
>>
>> Now, as you can see the images occupy the whole view. Now, when I
>> display the final result, the underlying image cannot be seen at all.
>> Is there a way to set the transparancy so that the underlying image
>> can be seen. Right now, the overlaid image is totally opaque...
>>
>> Thanks for your help.
>>
>> Luca
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>This is the private VTK discussion list.
>>Please keep messages on-topic. Check the FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>Follow this link to subscribe/unsubscribe:
>>http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list