[vtkusers] Where's my Reslice?

Eric E. Monson emonson at cs.duke.edu
Tue Apr 27 15:56:07 EDT 2010


Hey Scott,

I think your initial combination of 3-dimensional output from vtkImageReslice and vtkImageViewer2 should be fine. It is probably just a matter of correctly specifying the axis for your reslice filter. You can probably take a look at those examples for setting the reslice axis with the matrix (including specifying the center position of the axis, which may have been causing your problem), and then use vtkImageViewer2 just as you were intending.

Good luck,
-Eric


On Apr 27, 2010, at 3:42 PM, Scott Johnson wrote:

> Thanks Eric,
> 
> I'm sorry I forgot to say the settings for vtkImageChangeInformation.  I
> just invoked CenterImageOn to have the images display.  I was working
> under the assumption that I was specifying the cut location of the
> vtkImageReslice correctly, but wasn't displaying it correctly.
> 
> I did look at ImageSlicing.cxx.  It manages the vtkImageActor on its
> own, without using vtkImageViewer2.  That's what prompted my initial
> question of:  Is vtkImageViewer2 maybe setting something that is
> throwing me off?  I think I'm going to have to go that route.
> 
> If I specify SetDimensionality(3) for the vtkImageReslice, I thought I
> would be getting a stack of slices.  My plan was then to use SetSlice(n)
> to allow the user to move through the slices.  Is that the wrong
> assumption?
> 
> 		-- Scott
> 
> -----Original Message-----
> From: Eric E. Monson [mailto:emonson at cs.duke.edu] 
> Sent: Tuesday, April 27, 2010 2:31 PM
> To: Scott Johnson
> Cc: Jothy; vtkusers at vtk.org
> Subject: Re: [vtkusers] Where's my Reslice?
> 
> Hey Scott,
> 
> I'm not an expert on this, (and you didn't describe what you had to put
> in your vtkImageChangeInformation to see the other views), but it sounds
> a bit like maybe there's just something wrong with how you're specifying
> your transform to get your slice, so you're not really slicing through
> where you think you are. The output of the reslice filter should just be
> an image (i.e. a vtkImageData which is only 1-deep, so it's flat like an
> image instead of what you'd think of as a volume).
> 
> Have you taken a look at this example?
> [vtk_source]/Examples/ImageProcessing/Cxx/ImageSlicing.cxx (or its
> Python or Tcl equivalent)
> 
> That one shows very nicely how to specify a 4x4 matrix which controls
> the slice axis (set with reslice->SetReliceAxes(resliceAxes) ), and uses
> a vtkImageActor and standard vtkRenderWindow to display the image. If
> you haven't, maybe you can at least play with those methods and see if
> they make any difference. 
> 
> -Eric
> 
> 
> On Apr 27, 2010, at 3:08 PM, Scott Johnson wrote:
> 
>> It was my understanding that those allow the plane orientation to be
> manipulated and display the plane in space.  I want the 2D result of the
> reslice to be presented to the user as a 2D image and then allow them to
> step through the slices.  I don't want them to be able to change the
> orientation.  I'm determining the orientation based on a fiducial.
>> 
>> Can I turn off the plane manipulation and fix the display orientation
> toward the user?  I'll look at vtkImagePlaneWidget a bit more.
>> 
>> I'm not finding the documentation for vtkImagePlaneWidget2 at
> http://www.vtk.org/doc/nightly/html/annotated.html.  Is it somewhere
> else?
>> 
>> Thanks
>> 
>> 		-- Scott
>> 
>> -----Original Message-----
>> From: Jothy [mailto:jothybasu at gmail.com] 
>> Sent: Tuesday, April 27, 2010 1:44 PM
>> To: Scott Johnson
>> Cc: vtkusers at vtk.org
>> Subject: Re: [vtkusers] Where's my Reslice?
>> 
>> Either you use vtkImagePlaneWidget or vtkImageplaneWidget2 and get
>> their output to display on axial,sagittal,coronal.
>> 
>> Jothy
>> 
>> On Tue, Apr 27, 2010 at 7:35 PM, Scott Johnson
>> <Scott.Johnson at neuwave.com> wrote:
>>> Thanks Jothy,
>>> 
>>> I'm going to extend the display to oblique angles of the plane.  I
> need the full transform to do that.  I'm just using sagittal and coronal
> to get me started.
>>> 
>>>               -- Scott
>>> 
>>> -----Original Message-----
>>> From: Jothy [mailto:jothybasu at gmail.com]
>>> Sent: Tuesday, April 27, 2010 12:28 PM
>>> To: Scott Johnson
>>> Cc: vtkusers at vtk.org
>>> Subject: Re: [vtkusers] Where's my Reslice?
>>> 
>>> Hi Scott,
>>> 
>>> You don't need to use the transform for displaying the sagittal and
>>> coronal views. Just set SetSliceOrientationToYZ &
>>> SetSliceOrientationToXZ and set slice.
>>> 
>>> Jothy
>>> 
>>> On Tue, Apr 27, 2010 at 6:20 PM, Scott Johnson
>>> <Scott.Johnson at neuwave.com> wrote:
>>>> Hi Folks,
>>>> 
>>>> 
>>>> 
>>>> I'm trying to display image planes in a vtkImageViewer2 without much
> luck.
>>>> My current pipeline looks like:
>>>> 
>>>> 
>>>> 
>>>>                                                    vtkTransform
>>>> 
>>>>                                                                |
>>>> 
>>>>                                                                V
>>>> 
>>>> vtkDICOMImageReader->vtkImageReslice->vtkImageViewer2
>>>> 
>>>> 
>>>> 
>>>> If I try to display an Axial slice, it works fine, if I try to
> display
>>>> sagittal or coronal slices I don't see the images.  If I insert a
>>>> vtkImageChangeInformation object after the vtkDICOMImageReader, I
> can see
>>>> the sagittal and coronal images as well as the axial.  This causes a
> problem
>>>> because I am trying to coordinate other displays with the resliced
> result.
>>>> I need to see the images without using the vtkImageChangeInformation
> object.
>>>> 
>>>> 
>>>> 
>>>> I've tried to explicitly set the bounds on the vtkImageActor managed
> by the
>>>> vtkImageViewer2, with no luck.  I've also tried to place the
> vtkCamera to
>>>> point at the center of the plane along the direction of the normal.
> Didn't
>>>> work either.
>>>> 
>>>> 
>>>> 
>>>> There may be a fundamental misunderstanding on my part as to how
>>>> vtkImageReslice works.  I am assuming that the resulting resliced
> volume
>>>> would be displayed the same as an axial image, so I am leaving the
>>>> vtkImageViewer2->SetSliceOrientationXY() and moving between slices
> with the
>>>> SetSlice method.
>>>> 
>>>> 
>>>> 
>>>> The eventual goal is to reslice the image volume at oblique angles,
> but I
>>>> figure I'm on the right track if I can get the sagittal and coronal
> images
>>>> to display correctly.
>>>> 
>>>> 
>>>> 
>>>> I'm concerned that vtkImageViewer2 is doing something for me that I
> don't
>>>> want it to do.  Do I need to manage my own vtkImageActor?
>>>> 
>>>> 
>>>> 
>>>> A code snippet for the Coronal images follows:
>>>> 
>>>> (input is the vtkDICOMImageReader)
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>>    _transform = vtkTransform::New();
>>>> 
>>>>    _transform->RotateZ(0.0);
>>>> 
>>>>    _transform->RotateX(90.0);
>>>> 
>>>>    _transform->RotateY(0.0);
>>>> 
>>>> 
>>>> 
>>>>    _reslice = vtkImageReslice::New();
>>>> 
>>>>    _reslice->SetOutputDimensionality(3);
>>>> 
>>>>    _reslice->SetResliceTransform(_transform);
>>>> 
>>>>    _reslice->SetInputConnection(input);
>>>> 
>>>>    _reslice->Update();
>>>> 
>>>> 
>>>> 
>>>>    inputData=vtkImageData::SafeDownCast(_reslice->GetInput());
>>>> 
>>>>    inputData->GetCenter(center);
>>>> 
>>>>    _transform->Translate(center[0], center[1], center[2]);
>>>> 
>>>> 
>>>> 
>>>>    _interactor = vtkRenderWindowInteractor::New();
>>>> 
>>>> 
>>>> 
>>>>    _imageViewer = vtkImageViewer2::New();
>>>> 
>>>>    _imageViewer->SetupInteractor(_interactor);
>>>> 
>>>>    _imageViewer->SetSize(400, 400);
>>>> 
>>>>    _imageViewer->SetColorWindow(1024);
>>>> 
>>>>    _imageViewer->SetColorLevel(800);
>>>> 
>>>>    _imageViewer->SetInputConnection(_reslice->GetOutputPort());
>>>> 
>>>> 
>>>> 
>>>> Any ideas appreciated.
>>>> 
>>>> 
>>>> 
>>>> Thanks
>>>> 
>>>> 
>>>> 
>>>>                                -- Scott
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>> 
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>> 
>>>> Please keep messages on-topic and check the VTK FAQ at:
>>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>> 
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>> 
>>>> 
>>> 
>> _______________________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>> 
>> Please keep messages on-topic and check the VTK 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