Hi david,<br><br>This 2 reslicer trick is what I needed!<br><br>Thanks a ton! You rock!<br><br>Pankaj<br><br><div><span class="gmail_quote">On 10/30/06, <b class="gmail_sendername">David Gobbi</b> <<a href="mailto:dgobbi@atamai.com">
dgobbi@atamai.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Pankaj Daga wrote:<br>> Hi David,<br>><br>> Thanks for the tip! However, I am not using AutoCropOutput() and all
<br>> that as it never worked how I intended.<br><br>Yeah, that method is not one of my favorites. Not everyone wants their<br>images to be cropped the same way, so the only way "AutoCrop" could be<br>really automatic is if it could read minds. The method does work as the
<br>documentation describes, though.<br><br>> I mean, I could set the output extent etc. by hand again, but the<br>> output of the reslicer is attached to a viewer and that would cause<br>> the viewer to also change its output.
<br>><br>> So, I was thinking that I could just resample the image again and that<br>> should take care of everything.<br><br>Oh, that explains things. If you need two reslicers, here is what you<br>can for the second one:
<br><br>reslice2 = vtkImageReslice::New();<br>reslice2->SetInput(reslice1->GetOutput());<br>reslice2->SetInformationInput(reslice1->GetInput());<br>reslice2->TransformInputSamplingOff();<br>reslice2->SetInterpolationModeToLinear();
<br><br>The combination of SetInformationInput() to set the original image, and<br>TransformInputSamplingOff(), will cause vtkImageReslice to produce an<br>image with the same extent, spacing, and origin as the original image,
<br>if this is what you want.<br><br>If this isn't what you want, you might have to manually set the<br>OutputExtent(), OutputSpacing(), and OutputOrigin(). One of the best<br>ways to do this is to add an observer for ExecuteInformationEvent to the
<br>reslicer. That way, you can add a callback that will adjust the<br>information every time that reslice executes.<br><br> - David<br><br>><br>> Best regards,<br>><br>> Pankaj<br>><br>> On 10/30/06, * David Gobbi* <
<a href="mailto:dgobbi@atamai.com">dgobbi@atamai.com</a><br>> <mailto:<a href="mailto:dgobbi@atamai.com">dgobbi@atamai.com</a>>> wrote:<br>><br>> Hi Pankaj,<br>><br>> I think that what you want is this:
<br>><br>> reslice->TransformInputSamplingOff();<br>> reslice->AutoCropOutputOff();<br>><br>> That should cause vtkImageReslice to automatically produce an output<br>> with the same spacing, origin, and dimensions as the input, so
<br>> that you<br>> will not have to re-resample the output.<br>><br>> - David<br>><br>><br>><br>> Pankaj Daga wrote:<br>> > Hi everyone,<br>> ><br>> > I do some oeprations on an image and then I need to save a resulting
<br>> > image. Now to generate the resulting image, I use the output from<br>> > vtkImageReslice which has changed the image dimensions according to<br>> > the output spacing and output extent parameters. However, I want to
<br>> > save the resulting image with the same size as the input image.<br>> ><br>> > Does anyone know what is the best way to resample the output<br>> image and<br>> > convert it to the same image dimensions as the input image? Some
<br>> code<br>> > snippet would be really appreciated.<br>> ><br>> > Best wishes,<br>> > P<br>> ><br>> ------------------------------------------------------------------------
<br>> ><br>> > _______________________________________________<br>> > This is the private VTK discussion list.<br>> > Please keep messages on-topic. Check the FAQ at:<br>> <a href="http://www.vtk.org/Wiki/VTK_FAQ">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>> > Follow this link to subscribe/unsubscribe:<br>> > <a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>> >
<br>><br>><br><br></blockquote></div><br>