The vtkImageChangeInformation class can change the spacing, put it into your pipeline just after the reader. The way this filter works, is that it makes a shallow copy of the data (it keeps the same voxel array) and attaches new information to the data.
I guess this is result of how the opacity function works, as a function of distance?
Is there a way to change spacing while keeping the opacity ‘constant’?
If the units of the nifti file are millimeters and you want VTK world coordinates to be measured in microns, then scaling by 1000 is the correct thing to do.
Regarding the volume rendering, you will have to adjust sampling distances and opacity functions according to the size of the volume. The opacity function for a volume that’s 10 units from front to back will be very different from a volume that 10000 units from front to back.
Actually, let me clarify: If the units of the nifti file are millimeters and you want VTK world coordinates to be measured in microns, you would do this:
imageChange->SetSpacingScale(1000, 1000, 1000);
and you would not call SetDataSpacing() on anything.
That worked perfect as well! I was afraid I had to figure out origin of volume and do some calculations regarding the extents of the data… But the above just did it. Thanks!