Print

Print


I also found that the volume of both are different...

$ fslstats mask_1mm.nii.gz -V
2964388 2964388.000000

$ fslstats test.nii.gz -V
388896 3111168.000000

2013/2/25 Tseng Mark <[log in to unmask]>

> I used fslinfo to check the mask_1mm and test and the information is below:
>
> $ fslinfo mask_1mm.nii.gz
> dim1           157
> dim2           189
> dim3           156
> dim4           1
> datatype       16
> pixdim1        1.0000000000
> pixdim2        1.0000000000
> pixdim3        1.0000000000
> pixdim4        0.0000000000
>
> $ fslinfo test.nii.gz
> data_type      FLOAT32
> dim1           91
> dim2           109
> dim3           91
> dim4           1
> datatype       16
> pixdim1        2.0000000000
> pixdim2        2.0000000000
> pixdim3        2.0000000000
> pixdim4        0.0000000000
>
>
> 2013/2/25 Tseng Mark <[log in to unmask]>
>
>> 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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>