Closed taipingqu closed 5 years ago
I'll have an easier time helping if you use the current programs and syntax as I suggested in your other issue
https://github.com/ANTsX/ANTs/issues/691#issuecomment-453145878
If it's not working, you need to provide a reproducible example including all commands and the data. The correct ordering of transforms depends on how the registration was called. It's impossible to tell from the warp command alone.
@cookpa My command is "WarpImageMultiTransform 3 aseg.nii asegwarp.nii.gz -R atlas.nii --use -NN test2Warped.nii.gz test20GenericAffine.mat". The data I have added to the attachment. Where "test20GenericAffine.mat", "test2Warped.nii.gz", "test2InverseWarped.nii.gz" is my command "antsRegistrationSyNQuick.sh -d 3 -ta -f atlas.nii -m brainmask.nii - o test2"Generated. "atlas.nii" is the template for my affine transformation, "brainmask.nii" is the original data before I do the affine transformation.
aseg.nii is the segmentation data I generated by Freesurfer, which is the segmentation data of brainmask.nii.
test2InverseWarped.nii.gz test2Warped.nii.gz affine_mat.zip data2.zip
My purpose is: warp aseg.nii into the atlas.nii space by using "warpimagemultitransform"
Can an expert help me solve the above problem?
So this works fine for me:
antsRegistrationSyNQuick.sh -d 3 -t a -f atlas.nii.gz -m brainmask.nii.gz -o test2
I can reproduce the warped output with
antsApplyTransforms -d 3 -i brainmask.nii.gz -r atlas.nii.gz -t test20GenericAffine.mat -o test2WarpedAgain.nii.gz
Now any image in the same space as "brainmask.nii.gz" can be warped to "atlas.nii.gz" with the above command.
antsApplyTransforms -d 3 -i aseg.nii.gz -r atlas.nii.gz -t test20GenericAffine.mat -o asegWarped.nii.gz -n GenericLabel
Or the old way
WarpImageMultiTransform 3 aseg.nii.gz atlas.nii.gz asegWarpedWIMT.nii.gz -R atlas.nii.gz --use-NN test20GenericAffine.mat
One problem I see is that the physical space of atlas.nii.gz
looks wrong. It's possible that the left and right hemispheres have been flipped. You should fix this so that the moving and fixed images have the correct anatomical markers in ITK-SNAP, which uses the same I/O to interpret images as ANTs.
Thank you very much for your question, I have tried to change it. By visualizing I found that atlas.nii.gz is flipping along the x axis, so I executed "PermuteFlipImageOrientationAxes 3 atlas.nii new_atlas.nii 0 1 2 1 0 0 " and then executed "CopyImageHeaderInformation atlas.nii new_atlas.nii new_atlas_copy.nii 1 0 1 ", "CopyImageHeaderInformation" I did not find a detailed description, the parameters should be wrong. How should I fix it? To get the correct physical space.
Run PermuteFlipImageOrientationAxes
on your atlas until it is correct. Then re-run the registration to the corrected atlas.
Dear ANTs expert, I have affine transformed the MRI T1 volume data by "antsRegistrationSyNQuick.sh" and obtained the affine matrix affine.mat. I want to warp the segmentation data corresponding to the volume data (the aseg.nii generated by Freesurfer). I used "WarpImageMultiTransform" and my command is "WarpImageMultiTransform 3 OASISaseg.nii asegwarp.nii.gz -R atlas.nii --use -NN test2Warped.nii.gz test20GenericAffine.mat", where "atlas.nii" is an affine alignment template for my volume, "test2Warped.nii.gz and test20GenericAffine.mat" are the aligned volumes generated by the affine transformation respectively. And the affine matrix, "OASISaseg.nii" is the segmentation data I want to warp, but I found that I wrote a problem like this, although I can generate data, and later I changed the command to generate data that is not related to the data after -R. What is the problem with my order above?