help > Atlas.nii ROI's
Showing 1-5 of 5 posts
Display:
Results per page:
Feb 14, 2018  06:02 PM | Greg Overbeek - University of Alabama at Birmingham
Atlas.nii ROI's
Hello,

Does anyone know if there is any information on the size, shape, and exact locations (MNI coordinates) of the ROI's in atlas.nii file within conn. I have tried to separate the ROIs in this image into different files, but I have been unsuccessful. There is a .mat file within the results/firstlevel/([specific analysis] folder that contains a variable xyz that gives MNI coordinates for each ROI. Plotting these points gives a region that appears to be the center of the ROI. Can anyone confirm this?

Thank you in advance for your help!

Best,

Greg
Jan 15, 2019  09:01 PM | Megan Fitzhugh
RE: Atlas.nii ROI's
Originally posted by Greg Overbeek:
Hello,

Does anyone know if there is any information on the size, shape, and exact locations (MNI coordinates) of the ROI's in atlas.nii file within conn. I have tried to separate the ROIs in this image into different files, but I have been unsuccessful. There is a .mat file within the results/firstlevel/([specific analysis] folder that contains a variable xyz that gives MNI coordinates for each ROI. Plotting these points gives a region that appears to be the center of the ROI. Can anyone confirm this?

Thank you in advance for your help!

Best,

Greg

Hi Greg,

I have the same question and am wondering if you were able to confirm the answer to this.

Thanks!
Megan
Jan 16, 2019  02:01 AM | Hyunwoo Kim
RE: Atlas.nii ROI's
There are some information in the directory where you install(unzip) conn.

In my case,
~/conn/rois/  is my conn installation directory.
If you look at this directory, you may see several files such as text, images and NIFTi files regarding atlas and networks which CONN uses.
For example, if you open 'atlas.info' file you can see the rules that CONN used to define ROI.
(Because I'm using linux, 'cat' command works, but I don't know in MAC...)

As written in this file, CONN uses the Harvard-Oxford Atlas for both cortical and subcortical atlas.
For more information, you have to read 'atlas.info' file because there are reference paper.
That paper would give more information I think.

Good luck for your research!
Jan 16, 2019  10:01 AM | Pravesh Parekh - National Institute of Mental Health and Neurosciences
RE: Atlas.nii ROI's
Hi,

Yes, the xyz variable contains the centroid of each of the ROIs.

If the atlas file is 4D, you can try SPM's 4D to 3D utility to quickly get to separate ROI files. In either case, this can be achieved using something on the lines of:

%% This case is for 3D atlas file having unique intensity values for each ROI
% Read in atlas.nii file
vol_atlas   = spm_vol('atlas.nii');
data_atlas = spm_read_vols(vol_atlas);
data_tmp  = data_atlas;

% Get all unique intensities
roi_vals    = unique(data_atlas);
num_vals = length(roi_vals);

% Loop over each intensity
for i = 1:num_vals

% Binarize the values
data_tmp(data_tmp~=roi_vals(i)) = 0;
data_tmp(data_tmp==roi_vals(i)) = 1;

% Write out
roi_name = ['ROI_', num2str(i, '%03d'), '.nii'];
vol_atlas.fname = roi_name;
spm_write_vol(vol_atlas, data_tmp);

% Reassign original values to data_tmp
data_tmp = data_atlas;
end

% ----------------------------------------------------------------------

%% This is the case of 4D atlas file where each volume is an ROI
% Read in atlas.nii file
vol_atlas = spm_vol('atlas.nii');
data_atlas = spm_read_vols(vol_atlas);

% Get number of ROIs
num_rois = size(data_atlas,4);

% Loop over each volume and write it out
for i = 1:num_rois
roi_name  = ['ROI_', num2str(i, '%03d'), '.nii'];
vol_atlas(i).fname = roi_name;

% If a field n exists, set it to 1
if isfield(vol_atlas, 'n')
vol_atlas(i).n = [1,1];
end

spm_write_vol(vol_atlas(i), squeeze(data_atlas(:,:,:,i)));
end


