Scroll to navigation



antsApplyTransformsToPoints - part of ANTS registration suite



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


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.

**** We now can also

read / write .mha files.

This is a simple binary format (Meta format - look it

up!) that is much faster to read/write than csv format.
Note: To write a mha
file, you must also pass an mha file as input.


-d, --dimensionality 2/3

This option forces the points to be treated as a specified-dimensionality.

-p, --precision 0/1


-f, --forantsr 0/1

set true for ANTsR IO

-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. ITK uses a LPS coordinate system. See ***Or pass in a 2D mha (meta format) binary image file.

-o, --output warpedOutputFileName

One can output the warped points to a csv file.
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


Print the help menu (short version). <VALUES>: 0


Print the help menu. <VALUES>: 1, 0
October 2017 antsApplyTransformsToPoints 2.2.0