help > Loading multiple ROIs
Showing 1-14 of 14 posts
May 22, 2017 05:05 PM | Kaitlin Cassady - University of Michigan - Ann Arbor
Loading multiple ROIs
Hello!
I have a text file containing the MNI coordinates of 250 ROIs that I would like to load into CONN. Is there a way that I can convert this into a nifti file and create 4mm spheres around each ROI so that I don't have to load in 250 ROIs one by one?
Thanks!
I have a text file containing the MNI coordinates of 250 ROIs that I would like to load into CONN. Is there a way that I can convert this into a nifti file and create 4mm spheres around each ROI so that I don't have to load in 250 ROIs one by one?
Thanks!
May 22, 2017 05:05 PM | Alfonso Nieto-Castanon - Boston University
RE: Loading multiple ROIs
Hi Kaitlin,
Using the attached patch, type in Matlab command-line:
conn_createmniroi( 'myfile.nii', 'myfile.txt', 4, 1);
The 4 defines the radius of the spheres, and the 1 defines the voxel resolution of the target file.
Hope this helps
Alfonso
Originally posted by Kaitlin Cassady:
Using the attached patch, type in Matlab command-line:
conn_createmniroi( 'myfile.nii', 'myfile.txt', 4, 1);
The 4 defines the radius of the spheres, and the 1 defines the voxel resolution of the target file.
Hope this helps
Alfonso
Originally posted by Kaitlin Cassady:
Hello!
I have a text file containing the MNI coordinates of 250 ROIs that I would like to load into CONN. Is there a way that I can convert this into a nifti file and create 4mm spheres around each ROI so that I don't have to load in 250 ROIs one by one?
Thanks!
I have a text file containing the MNI coordinates of 250 ROIs that I would like to load into CONN. Is there a way that I can convert this into a nifti file and create 4mm spheres around each ROI so that I don't have to load in 250 ROIs one by one?
Thanks!
May 23, 2017 07:05 PM | Kaitlin Cassady - University of Michigan - Ann Arbor
RE: Loading multiple ROIs
Hi Alfonso,
Thanks for your help! I tried using your function with the suggested command, but ran into a few issues:
-When I tried confirming that the ROIs corresponded to my list of ROIs in MNI space, they did not actually correspond to each other (please see attached text file with corresponding nifti file that was created), so I'm not sure what ROIs were created.
-Also, when I tried loading the nifti file into CONN, it looked like there was just one ROI for each subject, but with different colors that I assume correspond to the different ROIs? Is this the correct way to load it into CONN, or is there some way that I should create a separate file for each ROI?
-Lastly, I want my ROI file to be in the same voxel resolution as my functional data (2mm). Should I just enter a "2" instead of "1" in your suggested command?
Thanks so much for your help!
Thanks for your help! I tried using your function with the suggested command, but ran into a few issues:
-When I tried confirming that the ROIs corresponded to my list of ROIs in MNI space, they did not actually correspond to each other (please see attached text file with corresponding nifti file that was created), so I'm not sure what ROIs were created.
-Also, when I tried loading the nifti file into CONN, it looked like there was just one ROI for each subject, but with different colors that I assume correspond to the different ROIs? Is this the correct way to load it into CONN, or is there some way that I should create a separate file for each ROI?
-Lastly, I want my ROI file to be in the same voxel resolution as my functional data (2mm). Should I just enter a "2" instead of "1" in your suggested command?
Thanks so much for your help!
May 24, 2017 03:05 AM | Alfonso Nieto-Castanon - Boston University
RE: Loading multiple ROIs
Hi Kaitlin,
Sorry I did not get the attachment. Please resend (or send to my mail)
Alfonso
Originally posted by Kaitlin Cassady:
Sorry I did not get the attachment. Please resend (or send to my mail)
Alfonso
Originally posted by Kaitlin Cassady:
Hi Alfonso,
Thanks for your help! I tried using your function with the suggested command, but ran into a few issues:
-When I tried confirming that the ROIs corresponded to my list of ROIs in MNI space, they did not actually correspond to each other (please see attached text file with corresponding nifti file that was created), so I'm not sure what ROIs were created.
-Also, when I tried loading the nifti file into CONN, it looked like there was just one ROI for each subject, but with different colors that I assume correspond to the different ROIs? Is this the correct way to load it into CONN, or is there some way that I should create a separate file for each ROI?
-Lastly, I want my ROI file to be in the same voxel resolution as my functional data (2mm). Should I just enter a "2" instead of "1" in your suggested command?
Thanks so much for your help!
Thanks for your help! I tried using your function with the suggested command, but ran into a few issues:
-When I tried confirming that the ROIs corresponded to my list of ROIs in MNI space, they did not actually correspond to each other (please see attached text file with corresponding nifti file that was created), so I'm not sure what ROIs were created.
-Also, when I tried loading the nifti file into CONN, it looked like there was just one ROI for each subject, but with different colors that I assume correspond to the different ROIs? Is this the correct way to load it into CONN, or is there some way that I should create a separate file for each ROI?
-Lastly, I want my ROI file to be in the same voxel resolution as my functional data (2mm). Should I just enter a "2" instead of "1" in your suggested command?
Thanks so much for your help!
May 24, 2017 04:05 PM | Kaitlin Cassady - University of Michigan - Ann Arbor
RE: Loading multiple ROIs
Sorry about that! I just sent an email to you, but in case this is
faster I'll attach the files in two replies...
Attachment 1
Attachment 1
May 24, 2017 04:05 PM | Kaitlin Cassady - University of Michigan - Ann Arbor
RE: Loading multiple ROIs
Attachment 2
May 31, 2017 06:05 PM | Kaitlin Cassady - University of Michigan - Ann Arbor
RE: Loading multiple ROIs
Hello!
I just wanted to follow up on my question since I haven't gotten any responses for a while.
Thank you!
I just wanted to follow up on my question since I haven't gotten any responses for a while.
Thank you!
May 31, 2017 07:05 PM | Alfonso Nieto-Castanon - Boston University
RE: Loading multiple ROIs
Hi Kaitlin,
Regarding your first question, the function actually overwrites your My_ROIs.txt file with the new atlas labels for the file My_ROIs.nii, so my guess is that your original My_ROIs.txt info might have got overwritten from some previous test, and that is why it no longer contains the coordinates that you expect? (in particular the location of the ROIs in the "My_ROIs.nii" file that you attached do match the coordinates reported in the associated "My_ROIs.txt" file)
Regarding the last two questions, yes, the file already contains all of the ROI definitions (when imported into CONN that will be automatically broken down into the individual ROIs). A potential issue with the example file that you sent is that if your ROIs are overlapping, like in this example, instead of a single 3d atlas file (containing the ROI labels for each voxel) you probably want to create a 4d atlas file (containing a different volume per ROI). I am attaching a modified version of the original code to allows you to create either 3d or 4d atlas files. With the new code use the syntax:
conn_createmniroi( 'MyNewAtlasFile.nii', 'My_ROIs.txt', 4, 2, '4d');
in order to create a 4d atlas (two files named MyNewAtlasFile.nii and MyNewAtlasFile.txt), using 2mm voxel resolution, and containing 4mm radius spheres around the coordinates listed in the My_ROIs.txt file.
Hope this helps
Alfonso
Originally posted by Kaitlin Cassady:
Regarding your first question, the function actually overwrites your My_ROIs.txt file with the new atlas labels for the file My_ROIs.nii, so my guess is that your original My_ROIs.txt info might have got overwritten from some previous test, and that is why it no longer contains the coordinates that you expect? (in particular the location of the ROIs in the "My_ROIs.nii" file that you attached do match the coordinates reported in the associated "My_ROIs.txt" file)
Regarding the last two questions, yes, the file already contains all of the ROI definitions (when imported into CONN that will be automatically broken down into the individual ROIs). A potential issue with the example file that you sent is that if your ROIs are overlapping, like in this example, instead of a single 3d atlas file (containing the ROI labels for each voxel) you probably want to create a 4d atlas file (containing a different volume per ROI). I am attaching a modified version of the original code to allows you to create either 3d or 4d atlas files. With the new code use the syntax:
conn_createmniroi( 'MyNewAtlasFile.nii', 'My_ROIs.txt', 4, 2, '4d');
in order to create a 4d atlas (two files named MyNewAtlasFile.nii and MyNewAtlasFile.txt), using 2mm voxel resolution, and containing 4mm radius spheres around the coordinates listed in the My_ROIs.txt file.
Hope this helps
Alfonso
Originally posted by Kaitlin Cassady:
Hi Alfonso,
Thanks for your help! I tried using your function with the suggested command, but ran into a few issues:
-When I tried confirming that the ROIs corresponded to my list of ROIs in MNI space, they did not actually correspond to each other (please see attached text file with corresponding nifti file that was created), so I'm not sure what ROIs were created.
-Also, when I tried loading the nifti file into CONN, it looked like there was just one ROI for each subject, but with different colors that I assume correspond to the different ROIs? Is this the correct way to load it into CONN, or is there some way that I should create a separate file for each ROI?
-Lastly, I want my ROI file to be in the same voxel resolution as my functional data (2mm). Should I just enter a "2" instead of "1" in your suggested command?
Thanks so much for your help!
Thanks for your help! I tried using your function with the suggested command, but ran into a few issues:
-When I tried confirming that the ROIs corresponded to my list of ROIs in MNI space, they did not actually correspond to each other (please see attached text file with corresponding nifti file that was created), so I'm not sure what ROIs were created.
-Also, when I tried loading the nifti file into CONN, it looked like there was just one ROI for each subject, but with different colors that I assume correspond to the different ROIs? Is this the correct way to load it into CONN, or is there some way that I should create a separate file for each ROI?
-Lastly, I want my ROI file to be in the same voxel resolution as my functional data (2mm). Should I just enter a "2" instead of "1" in your suggested command?
Thanks so much for your help!
May 31, 2017 11:05 PM | Kaitlin Cassady - University of Michigan - Ann Arbor
RE: Loading multiple ROIs
Hi Alfonso,
Thanks so much for your help!
I used the updated code you sent and the was able to successfully create the the 4d ROI file. However, when I tried running the Conn setup step, I received the following error:
-------------------------------
ERROR DESCRIPTION:
Error using strcmp
Not enough input arguments.
Error in conn_process (line 725)
if any(strcmp(namesroi{nroi}{n1}),names{nroi1}), error('duplicated ROI name %s',namesroi{nroi}{n1}); end
Error in conn_process (line 12)
case 'setup', disp(['CONN: RUNNING SETUP STEP']); conn_process([0:5]);
Error in conn (line 2350)
conn_process('setup');
Error in conn_menumanager (line 109)
feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});
CONN v.14.p
SPM8 + Beamforming DEM FieldMap MEEGtools Masking adaptativethreshold suit vbm8 wfupickatlas
Matlab v.2013a
storage: 123.6Gb available
Warning: Contents.m overloaded by version in folder /Volumes/KC/spm8/toolbox/vbm8
-------------------------------
Do you have any ideas as to what the issue is? I put the new "MyNewAtlasFile.nii" and "MyNewAtlasFile.txt" files in the same directory. I'm not sure what the problem is. Let me know what you think.
Thanks!
Kaitlin
Thanks so much for your help!
I used the updated code you sent and the was able to successfully create the the 4d ROI file. However, when I tried running the Conn setup step, I received the following error:
-------------------------------
ERROR DESCRIPTION:
Error using strcmp
Not enough input arguments.
Error in conn_process (line 725)
if any(strcmp(namesroi{nroi}{n1}),names{nroi1}), error('duplicated ROI name %s',namesroi{nroi}{n1}); end
Error in conn_process (line 12)
case 'setup', disp(['CONN: RUNNING SETUP STEP']); conn_process([0:5]);
Error in conn (line 2350)
conn_process('setup');
Error in conn_menumanager (line 109)
feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});
CONN v.14.p
SPM8 + Beamforming DEM FieldMap MEEGtools Masking adaptativethreshold suit vbm8 wfupickatlas
Matlab v.2013a
storage: 123.6Gb available
Warning: Contents.m overloaded by version in folder /Volumes/KC/spm8/toolbox/vbm8
-------------------------------
Do you have any ideas as to what the issue is? I put the new "MyNewAtlasFile.nii" and "MyNewAtlasFile.txt" files in the same directory. I'm not sure what the problem is. Let me know what you think.
Thanks!
Kaitlin
Jun 1, 2017 01:06 AM | Alfonso Nieto-Castanon - Boston University
RE: Loading multiple ROIs
Hi Kaitlin,
Please update to the latest release (currently 17e), I believe this error probably just indicates that your conn version (14p) simply did not support 4d atlas files
Best
Alfonso
Originally posted by Kaitlin Cassady:
Please update to the latest release (currently 17e), I believe this error probably just indicates that your conn version (14p) simply did not support 4d atlas files
Best
Alfonso
Originally posted by Kaitlin Cassady:
Hi Alfonso,
Thanks so much for your help!
I used the updated code you sent and the was able to successfully create the the 4d ROI file. However, when I tried running the Conn setup step, I received the following error:
-------------------------------
ERROR DESCRIPTION:
Error using strcmp
Not enough input arguments.
Error in conn_process (line 725)
if any(strcmp(namesroi{nroi}{n1}),names{nroi1}), error('duplicated ROI name %s',namesroi{nroi}{n1}); end
Error in conn_process (line 12)
case 'setup', disp(['CONN: RUNNING SETUP STEP']); conn_process([0:5]);
Error in conn (line 2350)
conn_process('setup');
Error in conn_menumanager (line 109)
feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});
CONN v.14.p
SPM8 + Beamforming DEM FieldMap MEEGtools Masking adaptativethreshold suit vbm8 wfupickatlas
Matlab v.2013a
storage: 123.6Gb available
Warning: Contents.m overloaded by version in folder /Volumes/KC/spm8/toolbox/vbm8
-------------------------------
Do you have any ideas as to what the issue is? I put the new "MyNewAtlasFile.nii" and "MyNewAtlasFile.txt" files in the same directory. I'm not sure what the problem is. Let me know what you think.
Thanks!
Kaitlin
Thanks so much for your help!
I used the updated code you sent and the was able to successfully create the the 4d ROI file. However, when I tried running the Conn setup step, I received the following error:
-------------------------------
ERROR DESCRIPTION:
Error using strcmp
Not enough input arguments.
Error in conn_process (line 725)
if any(strcmp(namesroi{nroi}{n1}),names{nroi1}), error('duplicated ROI name %s',namesroi{nroi}{n1}); end
Error in conn_process (line 12)
case 'setup', disp(['CONN: RUNNING SETUP STEP']); conn_process([0:5]);
Error in conn (line 2350)
conn_process('setup');
Error in conn_menumanager (line 109)
feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});
CONN v.14.p
SPM8 + Beamforming DEM FieldMap MEEGtools Masking adaptativethreshold suit vbm8 wfupickatlas
Matlab v.2013a
storage: 123.6Gb available
Warning: Contents.m overloaded by version in folder /Volumes/KC/spm8/toolbox/vbm8
-------------------------------
Do you have any ideas as to what the issue is? I put the new "MyNewAtlasFile.nii" and "MyNewAtlasFile.txt" files in the same directory. I'm not sure what the problem is. Let me know what you think.
Thanks!
Kaitlin
Jun 1, 2017 01:06 AM | Kaitlin Cassady - University of Michigan - Ann Arbor
RE: Loading multiple ROIs
Perfect - thanks, Alfonso!
Jul 18, 2017 10:07 PM | Kaitlin Cassady - University of Michigan - Ann Arbor
RE: Loading multiple ROIs
Hi Alfonso,
I recently tried to create another 4D ROI file using the code you send previously. However I got the following error this time when I tried to run it:
------------------------------
conn_createmniroi( 'MyNewAtlasFile.nii', 'MyROIs.txt', 4, 2, '4d')
Error using max
Matrix dimensions must agree.
Error in conn_createmniroi (line 43)
bbox=[min(bbox(1,:),min(xyz-rad,[],1));
max(bbox(2,:),max(xyz+rad,[],1))];
------------------------------
Would you be able to let me know what I'm doing wrong?
Thanks!
I recently tried to create another 4D ROI file using the code you send previously. However I got the following error this time when I tried to run it:
------------------------------
conn_createmniroi( 'MyNewAtlasFile.nii', 'MyROIs.txt', 4, 2, '4d')
Error using max
Matrix dimensions must agree.
Error in conn_createmniroi (line 43)
bbox=[min(bbox(1,:),min(xyz-rad,[],1));
max(bbox(2,:),max(xyz+rad,[],1))];
------------------------------
Would you be able to let me know what I'm doing wrong?
Thanks!
Jul 20, 2017 01:07 AM | Alfonso Nieto-Castanon - Boston University
RE: Loading multiple ROIs
Hi Kaitlin,
My guess is that perhaps this is simply due to incorrect dimensions of the input xyz (this should be a matrix with 3 columns -x,y,z coordinates-)?
If that is not the case please try the attached version which performs a bit more extensive error checking if the inputs are not exactly as expected.
Best
Alfonso
Originally posted by Kaitlin Cassady:
My guess is that perhaps this is simply due to incorrect dimensions of the input xyz (this should be a matrix with 3 columns -x,y,z coordinates-)?
If that is not the case please try the attached version which performs a bit more extensive error checking if the inputs are not exactly as expected.
Best
Alfonso
Originally posted by Kaitlin Cassady:
Hi Alfonso,
I recently tried to create another 4D ROI file using the code you send previously. However I got the following error this time when I tried to run it:
------------------------------
conn_createmniroi( 'MyNewAtlasFile.nii', 'MyROIs.txt', 4, 2, '4d')
Error using max
Matrix dimensions must agree.
Error in conn_createmniroi (line 43)
bbox=[min(bbox(1,:),min(xyz-rad,[],1));
max(bbox(2,:),max(xyz+rad,[],1))];
------------------------------
Would you be able to let me know what I'm doing wrong?
Thanks!
I recently tried to create another 4D ROI file using the code you send previously. However I got the following error this time when I tried to run it:
------------------------------
conn_createmniroi( 'MyNewAtlasFile.nii', 'MyROIs.txt', 4, 2, '4d')
Error using max
Matrix dimensions must agree.
Error in conn_createmniroi (line 43)
bbox=[min(bbox(1,:),min(xyz-rad,[],1));
max(bbox(2,:),max(xyz+rad,[],1))];
------------------------------
Would you be able to let me know what I'm doing wrong?
Thanks!
Jul 20, 2017 08:07 PM | Kaitlin Cassady - University of Michigan - Ann Arbor
RE: Loading multiple ROIs
Thanks, Alfonso!