[vtkusers] Question about image resampling
Pankaj Daga
deluded.soul at gmail.com
Mon Oct 30 11:36:47 EST 2006
Hi david,
This 2 reslicer trick is what I needed!
Thanks a ton! You rock!
Pankaj
On 10/30/06, David Gobbi <dgobbi at atamai.com> wrote:
>
> Pankaj Daga wrote:
> > Hi David,
> >
> > Thanks for the tip! However, I am not using AutoCropOutput() and all
> > that as it never worked how I intended.
>
> Yeah, that method is not one of my favorites. Not everyone wants their
> images to be cropped the same way, so the only way "AutoCrop" could be
> really automatic is if it could read minds. The method does work as the
> documentation describes, though.
>
> > I mean, I could set the output extent etc. by hand again, but the
> > output of the reslicer is attached to a viewer and that would cause
> > the viewer to also change its output.
> >
> > So, I was thinking that I could just resample the image again and that
> > should take care of everything.
>
> Oh, that explains things. If you need two reslicers, here is what you
> can for the second one:
>
> reslice2 = vtkImageReslice::New();
> reslice2->SetInput(reslice1->GetOutput());
> reslice2->SetInformationInput(reslice1->GetInput());
> reslice2->TransformInputSamplingOff();
> reslice2->SetInterpolationModeToLinear();
>
> The combination of SetInformationInput() to set the original image, and
> TransformInputSamplingOff(), will cause vtkImageReslice to produce an
> image with the same extent, spacing, and origin as the original image,
> if this is what you want.
>
> If this isn't what you want, you might have to manually set the
> OutputExtent(), OutputSpacing(), and OutputOrigin(). One of the best
> ways to do this is to add an observer for ExecuteInformationEvent to the
> reslicer. That way, you can add a callback that will adjust the
> information every time that reslice executes.
>
> - David
>
> >
> > Best regards,
> >
> > Pankaj
> >
> > On 10/30/06, * David Gobbi* <dgobbi at atamai.com
> > <mailto:dgobbi at atamai.com>> wrote:
> >
> > Hi Pankaj,
> >
> > I think that what you want is this:
> >
> > reslice->TransformInputSamplingOff();
> > reslice->AutoCropOutputOff();
> >
> > That should cause vtkImageReslice to automatically produce an output
> > with the same spacing, origin, and dimensions as the input, so
> > that you
> > will not have to re-resample the output.
> >
> > - David
> >
> >
> >
> > Pankaj Daga wrote:
> > > Hi everyone,
> > >
> > > I do some oeprations on an image and then I need to save a
> resulting
> > > image. Now to generate the resulting image, I use the output from
> > > vtkImageReslice which has changed the image dimensions according
> to
> > > the output spacing and output extent parameters. However, I want
> to
> > > save the resulting image with the same size as the input image.
> > >
> > > Does anyone know what is the best way to resample the output
> > image and
> > > convert it to the same image dimensions as the input image? Some
> > code
> > > snippet would be really appreciated.
> > >
> > > Best wishes,
> > > P
> > >
> >
> ------------------------------------------------------------------------
> > >
> > > _______________________________________________
> > > 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/20061030/952bd61d/attachment.htm>
More information about the vtkusers
mailing list