Resample The Mask

Source: Internet
Author: User

When we use a function like the size of mask, we first resample the mask so that it is the same size as the function.

According to Super Teacher's reply, there are three ways:http://restfmri.net/forum/node/88, after trying to decide to use the first, namely:http://restfmri.net/node/78 , organized as follows.

After downloading the good code in the second URL, add the MATLAB path, the resample process only need to use the following four lines of code (from the two senior mail communication to pick out, modified a note):

Mask=rest_readfile (' Mask file path '); mask=mask>0; Mask_downsampled=rest_resample3d (original mask, [desired dimension]); Rest_writefile (mask_downsampled, ' Output path ', [disered dimention], [voxel size], [Origin coordinate], ' data type ');

Where original mask input the mask file name with the full path (I use HDR), of course, the current directory is not required;

Voxel size and Origin coordinate as well as the data type can be seen with the micro-open function, the data type is generally ' double ';

In addition origin coordinate to use the structure header. Origin is given, enter the time where the header can be entered directly.

Later added: The Third kind is also very useful, and very soon. The first method is to write your own code, using the interpolation method, but in resample some templates (such as Craddock), the use of the first method will cause the addition of unnecessary boundaries, the picture will be drawn with a lot of borders. Because did not find in script where to change Resample method, or honestly use tools SPM Bar ... Although it is written here is SPM5, but SPM12 and 5 of this part is the same, can be copied completely.

(3) Use spm5:a. Click "Coregister"
B. Click "New" Coreg:reslice ""
C. "Image defining Space": choose one of your functional Image. e.g. your normalized functional image or image after Detrend and Filter.
D. "Images to Reslice": Choose the mask file or ROI definition file. e.g. brainmask_05_61x73x61.img
E. "Reslice Options", "interpolation": choose "Nearest neighbour"
F. Just click "Run". Then you'll get the resmapled mask or ROI file with a surfix of "R".

Resample The Mask

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.