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

WISH: Add antsApplyTransformsToPoints to ANTsR #45

Closed
zarquon42b opened this issue Apr 22, 2015 · 6 comments
Closed

WISH: Add antsApplyTransformsToPoints to ANTsR #45

zarquon42b opened this issue Apr 22, 2015 · 6 comments

Comments

@zarquon42b
Copy link
Contributor

Hi,
as I am mostly dealing with Volume and surface data, I momentarily am using a wrapper called antsTransformPoints* (it is an S3 function) calling the command line tool antsApplyTransformsToPoints to apply the transforms to point sets. It takes care of IJK to RAS transform and works on matrices and meshes of class "mesh3d". Would it be a big issue to implement this in ANTsR?

*) vert2points used from Morpho is simply

vert2points  <- function (mesh) {
    out <- t(mesh$vb[1:3, ])
    return(out)
}

Best
Stefan

@stnava
Copy link
Member

stnava commented Apr 22, 2015

I am in agreement about this and put it on the to do list.
On Apr 22, 2015 9:18 AM, "Stefan Schlager" notifications@github.com wrote:

Hi,
as I am mostly dealing with Volume and surface data, I momentarily am
using a wrapper called antsTransformPoints*
https://github.com/zarquon42b/RANTs/blob/master/R/newAntsExample.r#L45
(it is an S3 function) calling the command line tool
antsApplyTransformsToPoints to apply the transforms to point sets. It takes
care of IJK to RAS transform and works on matrices and meshes of class
"mesh3d". Would it be a big issue to implement this in ANTsR?

*) vert2points used from Morpho is simply

vert2points <- function (mesh) {
out <- t(mesh$vb[1:3, ])
return(out)
}

Best
Stefan


Reply to this email directly or view it on GitHub
#45.

@jefferis
Copy link

Incidentally, @zarquon42b, have you looked at my NeuroAnatomy Toolbox which needs to handle similar kinds of functionality (transforming points, surfaces, linesets and also volumes) – presently only for the CMTK registration suite but I hope to provide ANTs support (via ANTsR) in due course.

For example there is an xform generic to handle transformation of 3d data using registrations, with methods for a few specific cases. The generics for objects are essentially all the same, see:

https://github.com/jefferis/nat/blob/master/R/xform.R#L63-L78

and rely on two helper functions, xyzmatrix and xyzmatrix<- which are used to get and set vertex information for a variety of types with 3d vertices. For rgl::mesh3d objects (which have a base class shape3d), I have done this via

# get
xyzmatrix.shape3d<-function(x, ...){
  cbind(x$vb[1, ]/x$vb[4, ], x$vb[2, ]/x$vb[4, ], x$vb[3, ]/x$vb[4, ])
}

# set
`xyzmatrix<-.shape3d`<-function(x, value){
  x$vb=t(cbind(value, 1))
  x
}

I would be interested to see if we can learn anything from our respective implementations.

Best wishes,

Greg.

@zarquon42b
Copy link
Contributor Author

Hi @jefferis , thanks for the tips, I only had a peak at your package but will look closer. Up until now my own work is mostly based on 3d-point sets (landmarks) and triangular meshes. I have implemented a simple way to compute rigid, affine, similarity and tps deforms for meshes/points based on landmark transforms in computeTransform and applyTransform, as well as some elastic and non-elastic icp in my inofficial package mesheR.

Best
Stefan

@stnava
Copy link
Member

stnava commented Apr 26, 2015

this is now added to antsr ... the behavior is consistent with the chicken example ... i am leaving this issue open in case there is further discussion wrt IJK to RAS or other cases. the basic idea of aatxtp is to transform the first d coordinates and carry along any other information beyond dimension d.

@stnava
Copy link
Member

stnava commented Apr 27, 2015

@zarquon42b - added a more detailed example here that may help clarify transformation standards 334b52f

@stnava
Copy link
Member

stnava commented May 1, 2015

assuming this is working well .... so closing.

@stnava stnava closed this as completed May 1, 2015
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

No branches or pull requests

3 participants