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

ENH: Expose forward/inverse cumulative velocity fields. #1630

Merged
merged 1 commit into from
Dec 2, 2023

Conversation

ntustison
Copy link
Member

@ntustison ntustison commented Dec 1, 2023

input=test.nii.gz
outputPrefix=thickness

# ${input} is the segmentation
# ${outputPrefix}Warped.nii.gz is the tiled 2-D segmentation images warped according to the integration point velocity fields

KellyKapowski -d 2 \
              -s "[${input},1,2]" \
              -o "[${outputPrefix}.nii.gz,${outputPrefix}]" \
              -v 1

ConvertImage 2 ${outputPrefix}InverseVelocityField.nii.gz ${outputPrefix}InverseVelocityField 11

# Go over integration points
for i in {1..9}; 
  do 
    ExtractSliceFromImage 3 ${outputPrefix}InverseVelocityFieldxvec.nii.gz ${outputPrefix}InverseFieldxvec.nii.gz 2 $i
    ExtractSliceFromImage 3 ${outputPrefix}InverseVelocityFieldyvec.nii.gz ${outputPrefix}InverseFieldyvec.nii.gz 2 $i
    ConvertImage 2 ${outputPrefix}InverseField ${outputPrefix}InverseField.nii.gz 9
    # CreateWarpedGridImage 2 ${outputPrefix}InverseField.nii.gz ${outputPrefix}WarpedGrid${i}.nii.gz
    antsApplyTransforms -d 2 -i ${input} \
                             -r ${input} \
                             -o testWarped${i}.nii.gz \
                             -n NearestNeighbor \
                             -t ${outputPrefix}InverseField.nii.gz  
  done

TileImages 3 testWarped.nii.gz 1x1x0 testWarped?.nii.gz
rm -f ${outputPrefix}InverseField*.nii.gz
rm -f testWarped?.nii.gz
rm -f ${outputPrefix}InverseVelocityField?vec.nii.gz

test.nii.gz
testWarped.nii.gz
thickness.nii.gz

@ntustison ntustison merged commit 0ea8e53 into master Dec 2, 2023
1 check passed
@ntustison ntustison deleted the SaveCumulativeFields branch December 2, 2023 18:50
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

Successfully merging this pull request may close these issues.

None yet

1 participant