[vtkusers] Re: Setting the image orientation in vtkImageViewer
anja.ende at googlemail.com
Fri Aug 18 12:05:37 EDT 2006
I think I can do it with vtkImageReslice.
However, I am having problem trying to understand what the
SetResliceAxesDirectionCosines does. In particular, what should the matrix
look like if we set the slice orientation to say XZ or YZ.
I would be grateful if someone could explain what the matrix would look like
for these simple orientations.
On 18/08/06, Anja Ende <anja.ende at googlemail.com> wrote:
> Hi everyone,
> vtkImageViewer2 allows the user to set the slice orientation to XY, XZ and
> YZ planes. I am trying to implement the same functionality in
> I call the SetExtent function on the input image data but it does not seem
> to have any effect in the displayed slice. It always displays the slice in
> the XY plane regardless of the extent values.
> So, I have something like:
> vtkImageData *input = this->GetInput();
> if (!input || !this->ImageMapper)
> int *w_ext = input->GetWholeExtent();
> // Is the slice in range ? If not, fix it
> int slice_min = w_ext[this->m_sliceOrientation * 2];
> int slice_max = w_ext[this->m_sliceOrientation * 2 + 1];
> if (this->m_slice < slice_min || this->m_slice > slice_max)
> this->m_slice = static_cast<int>((slice_min + slice_max) * 0.5);
> // Set the image actor
> switch (this->m_sliceOrientation)
> case MyViewer::SliceOrientation_XY:
> w_ext, w_ext, w_ext, w_ext, this->m_slice,
> case MyViewer::SliceOrientation_XZ:
> w_ext, w_ext, this->m_slice, this->m_slice,
> w_ext, w_ext);
> case MyViewer::SliceOrientation_YZ:
> this->m_slice, this->m_slice, w_ext, w_ext,
> w_ext, w_ext);
> However, it always renders the first slice in the XY plane. Any ideas on
> how to fix this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers