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

abpBrainExtraction crash #54

Closed
BrysonBR opened this issue Jun 10, 2015 · 7 comments
Closed

abpBrainExtraction crash #54

BrysonBR opened this issue Jun 10, 2015 · 7 comments

Comments

@BrysonBR
Copy link

I just installed ANTsR and the problem I am having is with abpBrainExtraction.
I enter the following commands in R in terminal:

struct<-antsImageRead("/Users/Bryson/Data/ANTsR_test/MPRAGE.nii.gz")
tem<-antsImageRead("/Users/Bryson/Data/ANTsR_test/bet.nii.gz")
temmask<-antsImageRead("/Users/Bryson/Data/ANTsR_test/bet_mask.nii.gz")

bm<-abpBrainExtraction(img=struct,tem=tem,temmask=temmask)

And I get the following error:

Problem in arg list
see usage by calling antsApplyTransforms() w/o arguments
Error in thresholdImage(temmaskwarped, 0.5, 1) :
trying to get slot "dimension" from an object of a basic class ("numeric") with no slots

So I called antsApplyTransforms() w/o arguments, but it wasn't helpful to me:

antsApplyTransforms()
warpedimg<-antsApplyTransforms( fixed=img1 , moving=img2 ,
transformlist=list("my0GenericAffine.mat","my1Warp.nii.gz") )

For full mode: use standard ants call as in antsApplyTransforms full mode ...

antsApplyTransforms("-d","2","-i","r64slice.nii.gz","-o","temp.nii.gz","-r","r16slice.nii.gz","-t","./Z0GenericAffine.mat")
for full help:
use .Call( "antsApplyTransforms", .int_antsProcessArguments( c(list("--help")) ), PACKAGE="ANTsR" );

[1] 0

