Hi,

This looks fine to me.

All the best,
Mark



On 25 Feb 2013, at 20:33, Tseng Mark <[log in to unmask]> wrote:

Dear Mark, 

could you please finally confirm that my commands below are correct? I think I should be because now both volumes are very similar.
(mask_1mm is a mask from SPM)

$ flirt -in mask_1mm.nii.gz -ref /usr/local/fsl/data/standard/MNI152_T1_2mm_brain.nii.gz -applyxfm -usesqform -interp trilinear -out TEST

$ fslmaths TEST.nii.gz -thr 0.5 -bin TEST2

$ fslstats mask_1mm.nii.gz -V
2963837 2963837.000000 
$ fslstats TEST2.nii.gz -V
370487 2963896.000000 

I really appreciate for your help:)


2013/2/25 Mark Jenkinson <[log in to unmask]>
Hi,

Did you use trilinear interpolation and then threshold and binarise with fslmaths?
That is our recommendation, as included in the previous email.

All the best,
Mark


On 25 Feb 2013, at 18:56, Tseng Mark <[log in to unmask]> wrote:

Ah, I executed:

flirt -in mask_1mm.nii.gz -ref /usr/local/fsl/data/standard/MNI152_T1_2mm_brain.nii.gz -usesqform -out test2

and this time it matchs with standard space in fslview. But when I check the size of mask_1 and test2, there seems increase of the volume after the transformation:

246 mtseng@jalapeno $ fslstats mask_1mm.nii.gz -V 
2964388 2964388.000000 
247 mtseng@jalapeno $ fslstats test2.nii.gz -V 
409972 3279776.000000 

So should I add -interp nearestneighbor ?

2013/2/25 Mark Jenkinson <[log in to unmask]>
Hi,

OK, the critical piece of information here is - SPM!
They have a different convention, so their standard space images have a different FOV, and hence the problem.
Instead you can use the information about the coordinates in the NIFTI image to align the images.
So get rid of the -init option (and the ident.mat) and replace it was -usesqform and then hopefully that will do what you want.

All the best,
Mark


On 25 Feb 2013, at 18:25, Tseng Mark <[log in to unmask]> wrote:

Hi Mark,

I then did:

flirt -in mask_1mm -ref /usr/local/fsl/data/standard/MNI152_T1_2mm_brain.nii.gz -applyxfm -init /usr/local/fsl/etc/flirtsch/ident.mat -out test

Then I open test with standard 2mm MNI template (attached fig). Why is it shifted?

The mask_1mm is actually a gray matter mask from VBM analysis implemented in SPM (It has been normalized to standard space with voxel size of 1x1x1mm during VBM analysis). I want to use it to mask a fMRI map in FSL. Do I need to do something else?

Thanks again.

2013/2/25 Mark Jenkinson <[log in to unmask]>
Hi,

You can find the identity matrix in:
  $FSLDIR/etc/flirtsch/ident.mat
which has the contents:

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1

There is also a button for this on the ApplyXFM menu.
And by default the identity matrix (representing no translation or rotation) is used when you leave out the transformation matrix in a resampling step.

All the best,
Mark


On 25 Feb 2013, at 17:37, Tseng Mark <[log in to unmask]>
 wrote:

Hi Mark,

My mask_1mm is from T1 structure image and has been transformed to a 1x1x1mm standard space. I want to use it to mask a fmri map (mask_2mm), which is in 2x2x2mm standard space.

Since you suggested "If the images are in the same space (e.g. all the MNI templates of different resolutions are all in the same space) then you can use an identity matrix for the transformation," what is the identity matrix you mean here?

Thanks in advance.




2013/2/25 Mark Jenkinson <[log in to unmask]>
Hi,

I thought a summary might be helpful here:

 - If the images are in different spaces then you need to use an appropriate transformation matrix (as derived from a registration) in order to make sure that the post-transformed image is aligned correctly (e.g. example_func2standard)

 - If the images are in the same space (e.g. all the MNI templates of different resolutions are all in the same space) then you can use an identity matrix for the transformation

 - The reference image controls both the resolution and the FOV of the output image, and both of these must be the same in order to overlay images in FSLView

 - I personally do not recommend using -applyisoxfm as it often does not match the FOV correctly.  It is usually better to choose an appropriate reference image (either from the standard template directory or from amongst the appropriate images in your study, e.g. example_func or highres)

 - If you are transforming a mask between spaces then we recommend using trilinear interpolation followed by a threshold and binarise operation with fslmaths.  To keep the mask a similar size use a threshold of 0.5.

 - You can use applywarp instead of flirt if you prefer (it is a little easier and does not need the -noresampblur option) and it can also be used with nonlinear warps.

