-
Notifications
You must be signed in to change notification settings - Fork 35
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
abpBrainExtraction fails #315
Comments
Looks to me like you don't have enough memory/ram. What are the specs of
your system.
…On Mon, May 11, 2020, 1:23 PM vnckppl ***@***.***> wrote:
*Issue*
I am running abpBrainExtraction on a T1-weighted image that has previously
been processed with abpN4. I use OASIS-30 data as template and mask.
I run the following code:
# Load template image and mask
tem <- antsImageRead(
"/software/templates/OASIS-30/T_template0.nii.gz"
)
temmask <- antsImageRead(
"/software/templates/OASIS-30/T_template0_BrainCerebellumMask.nii.gz"
)
# Load T1w data
myT1 <- antsImageRead("/data/in/T1w_n4.nii.gz")
# Build brain mask
mask <- abpBrainExtraction(
img = myT1,
tem = tem,
temmask = temmask,
tdir = "/data/in"
)
This results in:
source("example.R")
bad det -1 v 1 u -1
bad det -1 v 1 u -1 new 1
bad det -1 v 1 u -1
bad det -1 v 1 u -1 new 1
*** caught segfault ***
address (nil), cause 'memory not mapped'
Traceback:
1: antsImageHeaderInfo(filename)
2: doTryCatch(return(expr), name, parentenv, handler)
3: tryCatchOne(expr, names, parentenv, handlers[[1L]])
4: tryCatchList(expr, classes, parentenv, handlers)
5: tryCatch(antsImageHeaderInfo(filename), error = function(e) return(NA))
6: antsImageRead(x, ...)
7: FUN(X[[i]], ...)
8: FUN(X[[i]], ...)
9: lapply(x, check_ants, ... = ...)
10: FUN(X[[i]], ...)
11: FUN(X[[i]], ...)
12: lapply(x, check_ants, ... = ...)
13: check_ants(image)
14: check_ants(image)
15: antsImageWrite(mask, "/data/in/mymask.nii.gz")
16: eval(ei, envir)
17: eval(ei, envir)
18: withVisible(eval(ei, envir))
19: source("example.R")
*OS and Software versions:*
- OS: Debian GNU/Linux bullseye/sid"
- R: R version 3.6.3
- ITKR_0.5.3
- ANTsR_0.5.4.2
- ANTsRCore_0.7.4
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#315>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACFJU7K5UKPBFTA6NWLPAL3RRAYAPANCNFSM4M6DCTPQ>
.
|
I run R in a Docker container on OSX. The system itself has 16gb of ram, with 10gb allocated to Docker and 1Gb Swap. I think this should be sufficient, but correct me if I am wrong. I even upped the swap to 2gb and re-ran the script, but I get the exact same errors. |
Then I don't know what can be. Have you properly mounted the folders in
/software and /data/in/ ? Looks like it's failing when trying to read some
image headers.
…On Mon, May 11, 2020, 2:03 PM vnckppl ***@***.***> wrote:
I run R in a Docker container on OSX. The system itself has 16gb of ram,
with 10gb allocated to Docker and 1Gb Swap. I think this should be
sufficient, but correct me if I am wrong. I even upped the swap to 2gb and
re-ran the script, but I get the exact same errors.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#315 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACFJU7JDFS4JDVVYMJIPLEDRRA4VTANCNFSM4M6DCTPQ>
.
|
I think I have. When I manually enter the container with |
Can you try n4BiasCorrection, with and without a mask, and see if
that works?
Also - please confirm that "/data/in/mymask.nii.gz" does not currently
exist.
Best,
John
…On Mon, May 11, 2020 at 2:22 PM vnckppl ***@***.***> wrote:
I think I have. When I manually enter the container with docker run -it
-v /some/local/folder:/data/in --entrypoint=/bin/bash I can read and
write to the local folder without any issues.
Also, when I run R from within the container, I have no issues reading and
writing images.
Moreover, apbN4, antsRegistration, and ants_brain_extract (ANTsRNet) all
run fine from within the container.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#315 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIGPLX55VZ4FZBQK2HSZT3RRA65HANCNFSM4M6DCTPQ>
.
|
Starting the container with:
and then running R, sourcing the following code:
runs fine and produces the two expected N4 corrected images. |
Sorry - I mean N4 passing in the mask, such as n4BiasFieldCorrection(img,
mask = mask)
Best,
John
…On Mon, May 11, 2020 at 3:44 PM vnckppl ***@***.***> wrote:
Starting the container with:
docker run -it \
-v /some/local/input/folder:/data/in:ro \
-v /some/local/output/folder:/data/out \
--entrypoint=/bin/bash \
someContainerID
and then running R, sourcing the following code:
## * Load Library
library("ANTsR")
## * Load mask data
base <- "/data/in"
myt1w <- antsImageRead(
file.path(base, "T1w_n4.nii.gz")
)
myt1w_mask <- antsImageRead(
file.path(base, "T1w_n4_mask.nii.gz")
)
## * Run N4 correction on entire image
# Ouptut folder
out_dir <- "/data/out/N4_noMask"
dir.create(out_dir)
# Run N4
output_image <- n4BiasFieldCorrection(myt1w, verbose = TRUE)
# Save output file
outfile <- file.path(out_dir, "N4_noMask.nii.gz")
antsImageWrite(output_image, outfile)
## * Run N4 correction on entire image
# Ouptut folder
out_dir <- "/data/out/N4_withinMask"
dir.create(out_dir)
# Run N4
output_image <- n4BiasFieldCorrection(myt1w, verbose = TRUE)
# Save output file
outfile <- file.path(out_dir, "N4_withinMask.nii.gz")
antsImageWrite(output_image, outfile)
runs fine and produces the two expected N4 corrected images.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#315 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIGPLXKMD44BZOMAAGVBDTRRBISNANCNFSM4M6DCTPQ>
.
|
Hi John, |
Only way likely is to share the image.
Best,
John
…On Mon, May 11, 2020 at 4:12 PM vnckppl ***@***.***> wrote:
Hi John,
I did (and have updated my previous post).
Same results, i.e., this runs smoothly.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#315 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIGPLVN5QJ7BZWNVKR74HLRRBL2BANCNFSM4M6DCTPQ>
.
|
I am getting the same error with a default template that comes with FSL, so I guess the image itself is not the problem. I am further investigating the issue. I am building a virtual environment with ANTsR using Packrat so that I can try and see if a different setup produces the same error. However, I am running into some other issues with |
I figured out what went wrong. I was expecting abpBrainExtraction to write out an antsImage, but it is writing out a list. When I tried to write out the list as an antsImage, R throws the memory error:
Everything works now, and the masks look good. For some image, I do see this warning/error in the terminal though:
Should I be worried about that? |
That warning happens often but I haven't seen bad results when it appears.
…On Tue, May 12, 2020, 1:04 PM vnckppl ***@***.***> wrote:
Closed #315 <#315>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#315 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACFJU7IF4M7PL7XS5DFCUXTRRF6QVANCNFSM4M6DCTPQ>
.
|
Those errors come from |
Issue
I am running abpBrainExtraction on a T1-weighted image that has previously been processed with abpN4. I use OASIS-30 data as template and mask.
I run the following code:
This results in:
OS and Software versions:
The text was updated successfully, but these errors were encountered: