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

antsAverageImages, new "weights" argument with no default #100

Closed
dorianps opened this issue Oct 22, 2019 · 2 comments
Closed

antsAverageImages, new "weights" argument with no default #100

dorianps opened this issue Oct 22, 2019 · 2 comments

Comments

@dorianps
Copy link
Contributor

dorianps commented Oct 22, 2019

Describe the bug
Not sure how tests have passed on travis, but antsAverageImages seems to have a new weights argument with no default (here). I am getting strange segfaults and I am not sure exactly why, but the default example of antsAverageImage which calls the function without the weights argument should at least work and I don't see how can it work without defining weights. @muschellij2 can you pre-set the weights in the argument definition?

To Reproduce
Steps to reproduce the behavior:

f1 = getANTsRData('r16')
f2 = getANTsRData('r64')
r16 <- antsImageRead(f1)
r64 <- antsImageRead(f2)
mylist <- list(r16, r64)
antsAverageImages(mylist)

Log:

> f1 = getANTsRData('r16')
> f2 = getANTsRData('r64')
> r16 <- antsImageRead(f1)
> r64 <- antsImageRead(f2)
> mylist <- list(r16, r64)
> antsAverageImages(mylist, weights=c(1,1)
+ )

 *** caught segfault ***
address (nil), cause 'memory not mapped'

 *** caught segfault ***

 *** caught segfault ***
address (nil), cause 'memory not mapped'

Traceback:
 1: imageList[[1]] * 0
 2: imageList[[1]] * 0
 3: antsAverageImages(mylist, weights = c(1, 1))address (nil), cause 'memory not mapped'


Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

Traceback:
Selection: 
Traceback:
 1:  1: imageList[[1]] * 0
 2: imageList[[1]] * 0
 3: antsAverageImages(mylist, weights = c(1, 1))

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
imageList[[1]] * 0
 2: Selection: imageList[[1]] * 0
 3: antsAverageImages(mylist, weights = c(1, 1))

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 

Expected behavior
No segfault, keep old behavior and accept images without weights for backward compatibility of existing scripts.

Screenshots
None

Desktop (please complete the following information):

  • OS: Centos 7

Additional context
None

@dorianps
Copy link
Contributor Author

Btw, I can see you check for missing input later:
https://github.com/ANTsX/ANTsRCore/blob/master/R/antsAverageImages.R#L48-L49

But how is R accepting the function call with no default?

@dorianps
Copy link
Contributor Author

Never mind, I just learned about missing. The segfault might be from other reasons.

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

1 participant