I hope this information helps clarify things a bit.  If you are still unsure I recommend looking at the FSLCourse lecture and practical on registration.

All the best,
Mark


On 23 Feb 2013, at 15:48, Tseng Mark <[log in to unmask]> wrote:

The EPI image had been normalized to standard MNI space during preprocessing, which is 2x2x2.

Mask_1mm is a T1 mask that is 1x1x1, which is the whole brain gray matter mask.

We want to calculate a cluster size threshold to correct for our EPI image. This threshold is going to be calculated only in whole brain gray matter by 3dClustSim in AFNI. That's why we want to transform Mask_1mm to standard space.

2013/2/23 Chou Paul <[log in to unmask]>
Dear Mark

One more following question, in previous email, you said your mask_1mm is locate in individual native space. is the script you used (flirt -in mask_1mm -ref /usr/local/fsl/data/standard/MNI152_T1_2mm_brain -applyisoxfm 2 -interp nearestneighbour -out mask_2mm_int) correctly for EPI image (which located in MNI space)?

Best

Paul 


Date: Sat, 23 Feb 2013 11:57:12 +0000
From: [log in to unmask]
Subject: Re: [FSL] changing voxel size in a mask

To: [log in to unmask]

Hi Wolf,

Yeah I think it's the interpolation process. I then tried 2 methods below, which yielded the same result:

flirt -in mask_1mm -ref /usr/local/fsl/data/standard/MNI152_T1_2mm_brain -applyisoxfm 2 -interp nearestneighbour -out mask_2mm_int

and

flirt -in mask_1mm -ref /usr/local/fsl/data/standard/MNI152_T1_2mm_brain -applyisoxfm 2 -noresampblur -out mask_2mm_nor

mask_1mm
1226669 / 1226669

mask_2mm_int
153206 / 1225648

mask_2mm_nor
153206 / 1225648

So now the voxel size in mask_2mm is 1/8 that in mask_1mm, and their volume is nearly the same!

2013/2/23 wolf zinke <[log in to unmask]>
Hi,

When using flirt for downsampling, it does apply a blurring which can be switched off by the option -noresampblur. Anyway, I guess resampling data requires some kind of interpolation, and when resampling binary data you have to apply a threshold and binarize the mask again. If you just binarize the blurred unthresholded mask, you likely end up with a slightly dilated mask.

For your kind of downsampling you might look into the fslmaths option -subsamp2. Since you apply it on a mask, it does not matter, in which way the data of the old voxel is averaged into the lower resolution voxel.

good luck,
wolf


On 02/23/2013 03:02 AM, Tseng Mark wrote:
Thank you Paul.

My mask_1mm is a T1 structure image and I want to use it to mask a fmri map, which is in 2x2x2 dimension. If I want to transform mask_1 into the space of the fmri map, I need the transformation matrix produced during the preprocessing of my fmri data. Right?

The problem is that the matrix data are not with me now....that's why I tried using "flirt -applyisoxfm" but unsure if the problem I raised is "normal" or not.....

Mark

2013/2/23 Chou Paul <[log in to unmask]>
Dear Mark

Have you ever tried the "ApplyXFM" with identity transformation to resample your "mask_1mm" image to "mask_2mm" image ? I think this tool may do the job for you. 

Best

Paul

> Date: Sat, 23 Feb 2013 00:45:57 +0000
> From: [log in to unmask]
> Subject: [FSL] changing voxel size in a mask
> To: [log in to unmask]

>
> Hi,
>
> I have a mask (mask_1mm) with voxel size of 1x1x1mm. I want to use it to mask a 2x2x2mm map so I use below command to change it into 2x2x2 (mask_2mm):
>
> flirt -in mask_1mm -ref /usr/local/fsl/data/standard/MNI152_T1_2mm_brain -applyisoxfm 2 -out mask_2mm
>
> Then I check the voxel number/volume of the 2 masks:
>
> mask_1mm.nii.gz
> 1226669 / 1226669
>
> mask_2mm.nii.gz
> 181444 / 1451552
>
> I found the voxel size in mask_2mm is not 1/8 that in mask_1mm, and the volume of the two masks are different.
>
> Is it normal?
>
> Thanks.
>
> Mark








<test.png>