[vtkusers] Please Help: Problem to display 2D image in volumeusingvtkActor/vtkPlaneSource
Thomas Kuiran Chen
chent at cs.queensu.ca
Tue Oct 12 10:14:46 EDT 2004
Hi Andre,
In general, my solution is:
vtkImageData -> vtkPolyData -> vtkPolyDataMapper -> vtkActor -> Set Transform -> visualization.
So in the first step you have to convert the 2D vtkImageData into vtkPolyData using vtkImageToPolyDataFilter:
// vtkImageData to vtkPolyData
vtkImageToPolyDataFilter *Image2PolyDataFilter = vtkImageToPolyDataFilter::New();
Image2PolyDataFilter->SetInput( ImageReader->GetOutput() );
Then create the polydata mapper:
// Image polydata mapper
vtkPolyDataMapper *ImageInPolyDataMaper = vtkPolyDataMapper::New();
ImageInPolyDataMaper->SetInput( Image2PolyDataFilter->GetOutput() );
Finally pass it to vtkActor:
// Image Polydata Actor
vtkActor *ImageInPolyDataActor = vtkActor::New();
ImageInPolyDataActor->SetMapper(ImageInPolyDataMaper);
Now this is a very critical step, in which you have to set your homogeneous transform matrix:
// Set the transform that transfer the image from its own frame to the volume frame.
ImageInPolyDataActor->SetUserMatrix( TransformMatrix_Image2Volume );
You should be able to visualize the image inside the volume in this way if your transform is correct.
Hope it helps, and
Good Luck!
Cheers,
Thomas Kuiran Chen
2004-10-12 09:53:47
The Image Analysis Laboratory
School of Computing
Queen's University
Kingston, Ontario, Canada K7L 3N6
Email: chent at cs.queensu.ca
Tel: (O) 1(613)533-2797
---------------------- Original Message ------------------------
From: Andr¨¦ Huisman <andre at syand.nl>
To: Thomas - Kuiran Chen <chent at cs.queensu.ca>
Sent: 2004-10-11 09:30:34
Subject: Re: [vtkusers] Please Help: Problem to display 2D image in volumeusingvtkActor/vtkPlaneSource
Dear Thomas,
The application I am working on is in a complete different area: we are
visualizing prostate tissue cells, imaged using a Confocal Laser
Scanning Microscope. Mostly we have 3D datasets, but sometimes we want
to be able to visualize 2D data. We read tiff images, using ITK, because
we want to do more image processing, using ITK. At first we were even
not possible to import itk images into vtk. We worked around that by
converting the image first to a (vtk) structured point set.
We now use some transformation, but if we use it on 2D data (so, we use
just one image plane) it crashes with an access violation (because of
line 237 in vtkFiniteDifferenceGradientEstimator.cxx, where a z-step of
16000 is used). We already use the vtkPolyDataMapper as mapper. I'm not
sure we use the right transformations, although we found it online.
So we can only visualize 3D data at the moment.
If you can show me how you made it possible to show a 2D image, I would
be very grateful.
Thank you in advance, sincerely,
Andr¨¦ Huisman
Thomas - Kuiran Chen wrote:
>Hi Andre,
>
>For that question, unfortunately, I didn't get any reply from the VTK group. Seems like not too much people are interested in that particular appliation, :-).
>
>So I finally I got my own solution to it after trying numerious methods. My solution was not using the vtkPlaneSource because the transform for it never got right. Instead, I converted the 2D image from vtkImageData to the vtkPolyData and created another vtkActor specific for that image, then displayed it with the proper transform.
>
>It worked fine for me. I think vtkPlaneSource is supposed (or designed) to be a ideal and elegant way to handle this, but somehow it has bugs.
>
>Are you also working on displaying a 2D ultrasound slice inside a ultrasound volume?
>
>Hope it helps and Good Luck!
>
>Thomas Kuiran Chen
>
>The Image Analysis Laboratory
>School of Computing
>Queen's University at Kingston
>Ontario, Canada K7M 1B6
>Email: chent at cs.queensu.ca
>Tel: (O) 1(613)533-2797
>
>
>---------------------- Original Message ------------------------
>From: André_Huisman <andre at syand.nl>
>To: chent at cs.queensu.ca <chent at cs.queensu.ca>
>Sent: 2004-10-07 04:52:27
>Subject: re: [vtkusers] Please Help: Problem to display 2D image in volumeusing vtkActor/vtkPlaneSource
>
>Hi Thomas,
>
>On the internet I found a post of you with the above subject. It is
>exactly the same problem I am facing at the moment. Did you receive any
>usefull comments on your post and did that help you to do the
>visualisation? If so, please could you send me those solutions?
>
>Thank you in advance,
>
>Andr?Huisman
>Department of pathology, University Medical Center Utrecht
>The Netherlands
>
>--------------------------------------------------------------------
>
>
>
>
--------------------------------------------------------------------
More information about the vtkusers
mailing list