ANTsX / ANTsR

R interface to the ANTs biomedical image processing library
https://antsx.github.io/ANTsR
Apache License 2.0
127 stars 35 forks source link

antsMotionCorr: output write displacement field transforms #190

Closed VeroAra closed 6 years ago

VeroAra commented 6 years ago

Hi! I am working with the command "antsMotionCorr" in Rstudio. Registration of my images work good but I would like to obtain as the displacement transform as an output to check out how these transformations are done.

In ANTS, the following parameter "-w 1" appears to write out the displacement field (a 4D displacement field that captures the affine induced motion at each voxel). However, when using it in Rstudio (w=1), it does not work and the session is aborted.

Does anyone know how this output can be obtained? Thank you in advanced,

` aimg <- new("antsImage", "float", 2) #imagen de referencia a crear mocoImg <- new("antsImage", "float", 3) # imagen resultado mocoParams <- new("antsMatrix", "double")

antsMotionCorr( list( d = 2 , a = regLABEL_LX, o = aimg ) ) # average img created to work as a reference
antsMotionCorr( list( d = 2 ,
                      o = list( mocoParams , mocoImg , aimg ) ,
                      m = list( name = "CC" , aimg , movingImage=regCONTROL_CX , metricWeight=1 , radius=1 , samplingStrategy="Regular", samplingPercentage=0.2 ) ,
                      t = "SyN[0.03, 3, 0]" , i = "1000x1000",
                      u = 1, e = 1 , s = "0x0", f = "2x1", n=1 ,
                      v = as.numeric(TRUE) )) #TRUE: to write comments during executing. FALSE: to avoid comments

`

muschellij2 commented 6 years ago

Does this run on R at the Terminal?

John

On Mon, Oct 30, 2017 at 4:30 AM, VeroAra notifications@github.com wrote:

Hi! I am working with the command "antsMotionCorr" in Rstudio. Registration of my images work good but I would like to obtain as the displacement transform as an output to check out how these transformations are done.

In ANTS, the following parameter "-w 1" appears to write out the displacement field (a 4D displacement field that captures the affine induced motion at each voxel). However, when using it in Rstudio (w=1), it does not work and the session is aborted.

Does anyone know how this output can be obtained? Thank you in advanced,

` aimg <- new("antsImage", "float", 2) #imagen de referencia a crear mocoImg <- new("antsImage", "float", 3) # imagen resultado mocoParams <- new("antsMatrix", "double")

antsMotionCorr( list( d = 2 , a = regLABEL_LX, o = aimg ) ) # average img created to work as a reference antsMotionCorr( list( d = 2 , o = list( mocoParams , mocoImg , aimg ) , m = list( name = "CC" , aimg , movingImage=regCONTROL_CX , metricWeight=1 , radius=1 , samplingStrategy="Regular", samplingPercentage=0.2 ) , t = "SyN[0.03, 3, 0]" , i = "1000x1000", u = 1, e = 1 , s = "0x0", f = "2x1", n=1 , v = as.numeric(TRUE) )) #TRUE: to write comments during executing. FALSE: to avoid comments

`

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ANTsX/ANTsR/issues/190, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBnrn_Ga0vhaV52z5QkWpeo8wz6OQywks5sxYkagaJpZM4QK0sY .

VeroAra commented 6 years ago

The code without "w=1" runs on R at the terminal, but it does not write out the displacement field. antsMotionCorr( list( d = 2 , a = regLABEL_LX, o = aimg ) ) # average img created to work as a reference antsMotionCorr( list( d = 2 , o = list( mocoParams , mocoImg , aimg ) , m = list( name = "CC" , aimg , movingImage=regCONTROL_CX , metricWeight=1 , radius=1 , samplingStrategy="Regular", samplingPercentage=0.2 ) , t = "SyN[0.03, 3, 0]" , i = "1000x1000", u = 1, e = 1 , s = "0x0", f = "2x1", n=1 , v = as.numeric(TRUE) ))

The code with "w=1" does not run in R at the terminal. antsMotionCorr( list( d = 2 , a = regLABEL_LX, o = aimg ) ) # average img created to work as a reference antsMotionCorr( list( d = 2 , o = list( mocoParams , mocoImg , aimg ) , m = list( name = "CC" , aimg , movingImage=regCONTROL_CX , metricWeight=1 , radius=1 , samplingStrategy="Regular", samplingPercentage=0.2 ) , t = "SyN[0.03, 3, 0]" , i = "1000x1000", u = 1, e = 1 , s = "0x0", f = "2x1", n=1 , v = as.numeric(TRUE), w = 1))

