help > RE: using a mask in conn/utils/otherrois/buildP.m
Dec 19, 2017  02:12 AM | Alfonso Nieto-Castanon - Boston University
RE: using a mask in conn/utils/otherrois/buildP.m
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
RE: using a mask in conn/utils/otherrois/buildP.m
Alfonso Nieto-Castanon Dec 19, 2017
Yifei Zhang Dec 22, 2017