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

create_sphere uses MNI152_2mm template even when given mask #122

Closed
jnecus opened this issue Apr 6, 2017 · 5 comments
Closed

create_sphere uses MNI152_2mm template even when given mask #122

jnecus opened this issue Apr 6, 2017 · 5 comments

Comments

@jnecus
Copy link

jnecus commented Apr 6, 2017

The resulting mask shape does not match that of my provided mask (in this case t1_image)

Here is my code:

from nltools.mask import create_sphere
mask=create_sphere([123,201,102],radius=10,mask=t1_image)

Results:

t1_image.shape (180,256,256)
mask.shape (91,109,91)

@jnecus jnecus changed the title create_sphere_roi uses MNI152_2mm template even when given mask create_sphere uses MNI152_2mm template even when given mask Apr 6, 2017
@ljchang
Copy link
Member

ljchang commented Apr 6, 2017

@jnecus: do you mind sharing your t1_image so we can try to fix this bug. Maybe a dropbox link, or on neurovault?

@jnecus
Copy link
Author

jnecus commented Apr 6, 2017

@ljchang
Copy link
Member

ljchang commented Apr 6, 2017

Thanks @jnecus. You definitely helped us identify a couple of previously undetected bugs. We mostly use our tools on normalized data.

I just pushed a fix for this bug and think it should work now #123. Though you'll have to install from github. One important thing to note is that the mask really does need to be a mask not just any nibabel instance. For your use case, you need to create a mask of your T1. Personally, I would create a mask using the skull stripped data. Here is example code using bet from fsl bet T1_TFE_1_0_Iso_SENSE.nii.gz T1_TFE_1_0_Iso_SENSE_stripped -m. Let us know if you have more problems with anything else.

@jnecus
Copy link
Author

jnecus commented Apr 6, 2017

Thanks @ljchang , I downloaded the latest version from github and it works fine.

Rather than using the skull stripped image I used a mask image which was the same size as my t1_w, but filled exclusively with 1's. This is because I wanted to create a spherical roi which falls outside of the brain.

On that note, could you explain to be the need to include a mask in a function of which the role is ultimately to generate a mask. I cannot seems to grasp the use for this mask option?

@ljchang
Copy link
Member

ljchang commented Apr 7, 2017

@jnecus: you need to pass a mask in so the function knows the space to build the rois. You're right though, that it actually doesn't need to be a mask. It could have been your original T1. It only uses the mask to get the dimensions of the image.

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

2 participants