Part of ants registration suite
antsApplyTransformsToPoints
antsApplyTransformsToPoints, applied to an input image, transforms it according to a reference image and a transform (or a set of transforms). reads in a csv file with the first D columns defining the spatial location where the spatial location is defined in physical coordinates. the csv file should have a header row. here is an example
cat chicken-3.csv
x,y,z,t,label,comment
82.5,116.5,0,0,1,this is the breast 137.5,35.5,0,0,2,this
is the beak
antsApplyTransformsToPoints -d 2 -i chicken-3.csv -o test.csv -t
[chicken3to4.mat ,1 ]
cat test.csv
x,y,z,t,label,comment 10.8945447481644,162.082675013049,0,0,1,nan 7.5367085472988,52.099713111629,0,0,2,nan the nan appears in the last column until the ITK CSV I/O can handle mixed numeric /
string types. if your input is fully numeric, all is well.
-d, --dimensionality 2/3
This option forces the points to be treated as a specified-dimensionality. -i, --input inputFileName
Currently, the only input supported is a csv file with columns including x,y,z,t (all 4) column headers. if you dont have 4D data, still supply 4D filling in extra places with zero. The points should be defined in physical space. Points are transformed in the OPPOSITE direction of images, therefore you should pass the inverse of what is needed to warp the images. Eg if the image is warped by Affine.mat, you should pass the inverse of Affine.mat to transform points defined in the same space as the image. If in doubt how to convert coordinates from your files to the space required by antsApplyTransformsToPoints try creating/drawing a simple label volume with only one voxel set to 1 and all others set to 0. Write down the voxel coordinates. Then use ImageMaths LabelStats to find out what coordinates for this voxel antsApplyTransformsToPoints is expecting. -o, --output warpedOutputFileName
One can output the warped points to a csv file.
-t, --transform transformFileName
[transformFileName,useInverse]
Several transform options are supported including all those defined in the ITK library in addition to a deformation field transform. The ordering of the transformations follows the ordering specified on the command line. An identity transform is pushed onto the transformation stack. Each new transform encountered on the command line is also pushed onto the transformation stack. Then, to warp the input object, each point comprising the input object is warped first according to the last transform pushed onto the stack followed by the second to last transform, etc. until the last transform encountered which is the identity transform. Also, it should be noted that the inverse transform can be accommodated with the usual caveat that such an inverse must be defined by the specified transform class -h
Print the help menu (short version). <VALUES>: 0 --help
Print the help menu. <VALUES>: 1, 0