[vtkusers] vtkImageResample crashes on MacOSX

David Gobbi david.gobbi at gmail.com
Wed Apr 9 16:09:44 EDT 2008


The exact same code works fine on my machine (linux, though, not Mac,
and not inside Osirix).  I don't suppose there is any way that you can
send the vtkDICOMImageReader.cxx and vtkImageReslice.cxx, so they can
be compared against the latest versions?

   David


On Wed, Apr 9, 2008 at 3:58 PM, Luca Pamparana <luca.pamparana at gmail.com> wrote:
> Sorry....my mistake...It does crash!
>
> The code is as follows (in objective C and C++)
>
>
>
>  vtkDICOMImageReader * vtkDicomReader = vtkDICOMImageReader::New();
>
> vtkDicomReader->SetFileName([fileName cString]);
>
> vtkDicomReader->Update();
>
>
>
>
>
> double * spacing = vtkDicomReader->GetOutput()->GetSpacing();
>
>
>
>
>
>
>  vtkImageReslice * sampler = vtkImageReslice::New();
>
> sampler->SetInput(vtkDicomReader->GetOutput());
>
>
> sampler->SetOutputSpacing(spacing[0] / 2.0, spacing[1]/ 2.0, spacing[2]);
>
> sampler->Update();
>
> I have attached the DICOM file with the email.
>
> Thanks,
> Luca
>
>
>
>
>
>
> On Wed, Apr 9, 2008 at 8:52 PM, Luca Pamparana <luca.pamparana at gmail.com>
> wrote:
>
> > 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
> > > >
> > > >
> > >
> >
> >
>
>



More information about the vtkusers mailing list