[vtkusers] vtkImageViewer2 is resetting the z spacing
Darshan Pai
darshanpai at gmail.com
Wed Oct 13 14:44:15 EDT 2010
I had some problem like this before . To circumvent that I just used
vtkImageChangeInformation and changed the spacing manually .
That solved the spacing problem temporarily but I am not aware of any
particular fix
Regards
Darshan
On Wed, Oct 13, 2010 at 1:53 PM, Mark Roden <mmroden at gmail.com> wrote:
> Hi all,
>
> I have a medical image dataset that has a z spacing of 3.0 pixels (1.17 in
> the x and y dimensions). I'm using Java wrapping vtk and gdcm on 64 bit
> windows 7.
>
> I load the image using vtkGDCMImageReader and the IPPSorter, and in the
> end, do this to set the proper z spacing:
>
> double[] spacing = new double[3];
> spacing = gdcmReader.GetOutput().GetSpacing();
> spacing[2] = sorter.GetZSpacing();
> imageData = gdcmReader.GetOutput();
> imageData.SetSpacing(spacing);
>
> Then I try to load three views on the data with vtkImageViewer2. The
> following functions reset the z spacing to be 1.0:
>
> vtkImageViewer2 imageViewer = new vtkImageViewer2();
> imageViewer.SetInput(imageData); //resets z spacing to 1.0
> imageData.SetSpacing(spacing); //attempt to fix
>
> imageViewer.SetSlice((imageViewer.GetSliceMax() +
> imageViewer.GetSliceMin()) / 2); //resets z spacing to 1.0
> imageData.SetSpacing(spacing); //attempt to fix
>
> //navigation slider on display
> slider = new JSlider();
> slider.setOrientation(JSlider.VERTICAL);
> slider.setMinimum(imageViewer.GetSliceMin());//resets
> slider.setMaximum(imageViewer.GetSliceMax());//resets
> imageViewer.GetInput().SetSpacing(spacing);//attempt to fix
>
> Even with all those attempts to fix, the XZ and YZ orientations still
> display the image as if the z spacing is 1.0, instead of 3.0.
>
> What's going on? Why is vtkImageViewer2 changing ANYTHING to do with the
> original image, rather than just straight up displaying what it's told to
> display?
>
> Thanks,
> Mark
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK 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/20101013/c788611d/attachment.htm>
More information about the vtkusers
mailing list