Giter Club home page Giter Club logo

Comments (4)

cookpa avatar cookpa commented on June 1, 2024 1

I've not used the list option but I believe you would need to replace file names with pointers to antsImage objects using antsrGetPointerName, eg

img_pt <- antsrGetPointerName( antsImageClone( img ))

I include the clone here from the man example, the antsRegistration function also clones the input image.

from antsr.

ncullen93 avatar ncullen93 commented on June 1, 2024

You'll have to look through the antsRegistration code in ANTsR and ANTsRCore probably more specifically, because I don't believe there is a way to add any additional parameters. Happy to accept a PR if you think something is missing... it should be easy to just add the function argument to antsRegistration and then add that arg to the parameters that are built up.

from antsr.

muratmaga avatar muratmaga commented on June 1, 2024

@cookpa
Thanks for the pointer info. However, if I do antsImageClone, the pointer address changes every time. Is there reason antsr is not directly using the actual address of the image?

> fi <- antsImageRead(getANTsRData("r16") )
> mi <- antsImageRead(getANTsRData("r64") )
> 
> antsrGetPointerName(fi)
[1] "0x561b9ba33b30"
> antsrGetPointerName(mi)
[1] "0x561b9bd504e0"
> 
> 
> mytx2 <- antsRegistration(fi,  mi, typeofTransform = 'Affine', printArgs = T)
antsRegistration -d 2 -r [0x561b9c78e900,0x561b9c7cec50,1] -m mattes[0x561b9c78e900,0x561b9c7cec50,1,32,regular,0.2] -t Affine[0.25] -c 2100x1200x1200x10 -s 3x2x1x0 -f 6x4x2x1 -u 0 -z 1 -o [/tmp/Rtmp01coMb/file118bd916264147,0x561b9bd30860,0x561b98aece90] -x [NA,NA] --float 1 --random-seed 1 --write-composite-transform 0 
> antsrGetPointerName(antsImageClone(fi))
[1] "0x561b9bc6f0c0"
> antsrGetPointerName(antsImageClone(fi))
[1] "0x561b9bed7170"

clearly antsRegistration is using the antsImageClone too, since every call has a different pointer address. So not sure how to do convert this a list call

> mytx2 <- antsRegistration(fi,  mi, typeofTransform = 'Affine', printArgs = T)
antsRegistration -d 2 -r [0x561b9ba32fd0,0x561b9bac0570,1] -m mattes[0x561b9ba32fd0,0x561b9bac0570,1,32,regular,0.2] -t Affine[0.25] -c 2100x1200x1200x10 -s 3x2x1x0 -f 6x4x2x1 -u 0 -z 1 -o [/tmp/Rtmp01coMb/file118bd91a9f7941,0x561b9f72e800,0x561b9bc68ab0] -x [NA,NA] --float 1 --random-seed 1 --write-composite-transform 0 
> mytx2 <- antsRegistration(fi,  mi, typeofTransform = 'Affine', printArgs = T)
antsRegistration -d 2 -r [0x561b9bc68fc0,0x561b9cbdb9c0,1] -m mattes[0x561b9bc68fc0,0x561b9cbdb9c0,1,32,regular,0.2] -t Affine[0.25] -c 2100x1200x1200x10 -s 3x2x1x0 -f 6x4x2x1 -u 0 -z 1 -o [/tmp/Rtmp01coMb/file118bd96a38f2d9,0x561b9c6a47c0,0x561b9bd303f0] -x [NA,NA] --float 1 --random-seed 1 --write-composite-transform 0 

from antsr.

cookpa avatar cookpa commented on June 1, 2024

Yes you'd get another pointer each time, they are pointers to copies of the image. Sorry, the example I gave was probably not very useful. To avoid garbage collection you'd need to keep a reference around, so something like

fi_for_reg = antsImageClone(fi)
mi_for_reg = antsImageClone(mi)

Then in your antsRegistration parameter list, you'd replace the file names with antsrGetPointerName(fi_for_reg) and antsrGetPointerName(mi_for_reg)

I don't actually know why antsRegistration clones the input images this way, but it does.

from antsr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.