[vtkusers] question about "ImageSlicing.cxx"

Stéphane CALANDE scalande at gmail.com
Tue Nov 11 11:29:49 EST 2008


Hi vtk-list, hi David,



Thank you very much for your answer.

I had already fixed the problem of zoom (that is not 1.0 by default) before.

About the problem of the borders, I understand what you say, but I think
that the borders are "really" included in the image.
To be honnest, I can't try your advice beacuse I'm not in my office today,
but I can give you other details to prove that the borders are included in
the image.

Even if I re-sized manually the window with the mouse (for example the
height), all the image (the coronal subject and the borders) are
proportionally reduced.

(I've tinkered a PNG to explain this. Have a look at :
http://info.fundp.ac.be/~scalande/borders.PNG<http://info.fundp.ac.be/%7Escalande/borders.PNG>
But it's obviously not the real images because I'm not in my office today,
it's just to give an example of the same effect...)


If the black borders were "just" the background, they should slowly
disappear during the re-sizing of the window... But it's not the case...


I really have the impression that the coronal views created by ImageReslice
are represented *in the same "physic space"* than the basic axial views
(representing the volume).


Can my explanation help you to understand the problem?



Thank you very much for your help,


Regards,



Stéphane






2008/11/10 David Gobbi <david.gobbi at gmail.com>

> Hi Stephane,
>
> The black borders that you see in this example are actually the
> background in the renderer.  If you add
> "renderer->SetBackground(1.0,0.0,0.0);" to the example, then you will
> see the black bars turn to red.
>
> In other words, it isn't vtkImageReslice that is adding these borders.
>  These borders are present because the RenderWindow is square, and
> vtkImageReslice has no control over the window size.
>
> So what you need to do is call window->SetSize() to set the size of
> the window to the size of your image.  You can call Update() on
> ImageReslice and get the size of its output, so that you know what
> size to make the window.
>
> Even after you do this, though, you will still have to do one more
> thing.  By default, the zoom factor for camera is not 1.0.  You will
> have to call add code like the following:
>
>  vtkCamera *camera = renderer->GetActiveCamera();
>  camera->SetViewAngle(2.0*atan(0.5*height_of_image/camera_distance));
>
> Alternatively, you can switch to parallel projections, which makes the
> math easier but I'm not sure if the VTK interactors all work properly
> in parallel mode:
>
>  camera->ParallelProjectionOn();
>  camera->SetParallelScale(height_of_image);
>
> I hope this is what you were looking for,
>
>    David
>
>
>
>
>
>
>
>
>
>
>
> On Mon, Nov 10, 2008 at 9:38 AM, Stéphane CALANDE <scalande at gmail.com>
> wrote:
> > Hi,
> >
> >
> > I'm trying "ImageSlicing.cxx" to display an "coronal" slice from a volume
> > (multiple axial slices).
> >
> > It works well, but there is just a problem.
> >
> >
> > Information about my axial slices :
> >
> > SIZE : 512 x 512
> > SPACING : (1,17188 ; 1,17188)
> >
> > "REAL" SIZE = 60 cm x 60 cm
> >
> >
> > Information about the coronal slices that SHOULD be created
> >
> > SIZE : 512 x 55
> > SPACING : (1,17188 ; 5)
> >
> > "REAL" SIZE = 60 cm x 27.5 cm
> >
> >
> > But the problem is that the image created by "ImageSlicing" has the shape
> of
> > a square.
> > I mean it has the same shape than the axial images.
> >
> > The representation of the coronal object is correct (good proportions)
> but
> > there are 2 black borders (top and down)
> >
> > Something like that :
> >
> > +++++++++++++++++++
> > +++++++++++++++++++
> > +++++++++++++++++++
> > ---CORONAL IMAGE---
> > ---CORONAL IMAGE---
> > ---CORONAL IMAGE---
> > +++++++++++++++++++
> > +++++++++++++++++++
> > +++++++++++++++++++
> >
> > ('+' = black)
> >
> > In fact, I'd like the image to have the proportion "60 x 27.5 " (without
> any
> > black borders...)
> >
> > ---CORONAL IMAGE---
> > ---CORONAL IMAGE---
> > ---CORONAL IMAGE---
> >
> >
> > Do you see what I mean ?
> >
> > I've searched in the methods of vtkImageReslice but I didn't find what
> I'm
> > looking for...
> >
> >
> >
> > Do you have any idea to help me ?
> >
> > Any help would be appreciated ;-)
> >
> > Thank you in advance !
> >
> >
> >
> > Stéphane
> >
> > _______________________________________________
> > 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
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081111/eaf5d1d5/attachment.htm>


More information about the vtkusers mailing list