Thank you.

stnava commented 6 years ago

i dont think that option is supported by the antsr wrapper. one would have to check the original c++ implementation to see why it would / would not work but i suspect would be something easy to fix within ants.

however, you can easily do motion correction by splitting and merging the time series via splitNDImageToList and mergeListToNDImage. and use whatever transform you like on each pairwise image.

brian

On Thu, Nov 2, 2017 at 3:57 AM, VeroAra notifications@github.com wrote:

The code without "w=1" runs on R at the terminal, but it does not write out the displacement field. antsMotionCorr( list( d = 2 , a = regLABEL_LX, o = aimg ) ) # average img created to work as a reference antsMotionCorr( list( d = 2 , o = list( mocoParams , mocoImg , aimg ) , m = list( name = "CC" , aimg , movingImage=regCONTROL_CX , metricWeight=1 , radius=1 , samplingStrategy="Regular", samplingPercentage=0.2 ) , t = "SyN[0.03, 3, 0]" , i = "1000x1000", u = 1, e = 1 , s = "0x0", f = "2x1", n=1 , v = as.numeric(TRUE) ))

The code with "w=1" does not run in R at the terminal. antsMotionCorr( list( d = 2 , a = regLABEL_LX, o = aimg ) ) # average img created to work as a reference antsMotionCorr( list( d = 2 , o = list( mocoParams , mocoImg , aimg ) , m = list( name = "CC" , aimg , movingImage=regCONTROL_CX , metricWeight=1 , radius=1 , samplingStrategy="Regular", samplingPercentage=0.2 ) , t = "SyN[0.03, 3, 0]" , i = "1000x1000", u = 1, e = 1 , s = "0x0", f = "2x1", n=1 , v = as.numeric(TRUE), w = 1))

Thank you.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ANTsX/ANTsR/issues/190#issuecomment-341343825, or mute the thread https://github.com/notifications/unsubscribe-auth/AATyfqqwug1hJOw5hNRWA_SH52LiVnQkks5syXXegaJpZM4QK0sY .

stnava commented 6 years ago

see https://github.com/ANTsX/ANTsR/wiki/nonrigid-motion-correction-example

brian

On Thu, Nov 2, 2017 at 6:28 AM, brian avants stnava@gmail.com wrote:

i dont think that option is supported by the antsr wrapper. one would have to check the original c++ implementation to see why it would / would not work but i suspect would be something easy to fix within ants.

however, you can easily do motion correction by splitting and merging the time series via splitNDImageToList and mergeListToNDImage. and use whatever transform you like on each pairwise image.

brian

On Thu, Nov 2, 2017 at 3:57 AM, VeroAra notifications@github.com wrote:

The code without "w=1" runs on R at the terminal, but it does not write out the displacement field. antsMotionCorr( list( d = 2 , a = regLABEL_LX, o = aimg ) ) # average img created to work as a reference antsMotionCorr( list( d = 2 , o = list( mocoParams , mocoImg , aimg ) , m = list( name = "CC" , aimg , movingImage=regCONTROL_CX , metricWeight=1 , radius=1 , samplingStrategy="Regular", samplingPercentage=0.2 ) , t = "SyN[0.03, 3, 0]" , i = "1000x1000", u = 1, e = 1 , s = "0x0", f = "2x1", n=1 , v = as.numeric(TRUE) ))

The code with "w=1" does not run in R at the terminal. antsMotionCorr( list( d = 2 , a = regLABEL_LX, o = aimg ) ) # average img created to work as a reference antsMotionCorr( list( d = 2 , o = list( mocoParams , mocoImg , aimg ) , m = list( name = "CC" , aimg , movingImage=regCONTROL_CX , metricWeight=1 , radius=1 , samplingStrategy="Regular", samplingPercentage=0.2 ) , t = "SyN[0.03, 3, 0]" , i = "1000x1000", u = 1, e = 1 , s = "0x0", f = "2x1", n=1 , v = as.numeric(TRUE), w = 1))

Thank you.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ANTsX/ANTsR/issues/190#issuecomment-341343825, or mute the thread https://github.com/notifications/unsubscribe-auth/AATyfqqwug1hJOw5hNRWA_SH52LiVnQkks5syXXegaJpZM4QK0sY .