Hi all,<br><br>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.<br><br>I load the image using vtkGDCMImageReader and the IPPSorter, and in the end, do this to set the proper z spacing:<br>
<br> double[] spacing = new double[3];<br> spacing = gdcmReader.GetOutput().GetSpacing();<br> spacing[2] = sorter.GetZSpacing();<br> imageData = gdcmReader.GetOutput();<br> imageData.SetSpacing(spacing);<br>
<br>Then I try to load three views on the data with vtkImageViewer2. The following functions reset the z spacing to be 1.0:<br><br>vtkImageViewer2 imageViewer = new vtkImageViewer2();<br>imageViewer.SetInput(imageData); //resets z spacing to 1.0<br>
imageData.SetSpacing(spacing); //attempt to fix<br><br>imageViewer.SetSlice((imageViewer.GetSliceMax() + imageViewer.GetSliceMin()) / 2); //resets z spacing to 1.0<br>
imageData.SetSpacing(spacing); //attempt to fix<br><br>//navigation slider on display<br>slider = new JSlider();<br>slider.setOrientation(JSlider.VERTICAL);<br>slider.setMinimum(imageViewer.GetSliceMin());//resets<br>slider.setMaximum(imageViewer.GetSliceMax());//resets<br>
imageViewer.GetInput().SetSpacing(spacing);//attempt to fix<br><br>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.<br><br>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?<br>
<br>Thanks,<br>Mark<br><br><br>