Skip to content

Transformix not returning transformation field #20

@w013nad

Description

@w013nad

In transformix, it's supposed to be possible to output a deformation field rather than an image. (I'm working with hyperspectral so it's much easier to get the deformation field and transform all the layers individually using the deformation field. Anyway, I came up with a fix outlined below. Note that the fix is tailored to my needs. This is for a 2D image, not sure how it would work for 3D
Originally I did get an output but it was an empty 1x1 stucture

fid = fopen(fullfile(outputDir,'deformationField.raw'));
raw_out = fread(fid,Inf,'float');
out_points(:,:,1) = reshape(raw_out(1:2:end),size_im(2),size_im(1));
out_points(;,:,2) = reshape(raw_out(2:2:end),size_im(2),size_im(1));
out_points = permute(out_points,[2,1,3]);

From there, I'm able to just cycle through and call
for ii = 1:num_channels
out(:,:,ii) = imwarp(moving(:,:,ii),out_points);
end

I originally just ran all the layers through but this comes out to a 1.5 minutes saving per data cube processed.

Also, how to I insert code formatting here? Not used to github.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dead issueno activity for ages

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions