Thank you David, I'll try to change the background.<br><br>But in fact, even if I saw that the borders were red, it wouldn't resolve my problem. I'm going to explain you why...<br><br><br>Here's what I'd like :<br>
<br>If I call something like :<br><br>"window.SetSize(x,y)" (with x,y proportionnal to 60 x 27.5 => if you remember it is the real proportions of the coronal image)<br><br>Have a look at <a href="http://info.fundp.ac.be/%7Escalande/borders2.PNG">http://info.fundp.ac.be/~scalande/borders2.PNG</a> to understand...<br>
<br><br><br>It is so important for me because I'm creating an interface that allow the select a region of the image with the mouse...<br>So I have to do a conversion between the mouse coordinates and the image coordinates.<br>
<br><br>I've another thing to say. In my example, the height of the coronal image is smaller than the height of the axial image. (60 > 27.5)<br>And so there are borders... But if it was the contrary, if the coronal image height was 80, for example...<br>
<br>Would the image be croped of 10 on top and 10 on down?<br><br><br>To avoid the borders in the first case (<60) and the possible crop in the second case (>60), it would be really nice if the coronal views created by ImageReslice were represented in their own "physical space" (instead of the axial views physical space).<br>
<br><br><br>Do you understand better ?<br><br><br><br>I thank you one more time for the help,<br><br><br><br>Stéphane<br><br><br><br><div class="gmail_quote">2008/11/11 David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Stephane,<br>
<br>
When you get back to you office, try setting the background of the<br>
renderer to red and I'm sure that you will see that the borders are<br>
not part of the image.<br>
<br>
The reason that the borders don't disappear when you resize the window<br>
is that everything in the vtkRenderer gets resized when you resize the<br>
window. That is always the behavior of vtkImageActor or any other<br>
actor that is not a 2D actor: everything gets scaled relative to the<br>
window size.<br>
<font color="#888888"><br>
David<br>
</font><div><div></div><div class="Wj3C7c"><br>
<br>
<br>
On Tue, Nov 11, 2008 at 9:29 AM, Stéphane CALANDE <<a href="mailto:scalande@gmail.com">scalande@gmail.com</a>> wrote:<br>
> Hi vtk-list, hi David,<br>
><br>
><br>
><br>
> Thank you very much for your answer.<br>
><br>
> I had already fixed the problem of zoom (that is not 1.0 by default) before.<br>
><br>
> About the problem of the borders, I understand what you say, but I think<br>
> that the borders are "really" included in the image.<br>
> To be honnest, I can't try your advice beacuse I'm not in my office today,<br>
> but I can give you other details to prove that the borders are included in<br>
> the image.<br>
><br>
> Even if I re-sized manually the window with the mouse (for example the<br>
> height), all the image (the coronal subject and the borders) are<br>
> proportionally reduced.<br>
><br>
> (I've tinkered a PNG to explain this. Have a look at :<br>
> <a href="http://info.fundp.ac.be/%7Escalande/borders.PNG" target="_blank">http://info.fundp.ac.be/~scalande/borders.PNG</a><br>
> But it's obviously not the real images because I'm not in my office today,<br>
> it's just to give an example of the same effect...)<br>
><br>
><br>
> If the black borders were "just" the background, they should slowly<br>
> disappear during the re-sizing of the window... But it's not the case...<br>
><br>
><br>
> I really have the impression that the coronal views created by ImageReslice<br>
> are represented in the same "physic space" than the basic axial views<br>
> (representing the volume).<br>
><br>
><br>
> Can my explanation help you to understand the problem?<br>
><br>
><br>
><br>
> Thank you very much for your help,<br>
><br>
><br>
> Regards,<br>
><br>
><br>
><br>
> Stéphane<br>
><br>
><br>
><br>
><br>
><br>
><br>
> 2008/11/10 David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br>
>><br>
>> Hi Stephane,<br>
>><br>
>> The black borders that you see in this example are actually the<br>
>> background in the renderer. If you add<br>
>> "renderer->SetBackground(1.0,0.0,0.0);" to the example, then you will<br>
>> see the black bars turn to red.<br>
>><br>
>> In other words, it isn't vtkImageReslice that is adding these borders.<br>
>> These borders are present because the RenderWindow is square, and<br>
>> vtkImageReslice has no control over the window size.<br>
>><br>
>> So what you need to do is call window->SetSize() to set the size of<br>
>> the window to the size of your image. You can call Update() on<br>
>> ImageReslice and get the size of its output, so that you know what<br>
>> size to make the window.<br>
>><br>
>> Even after you do this, though, you will still have to do one more<br>
>> thing. By default, the zoom factor for camera is not 1.0. You will<br>
>> have to call add code like the following:<br>
>><br>
>> vtkCamera *camera = renderer->GetActiveCamera();<br>
>> camera->SetViewAngle(2.0*atan(0.5*height_of_image/camera_distance));<br>
>><br>
>> Alternatively, you can switch to parallel projections, which makes the<br>
>> math easier but I'm not sure if the VTK interactors all work properly<br>
>> in parallel mode:<br>
>><br>
>> camera->ParallelProjectionOn();<br>
>> camera->SetParallelScale(height_of_image);<br>
>><br>
>> I hope this is what you were looking for,<br>
>><br>
>> David<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> On Mon, Nov 10, 2008 at 9:38 AM, Stéphane CALANDE <<a href="mailto:scalande@gmail.com">scalande@gmail.com</a>><br>
>> wrote:<br>
>> > Hi,<br>
>> ><br>
>> ><br>
>> > I'm trying "ImageSlicing.cxx" to display an "coronal" slice from a<br>
>> > volume<br>
>> > (multiple axial slices).<br>
>> ><br>
>> > It works well, but there is just a problem.<br>
>> ><br>
>> ><br>
>> > Information about my axial slices :<br>
>> ><br>
>> > SIZE : 512 x 512<br>
>> > SPACING : (1,17188 ; 1,17188)<br>
>> ><br>
>> > "REAL" SIZE = 60 cm x 60 cm<br>
>> ><br>
>> ><br>
>> > Information about the coronal slices that SHOULD be created<br>
>> ><br>
>> > SIZE : 512 x 55<br>
>> > SPACING : (1,17188 ; 5)<br>
>> ><br>
>> > "REAL" SIZE = 60 cm x 27.5 cm<br>
>> ><br>
>> ><br>
>> > But the problem is that the image created by "ImageSlicing" has the<br>
>> > shape of<br>
>> > a square.<br>
>> > I mean it has the same shape than the axial images.<br>
>> ><br>
>> > The representation of the coronal object is correct (good proportions)<br>
>> > but<br>
>> > there are 2 black borders (top and down)<br>
>> ><br>
>> > Something like that :<br>
>> ><br>
>> > +++++++++++++++++++<br>
>> > +++++++++++++++++++<br>
>> > +++++++++++++++++++<br>
>> > ---CORONAL IMAGE---<br>
>> > ---CORONAL IMAGE---<br>
>> > ---CORONAL IMAGE---<br>
>> > +++++++++++++++++++<br>
>> > +++++++++++++++++++<br>
>> > +++++++++++++++++++<br>
>> ><br>
>> > ('+' = black)<br>
>> ><br>
>> > In fact, I'd like the image to have the proportion "60 x 27.5 " (without<br>
>> > any<br>
>> > black borders...)<br>
>> ><br>
>> > ---CORONAL IMAGE---<br>
>> > ---CORONAL IMAGE---<br>
>> > ---CORONAL IMAGE---<br>
>> ><br>
>> ><br>
>> > Do you see what I mean ?<br>
>> ><br>
>> > I've searched in the methods of vtkImageReslice but I didn't find what<br>
>> > I'm<br>
>> > looking for...<br>
>> ><br>
>> ><br>
>> ><br>
>> > Do you have any idea to help me ?<br>
>> ><br>
>> > Any help would be appreciated ;-)<br>
>> ><br>
>> > Thank you in advance !<br>
>> ><br>
>> ><br>
>> ><br>
>> > Stéphane<br>
>> ><br>
>> > _______________________________________________<br>
>> > This is the private VTK discussion list.<br>
>> > Please keep messages on-topic. Check the FAQ at:<br>
>> > <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>> > Follow this link to subscribe/unsubscribe:<br>
>> > <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
>> ><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br>