As an additional note, it is worthwhile to change the data type (vol.dt) as all ROIs from above are binary. Also the .info file contains a lot of useful information. The dimension of the overall file can be picked up from the NIfTI header.


Hope this helps


Best
Pravesh


Originally posted by Hyunwoo Kim:
There are some information in the directory where you install(unzip) conn.

In my case,
~/conn/rois/  is my conn installation directory.
If you look at this directory, you may see several files such as text, images and NIFTi files regarding atlas and networks which CONN uses.
For example, if you open 'atlas.info' file you can see the rules that CONN used to define ROI.
(Because I'm using linux, 'cat' command works, but I don't know in MAC...)

As written in this file, CONN uses the Harvard-Oxford Atlas for both cortical and subcortical atlas.
For more information, you have to read 'atlas.info' file because there are reference paper.
That paper would give more information I think.

Good luck for your research!
Jan 17, 2019  04:01 PM | Alfonso Nieto-Castanon - Boston University
RE: Atlas.nii ROI's
Hi Megan et al.

Also, just for reference, another quick-and-easy way to split an atlas file into its individual components is using the syntax:

   conn_rex split /software/conn/rois/atlas.nii

(changing the last part to the full path of your atlas file) will split that file into individual-ROI files which will be stored in your current folder (generally it is a good idea that your current folder is not the same as /software/conn/roi just to avoid duplicated versions of your ROIs)

Hope this helps
Alfonso

Originally posted by Pravesh Parekh:
Hi,

Yes, the xyz variable contains the centroid of each of the ROIs.

If the atlas file is 4D, you can try SPM's 4D to 3D utility to quickly get to separate ROI files. In either case, this can be achieved using something on the lines of:

%% This case is for 3D atlas file having unique intensity values for each ROI
% Read in atlas.nii file
vol_atlas   = spm_vol('atlas.nii');
data_atlas = spm_read_vols(vol_atlas);
data_tmp  = data_atlas;

% Get all unique intensities
roi_vals    = unique(data_atlas);
num_vals = length(roi_vals);

% Loop over each intensity
for i = 1:num_vals

% Binarize the values
data_tmp(data_tmp~=roi_vals(i)) = 0;
data_tmp(data_tmp==roi_vals(i)) = 1;

% Write out
roi_name = ['ROI_', num2str(i, '%03d'), '.nii'];
vol_atlas.fname = roi_name;
spm_write_vol(vol_atlas, data_tmp);

% Reassign original values to data_tmp
data_tmp = data_atlas;
end

% ----------------------------------------------------------------------

%% This is the case of 4D atlas file where each volume is an ROI
% Read in atlas.nii file
vol_atlas = spm_vol('atlas.nii');
data_atlas = spm_read_vols(vol_atlas);

% Get number of ROIs
num_rois = size(data_atlas,4);

% Loop over each volume and write it out
for i = 1:num_rois
roi_name  = ['ROI_', num2str(i, '%03d'), '.nii'];
vol_atlas(i).fname = roi_name;

% If a field n exists, set it to 1
if isfield(vol_atlas, 'n')
vol_atlas(i).n = [1,1];
end

spm_write_vol(vol_atlas(i), squeeze(data_atlas(:,:,:,i)));
end


As an additional note, it is worthwhile to change the data type (vol.dt) as all ROIs from above are binary. Also the .info file contains a lot of useful information. The dimension of the overall file can be picked up from the NIfTI header.


Hope this helps


Best
Pravesh


Originally posted by Hyunwoo Kim:
There are some information in the directory where you install(unzip) conn.

In my case,
~/conn/rois/  is my conn installation directory.
If you look at this directory, you may see several files such as text, images and NIFTi files regarding atlas and networks which CONN uses.
For example, if you open 'atlas.info' file you can see the rules that CONN used to define ROI.
(Because I'm using linux, 'cat' command works, but I don't know in MAC...)

As written in this file, CONN uses the Harvard-Oxford Atlas for both cortical and subcortical atlas.
For more information, you have to read 'atlas.info' file because there are reference paper.
That paper would give more information I think.

Good luck for your research!