HI David,<br><br>The vtkImageReslice does not crash but it does something very strange.<br><br>My input data to it was in the range 0-255 but the output seems to be in the range of 0-1. I have a feeling it is not returning anything. If you want, I can email you the Dicom file. I am running this from within Osirix though.<br>
<br>The input is a single Dicom slice (2D) and the spacing values in it are around 2.9, 2.9 and the through slice spacing is 10.0. However, this should not be relevant as we are only working on a single slice.<br><br>Cheers,<br>
Luca<br><br><div class="gmail_quote">On Wed, Apr 9, 2008 at 8:26 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Hi Luca,<br>
<br>
It might crash if the spacing is set to zero, which could happen if<br>
the DICOM file does not give any pixel spacing.<br>
<br>
Other than that, can you try something for me to help trace the error?<br>
Just try using vtkImageReslice instead, it is the base class of<br>
vtkImageResample. That way I will know which file to check when I'm<br>
looking for possible errors.<br>
<br>
vtkImageReslice *sampler = vtkImageReslice::New();<br>
sampler->SetInput(reader->GetOutput());<br>
sampler->SetOutputSpacing(spacing[0]/2.0, spacing[1]/2.0, spacing[2]);<br>
sampler->Update();<br>
<br>
The SetDimensionality method is not necessary if you are just<br>
resampling a 2D image, so I have taken it out.<br>
<br>
David<br>
<br>
<br>
On Wed, Apr 9, 2008 at 3:12 PM, Luca Pamparana <<a href="mailto:luca.pamparana@gmail.com">luca.pamparana@gmail.com</a>> wrote:<br>
</div><div><div></div><div class="Wj3C7c">> Hi everyone,<br>
><br>
> I am trying to resample as image as follows:<br>
><br>
><br>
><br>
> double * spacing = vtkDicomReader->GetOutput()->GetSpacing();<br>
><br>
><br>
><br>
> vtkImageResample * sampler = vtkImageResample::New();<br>
><br>
> sampler->SetInput(vtkDicomReader->GetOutput());<br>
><br>
> sampler->SetDimensionality(2);<br>
><br>
> sampler->SetAxisOutputSpacing(0, spacing[0] / 2.0);<br>
><br>
> sampler->SetAxisOutputSpacing(1, spacing[1] / 2.0);<br>
><br>
> sample->Update();<br>
><br>
><br>
><br>
><br>
> However, this code crashes on the MacOSX. Does not matter if I try using<br>
> the SetAxisOutputSpacing or the SetAxisMagnificationFactor. Somehow the<br>
> upsampling operation always crashes.<br>
><br>
><br>
><br>
><br>
> Is there something I am missing?<br>
><br>
><br>
><br>
><br>
> Thanks,<br>
><br>
> Luca<br>
</div></div><div><div></div><div class="Wj3C7c">> _______________________________________________<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" target="_blank">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" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
</div></div></blockquote></div><br>