[vtkusers] vtkImageResample crashes on MacOSX

David Gobbi david.gobbi at gmail.com
Wed Apr 9 15:26:32 EDT 2008


Hi Luca,

It might crash if the spacing is set to zero, which could happen if
the DICOM file does not give any pixel spacing.

Other than that, can you try something for me to help trace the error?
 Just try using vtkImageReslice instead, it is the base class of
vtkImageResample.  That way I will know which file to check when I'm
looking for possible errors.

vtkImageReslice *sampler = vtkImageReslice::New();
sampler->SetInput(reader->GetOutput());
sampler->SetOutputSpacing(spacing[0]/2.0, spacing[1]/2.0, spacing[2]);
sampler->Update();

The SetDimensionality method is not necessary if you are just
resampling a 2D image, so I have taken it out.

  David


On Wed, Apr 9, 2008 at 3:12 PM, Luca Pamparana <luca.pamparana at gmail.com> wrote:
> Hi everyone,
>
> I am trying to resample as image as follows:
>
>
>
>  double * spacing = vtkDicomReader->GetOutput()->GetSpacing();
>
>
>
> vtkImageResample * sampler = vtkImageResample::New();
>
> sampler->SetInput(vtkDicomReader->GetOutput());
>
> sampler->SetDimensionality(2);
>
> sampler->SetAxisOutputSpacing(0, spacing[0] / 2.0);
>
> sampler->SetAxisOutputSpacing(1, spacing[1] / 2.0);
>
> sample->Update();
>
>
>
>
>  However, this code crashes on the MacOSX. Does not matter if I try using
> the SetAxisOutputSpacing or the SetAxisMagnificationFactor. Somehow the
> upsampling operation always crashes.
>
>
>
>
> Is there something I am missing?
>
>
>
>
> Thanks,
>
> Luca
> _______________________________________________
>  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
>
>



More information about the vtkusers mailing list