The "img" image is a MPRAGE from the ABIDE dataset.
The "tem" image is the bet brain extracted version of the same image(I wasn't sure what to put here).
And the "temmask" is the brain mask output from bet.
I've run the example in the manual and it runs fine. Also, I tried running abpBrainExtraction.R another time, and although it didn't give me good results (probably from a bad choice of the "tem" image), it did finish without errors. Any ideas on what I can do?

@bkandel
Copy link
Collaborator

bkandel commented Jun 10, 2015

Can you provide the images you were using?

2015-06-10 17:14 GMT-04:00 BrysonBR notifications@github.com:

I just installed ANTsR and the problem I am having is with
abpBrainExtraction.
I enter the following commands in R in terminal:

struct<-antsImageRead("/Users/Bryson/Data/ANTsR_test/MPRAGE.nii.gz")
tem<-antsImageRead("/Users/Bryson/Data/ANTsR_test/bet.nii.gz")
temmask<-antsImageRead("/Users/Bryson/Data/ANTsR_test/bet_mask.nii.gz")

bm<-abpBrainExtraction(img=struct,tem=tem,temmask=temmask)

And I get the following error:
Problem in arg list
see usage by calling antsApplyTransforms() w/o arguments
Error in thresholdImage(temmaskwarped, 0.5, 1) :
trying to get slot "dimension" from an object of a basic class ("numeric")
with no slots

So I called antsApplyTransforms() w/o arguments, but it wasn't helpful to
me:

antsApplyTransforms()
warpedimg<-antsApplyTransforms( fixed=img1 , moving=img2 ,
transformlist=list("my0GenericAffine.mat","my1Warp.nii.gz") )

For full mode: use standard ants call as in antsApplyTransforms full mode
...

antsApplyTransforms("-d","2","-i","r64slice.nii.gz","-o","temp.nii.gz","-r","r16slice.nii.gz","-t","./Z0GenericAffine.mat")

for full help:
use .Call( "antsApplyTransforms", .int_antsProcessArguments(
c(list("--help")) ), PACKAGE="ANTsR" );

[1] 0

The "img" image is a MPRAGE from the ABIDE dataset.
The "tem" image is the bet brain extracted version of the same image(I
wasn't sure what to put here).
And the "temmask" is the brain mask output from bet.
I've run the example in the manual and it runs fine. Also, I tried running
abpBrainExtraction.R another time, and although it didn't give me good
results (probably from a bad choice of the "tem" image), it did finish
without errors. Any ideas on what I can do?


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

@stnava
Copy link
Member

stnava commented Jun 10, 2015

for antsApplyTransforms , try ?antsApplyTransforms

the template should be the whole head, just like the raw T1

the mask should be the template's brain mask

this function is a fast approximation to https://github.com/stnava/ANTs/blob/master/Scripts/antsBrainExtraction.sh which has been evaluated more thoroughly

you might also try getMask which on occasion can work well despite its simplicity ....

@stnava
Copy link
Member

stnava commented Jun 10, 2015

also - just updated the documentation

https://github.com/stnava/ANTsR/blob/master/man/abpBrainExtraction.Rd#L10-L12

@BrysonBR
Copy link
Author

Thank you both for your quick responses. The link below has all of the files that I used originally and others which will be explained below.
https://drive.google.com/open?id=0B9oWACI5TJOEfm1KdzAxSG5IdlNZR3QyOEtGa3l2ZEVETHBUQXZyNDJGUGk5YXRNT2N4blk&authuser=0

First, in response to the extended explanation of the tem and temmask variables, I decided to re-run with the following code:

struct<-antsImageRead("/Users/Bryson/Data/ANTsR_test/MP1.nii.gz")
struct<-abpN4(struct)
tem<-antsImageRead("/Users/Bryson/Data/ANTsR_test/MP3.nii.gz")
tem<-abpN4(tem)
temmask<-antsImageRead("/Users/Bryson/Data/ANTsR_test/bet_MP3_mask.nii.gz")

bm<-abpBrainExtraction(img=struct,tem=tem,temmask=temmask)

Which resulted in the same error:

Problem in arg list
see usage by calling antsApplyTransforms() w/o arguments
Error in thresholdImage(temmaskwarped, 0.5, 1) :
trying to get slot "dimension" from an object of a basic class ("numeric") with no slots

I also tried getMask, but it did not give me a good result (also in the link).
One more question, how dependent is abpBrainExtraction on the quality of the template's brain extraction?

@bkandel
Copy link
Collaborator

bkandel commented Jun 11, 2015

I'm getting the same issue...it looks like antsRegistration isn't actually
writing out the transforms it's supposed to. From debugging:
Browse[2]> mytx<-antsRegistration( tem, img, typeofTransform = c('SyN'),

  • initialTransform=initafffn )
    
    Browse[2]> file.exists(mytx$invtransforms[1])
    [1] FALSE

2015-06-11 11:50 GMT-04:00 BrysonBR notifications@github.com:

Thank you both for your quick responses. The link below has all of the
files that I used originally and others which will be explained below.

https://drive.google.com/open?id=0B9oWACI5TJOEfm1KdzAxSG5IdlNZR3QyOEtGa3l2ZEVETHBUQXZyNDJGUGk5YXRNT2N4blk&authuser=0

First, in response to the extended explanation of the tem and temmask
variables, I decided to re-run with the following code:

struct<-antsImageRead("/Users/Bryson/Data/ANTsR_test/MP1.nii.gz")
struct<-abpN4(struct)
tem<-antsImageRead("/Users/Bryson/Data/ANTsR_test/MP3.nii.gz")
tem<-abpN4(tem)
temmask<-antsImageRead("/Users/Bryson/Data/ANTsR_test/bet_MP3_mask.nii.gz")

bm<-abpBrainExtraction(img=struct,tem=tem,temmask=temmask)

Which resulted in the same error:

Problem in arg list
see usage by calling antsApplyTransforms() w/o arguments
Error in thresholdImage(temmaskwarped, 0.5, 1) :
trying to get slot "dimension" from an object of a basic class ("numeric")
with no slots

I also tried getMask, but it did not give me a good result (also in the
link).
One more question, how dependent is abpBrainExtraction on the quality of
the template's brain extraction?


Reply to this email directly or view it on GitHub
#54 (comment).

@stnava
Copy link
Member

stnava commented Jun 11, 2015

might try verbose output to get some insight

brian

On Thu, Jun 11, 2015 at 12:22 PM, bkandel notifications@github.com wrote:

I'm getting the same issue...it looks like antsRegistration isn't actually
writing out the transforms it's supposed to. From debugging:
Browse[2]> mytx<-antsRegistration( tem, img, typeofTransform = c('SyN'),

  • initialTransform=initafffn )
    Browse[2]> file.exists(mytx$invtransforms[1])
    [1] FALSE

2015-06-11 11:50 GMT-04:00 BrysonBR notifications@github.com:

Thank you both for your quick responses. The link below has all of the
files that I used originally and others which will be explained below.

https://drive.google.com/open?id=0B9oWACI5TJOEfm1KdzAxSG5IdlNZR3QyOEtGa3l2ZEVETHBUQXZyNDJGUGk5YXRNT2N4blk&authuser=0

First, in response to the extended explanation of the tem and temmask
variables, I decided to re-run with the following code:

struct<-antsImageRead("/Users/Bryson/Data/ANTsR_test/MP1.nii.gz")
struct<-abpN4(struct)
tem<-antsImageRead("/Users/Bryson/Data/ANTsR_test/MP3.nii.gz")
tem<-abpN4(tem)

temmask<-antsImageRead("/Users/Bryson/Data/ANTsR_test/bet_MP3_mask.nii.gz")

bm<-abpBrainExtraction(img=struct,tem=tem,temmask=temmask)

Which resulted in the same error:

Problem in arg list
see usage by calling antsApplyTransforms() w/o arguments
Error in thresholdImage(temmaskwarped, 0.5, 1) :
trying to get slot "dimension" from an object of a basic class
("numeric")
with no slots

I also tried getMask, but it did not give me a good result (also in the
link).
One more question, how dependent is abpBrainExtraction on the quality of
the template's brain extraction?


Reply to this email directly or view it on GitHub
#54 (comment).


Reply to this email directly or view it on GitHub
#54 (comment).

@stnava
Copy link
Member

stnava commented Jun 11, 2015

several "interesting" things going on here ...

  • you are a victim of this issue which is rooted in ITK
  • good news is that issue will be resolved soon thanks to @hjmjohnson finally killing this evil curse
  • bad news is the fix is not yet in ....
  • more good news is that i added a verbose option to antsRegistration in ANTsR to help us debug issues like this more easily
  • bad news is there was another bug in antsRegistration (in ANTs, not ANTsR) which this issue uncovered ...
  • good news is that bug is fixed ....
  • finally - here is a workaround ( command line )
ImageMath 3 MP3close.nii.gz ClosestSimplifiedHeaderMatrix MP3.nii.gz 

then do the work on the close version ... make a close version for each image.

@stnava stnava closed this as completed Jun 11, 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