Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transforming points #97

Open
taborzbislaw opened this issue Jun 26, 2023 · 3 comments
Open

transforming points #97

taborzbislaw opened this issue Jun 26, 2023 · 3 comments

Comments

@taborzbislaw
Copy link

I would like to determine how the points in the moving image are mapped to the points in the moving image registered to the fixed image. How to get this information? reg_f3d only returns the moving image registered to the fixed image but correspondence between the points in the moving image and in the registered moving image are lost.
Thank you in advance for help.

@taborzbislaw taborzbislaw changed the title transformin points transforming points Jun 26, 2023
@taborzbislaw
Copy link
Author

Or at least how to apply transform between moving and fixed image to some other image e.g. mask

@mmodat
Copy link
Contributor

mmodat commented Jul 10, 2023

Hi,

reg_f3d returns the warped floating (moving) image as well as the control point grid that encodes the transformation. The default name for the grid is outputCPP.nii. You can change the output filename using the -cpp argument.

Should you want to obtain a dense deformation or displacement field, you can use reg_transform to convert the control point grid into a dense field:
reg_transform -ref referenceFile -def CPP_from_f3d output_deformation
reg_transform -ref referenceFile -disp CPP_from_f3d output_displacement

The deformation and displacement fields are saved as 5D images with dimension <dimX, dimY, 1, 1, 2> and <dimX, dimY, dimZ, 1, 3> for 2D and 3D respectively, where dimX, dimY and dimZ are the number of voxel along each axis of your reference (fixed) image. Assuming 3D images, the deformation or displacement at position x, y, z along the x-, y- and z-axis are stored in [x, y, z, 0, 0], [x, y, z, 0, 1] and [x, y, z, 0, 2] respectively.

Note that the transformation are encoded from the reference to the floating space and all is stored in physical space (mm) rather than voxel space.

Hope that helps.

@koegl
Copy link

koegl commented Mar 20, 2024

Hi,

reg_f3d returns the warped floating (moving) image as well as the control point grid that encodes the transformation. The default name for the grid is outputCPP.nii. You can change the output filename using the -cpp argument.

Should you want to obtain a dense deformation or displacement field, you can use reg_transform to convert the control point grid into a dense field: reg_transform -ref referenceFile -def CPP_from_f3d output_deformation reg_transform -ref referenceFile -disp CPP_from_f3d output_displacement

The deformation and displacement fields are saved as 5D images with dimension <dimX, dimY, 1, 1, 2> and <dimX, dimY, dimZ, 1, 3> for 2D and 3D respectively, where dimX, dimY and dimZ are the number of voxel along each axis of your reference (fixed) image. Assuming 3D images, the deformation or displacement at position x, y, z along the x-, y- and z-axis are stored in [x, y, z, 0, 0], [x, y, z, 0, 1] and [x, y, z, 0, 2] respectively.

Note that the transformation are encoded from the reference to the floating space and all is stored in physical space (mm) rather than voxel space.

Hope that helps.

I'm trying to use the output_displacement in 3D Slicer to deform the reference image, however, I get very different (I guess) results than from the output of reg_f3d. Do you maybe have an idea why this might be the case?

I'm wondering if the fact that it is stored in physical space has something to do with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants