Saving transformed Volumes

Hi, I am trying to save binary labelmaps that I have transformed with specific transform files. The problem is that I have clicked the harden transform button, but when I go to save the files, they do not save in the correct orientation, but rather the initial orientation. Is there an easy way to save the new matrices corresponding to the transformed labelmaps?

In addition, is there a way to save a transformed segmentation? Again, I have tried hardening the renasform and saving the seg.nrrd file, but the outcome is the original segmentation orientation, and not the transformed orientation.

Hardening linear transforms on volumes don’t require changing voxel values, you’ll only see result of hardening as an update in axis direction information. This operation is fast, reversible, and no information is lost.

To deal with software that don’t work in physical space (ignores axis direction information, etc) you can export the segmentation into a labelmap volume. You can specify any volume as a reference volume and voxels will be resampled into that voxel grid. See https://www.slicer.org/wiki/Documentation/Nightly/Modules/Segmentations for details.

1 Like

How would you go about saving the volume that is transformed then?

To resample volumes, use Resample Scalar Volume and similar resample modules.

1 Like

Here is a summary of the great answers of @lassoan :

What is the effect of Hardening linear transforms ?

How to deal with software that don’t work in physical space ?

For segmentations

For Volumes

Hi there, don’t know have you resolved your dilemma or not. I faced the same trouble when trying to save transformed model. It turned out that we need to select the files ( right click) in the transformed object box before hitting the hardening button. After clicking hardening, the files from the transformed object box will move back to the transformable box. Then you can save the transformed files.
Hope it helps^^

how to do harden transform using python script?

regards,
Saima

Once you have a transformable node that has an associated transform (e.g. like this), you can call the HardenTransform() method on that node: transformableNode.HardenTransform().

2 Likes