[vtkusers] vtkImageResample crashes on MacOSX
Luca Pamparana
luca.pamparana at gmail.com
Wed Apr 9 15:52:11 EDT 2008
HI David,
The vtkImageReslice does not crash but it does something very strange.
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.
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.
Cheers,
Luca
On Wed, Apr 9, 2008 at 8:26 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> 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
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080409/f2e19c34/attachment.htm>
More information about the vtkusers
mailing list