Volume rendering not centered

I’m running into an issue where my volume rendering is not centered. I’ve attached a picture of the result that occurs:

Ideally, the aorta would be centered within the box. I realize I can click on the centering button and have the volume centered automatically. However, this change is only temporary and I need to have this center made permanent. Is there a way for me to edit the .nrrd file directly such as changing the space origin : (vector)? Or is it possible to bake this in as a transform? Any guidance would be appreciated.

It looks like you realize that this little button at the top of the 3D view to center the box and view to your current data. That’s the suggested approach since it doesn’t modify your data.


But another alternative is to use the Volumes module’s “Center Volume” button. Then you can save and restore the centered volume as nrrd. This is effectively the same as hardening a transform or changing the origin manually.

“Center Volume” overwrites the volume’s position without any way to recover it later. It makes all registrations, segmentations, markups, etc. associated with the volume invalid. So, I would not recommend using this feature unless there is absolutely no other way of achieving something.

Applying a centering transform is fine, because you can save that transform, apply it to other associated nodes, etc.

Is that doable through GUI? It may be useful addition.

No gui option currently. Perhaps in the volume module we should add an ‘add centering transform’ button option.

Thank you to all for the helpful suggestions. I had used the dreaded “Center Volume” operation before, but I was saving it to a different path and therefore very confused as to why the changes I made weren’t being saved. After finding the correct file, it works as intended.

Thank you for the suggestions, I do have a further question regarding “Center Volume”. When you say that it makes “all registrations, segmentations, markups, etc. associated with the volume invalid.” that only applies to the operations already performed on the image correct? If I were to center volume and then try to register, that would be fine? Also the image I’m trying to center is a segmented piece of a CT scan so that I can highlight it when overlaying it on the original.

Image geometry is described with respect to a frame of reference, so any coordinates or orientations that share the same frame of reference (denoted by FrameOfReferenceUID in the dicom header) can be compared and overlaid with some confidence, modulo patient motion or other issues. Centering the volume destroys that. But if you center first, and then use that new coordinate system you should be okay, even if it makes some of us cringe : )

I apologize for the inadvertent cringe causing. Is there a better way to solve the problem? If I don’t use center volume, the ITK software will be rotating my image around a point 200 mm above where any meaningful data is, making the images I receive from that part blank. Also I’m trying to use transforms to change the rotation of the original image but even when I harden them they don’t appear to take to the .nrrd file. I’d hate to cause some more cringing, but is there a way to alter the rotation parameters of the .nrrd file also?

Yes, I’m one of those…

What ITK software? There are lots of ITK transforms, most of them are parametrized so that you can specify a center of rotation, regardless of what frame of reference the volume is defined in.

I’m using the rtk forward projection program. The parameters it takes are i,j,k axes rotation and x,y translation. You’re correct, I can center my image correctly by adjusting those parameters, but this relies heavily on guess & check, which would need to be repeated whenever I have a new CT.

Note that for forward projection (DRR generation by raycasting) you may not need RTK, but Slicer’s GPU-accelerated raycaster (volume renderer) should work well. The advantage that it is very fast (can render tens of images per second) and integrated into the application - the only limitation is that it can only create 8-bit image (i.e., the displayed image that you get after dynamic range compression of a 10-12-bit X-ray image).

If you want to use RTK then transforming the volume to the origin makes sense, as RTK does not support 3D positioning of the isocenter (it assumes to be in the origin).

This is a great idea. We should simply change the centering function so that it crates and applies a transform, but does not harden it. This preserves all information, allows users to apply the same transform to other nodes, and it can be easily undone. I added a ticket to keep track of this idea:

Hi all,
Thank you for the many suggestions, however I am still stuck. Centering the volume works great and does exactly what I want it to do. However, when I try to apply a transform and rotate the volume, it doesn’t seem to stick to the .nrrd file even if I harden the transform. Is there a way to permanently rotate the volume?

This is how you “permanently” transform a volume. Either there is something you skip from the process or there is a bug. Can you describe the steps you take when hardening? Screenshots help a lot. Thanks!

Sure can! First I load in my .nrrd file and turn on volume rendering so I can see what I’m working with

Next I switch to the transform module and choose a linear transform to apply. In my case I’m rotating by -90 on the LR axis and 180 on the IS axis. I also select the .nrrd file as my target for the transform.

Next I click the Harden Transformation button.

… and of course now it works as intended…
It seems that I was not selecting the transform target before clicking on the harden transform button. Whoops

Great, I’m glad it worked. Yes, you need to select the transformed node and then click the harden button.

If the next time it doesn’t work, then it might be a bug, but we haven’t had problems with this feature lately.