help > RE: using a mask in conn/utils/otherrois/buildP.m
Dec 22, 2017  04:12 AM | Yifei Zhang
RE: using a mask in conn/utils/otherrois/buildP.m
Dear Alfonso,

Thanks a lot! That is exactly what I need!

You are right, using 1.5mm ROIs turns out to be an overkill (although I reduced the range to smaller brain area). Because I need to compute small world measurements of the whole regions and each ROIs, so I treat voxels as ROIs and using the 2nd-level network function in CONN to compute that. I am not sure if a voxel-to-voxel analysis can do this? 

What I try to do next is to use 3mm cubes instead of 1.5mm voxels, that will generate less than one thousand ROIs. Using the buildP.m, I got the P49422.img for 3mm atlas of the whole brain. To get the ROI atlas for CONN, I plan to mask P49422.img with the DMN and renumber it to the sequence of natural number. Is this correct? Do you have a better suggestion?

Thanks again!
Best regards,
Yifei
 
Originally posted by Alfonso Nieto-Castanon:
Dear Yifei,

The buildP function is optimised to handle considerably larger ROIs. For something closer to voxel-size (e.g. 1.5mm) what I would suggest is just to resample your DMN mask to 1.5mm voxels (e.g. into a file called "DMNmask.nii"). Then you may use simply something like the following:

% reads mask file
a = spm_vol('DMNmask.nii');
b = double(spm_read_vols(a));

% creates atlas file
voxels = find(b>0);
b(voxels) = 1:numel(voxels);
a.dt(1) = spm_type('float32');
a.fname = 'DMNvoxels.nii';
spm_write_vol(a,b);

% creates labels file
fh = fopen('DMNvoxels.txt','wt');
[x,y,z]=ind2sub(size(b),voxels);
xyz=a.mat*[x(:) y(:) z(:) ones(numel(x),1)]';
for n=1:numel(voxels), fprintf(fh,'(%.1f,%.1f,%.1f)\n', xyz(1,n),xyz(2,n),xyz(3,n)); end
fclose(fh);

to create a new atlas file (called "DMNvoxels.nii") where each voxel will be treated as a separate ROI by CONN.

That said, 1.5mm ROIs seems like an overkill (you are going to end up with tens of thousands of ROIs just within DMN), are you sure what you are trying to do might not be best served by either voxel-to-voxel analyses or by larger ROIs? 

Hope this helps
Alfonso 
Originally posted by Yifei Zhang:
Dear Alfonso,

I am trying to use the buildP.m provided in CONN/utils/otherrois.

My idea is to generate 1.5mm cubes only within a mask (e.g. within DMN or other networks) instead of the whole brain. I tried firstly to generate the 1.5mm (voxel size) whole brain parcels and then mask them with DMN. However, If I set the sidelengths to 1.5 mm in buildP.m, my Matlab crashed (maybe due to too many computations).

I also tried to set the "bounding box" (bbox) in buildP.m to the range of each of my ROI, but the output was wrong (out of the range of my ROI).

So the question is how to overlap a mask during the process of buildP.m.

Thanks a lot for your help!

Best regards,
Yifei

Threaded View

TitleAuthorDate
Yifei Zhang Dec 18, 2017
Alfonso Nieto-Castanon Dec 19, 2017
RE: using a mask in conn/utils/otherrois/buildP.m
Yifei Zhang Dec 22, 2017