help > error in roi data extraction during setup
Showing 1-8 of 8 posts
Display:
Results per page:
Aug 10, 2011  02:08 PM | Jennifer Stevens
error in roi data extraction during setup
Dear conn users,
 
I have received an error during Setup [pasted below], which seems to be related to Rex.  The error occurs during ROI data extraction for the second participant, so I think it might be related to the GM, WM, or CSF files created during segmentation for that participant.  But when I view the ROI images, they look pretty good.  Has anyone else encountered this issue?  Any insights would be greatly appreciated!
 
Thanks!
 
 
??? Subscripted assignment dimension mismatch.
Error in ==> rex>rex_do at 707
        if strcmpi(params.level,'voxels')||strcmpi(params.level,'subsetvoxels')||strcmpi(params.summary_measure,'eigenvariate'),ROIdat(:,rrx)=data;
        end
Error in ==> rex at 148
            [params.ROIdata,params.ROInames,params.ROIinfo.basis,params.ROIinfo.voxels,params.ROIinfo.files,params.ROIinfo.select,params.ROIinfo.trans]=rex_do(params,1);
           
Error in ==> conn_rex at 8
    [varargout{1:nargout}]=rex(varargin{:});
Error in ==> conn_process at 380
                        [data{nroi1},namesroi{nroi},params]=conn_rex(Vsource,Vmask{nroi},'summary_measure','eigenvariate','dims',CONN_x.Setup.rois.dimensions{nroi},'conjunction_mask',mask,'level',lev
                        Error in ==> conn_process at 10
        case 'setup',           disp(['CONN: RUNNING SETUP STEP']); conn_process([0:5]);
Error in ==> conn at 859
   conn_process('setup');
Error in ==> conn_menumanager at 112
       feval(MM.MENU{n0}.callback{n1}{1},MM.MENU{n0}.callback{n1}{2:end});
Aug 12, 2011  12:08 AM | Alfonso Nieto-Castanon - Boston University
RE: error in roi data extraction during setup
Dear Jennifer,
 
This error arises when the toolbox finds less than 16 degrees of freedom in the gray matter mask BOLD timeseries. If you install the latest version of rex from http://www.alfnie.com/software/rex.m (simply save this file into the conn distribution folder overwriting the existing file with the same name) the error should not show up again. Yet, this will not fix the underlying reason (that the BOLD timeseries within gray matter voxels has less degrees of freedom than expected). That could be caused by one of the following conditions:
 
  a) a problem with the gray/white/csf segmentation of this subject's structural data. You can check whether this is the source of the problem by exploring a file typically named 'ewc1*.img' that the toolbox creates containing the eroded gray-matter mask. If the segmentation of this subject's data has not worked as expected this file might be showing very few gray-matter voxels. To fix this you can typically simply re-run the segmentation using slightly different parameters (e.g. using more iterations, or re-orienting the structural file manually before running the segmentation/normalization step)
 
  b) a problem with the specification of the functional data for this subjet. If the functional timeseries contains less than 16 timepoints this would cause the same error. You can check whether this is the source of the problem by looking at the setup->functional step definition of the functional volumes for this subject and seeing whether this points to the correct number of files. Some people have reported that when using the 'import from SPM' functionality (and when the functional volumes have been moved from the original storage location after the SPM analyses had been defined/run) a bug in the conn_importspm script would incorrectly define the functional volumes to all point to a single timepoint of the original BOLD timeseries. If this was the source of this error in your case you can fix it downloading the latest version of the conn_importspm.m script from http://www.alfnie.com/software/conn_importspm.m and re-running the 'import' step.
 
Let me know if any of these seem to be the source of your error as well.
 
Best
Alfonso
 
 
 
Aug 12, 2011  01:08 PM | Jennifer Stevens
RE: error in roi data extraction during setup
Dear Alfonso,
 
Thank you very much for the suggestions, and links to updated files.  I really appreciate your help. 
 
I understand the issue with degrees of freedom, but haven't been able to pinpoint the underlying problem.
 
I believe that the functional data (option "b") were correctly specified.  The full list of scans was included.  There were 280 scans in the session, so that at least shouldn't create a problem with degrees of freedom.
 
The problem may stem from segmentation.  I used the updated version of rex.m which you sent, and ran Setup with only the GM, WM, and CSF ROIs.  Received this new error:
 
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> rex>rex_image at 909
        txt=strvcat(txt,[...
 
Perhaps too few voxels remain in the eroded masks.  Setup didn't create an ewc1* image, but I'm guessing that the error occurred before this step.  ewc2 and ewc3 were created.  ewc3 contains very few voxels for any participant.  I'm attaching an ewc3. 
 
I normalized the structural T1 images before importing them into conn, and resliced them to match the voxel sizes for the functional images- 3x3x3 (they were originally 1x1x1).  Would help with the degrees of freedom to reslice T1s to an intermediate resolution, like 2x2x2?  Or does conn care whether the resolution is the same for structural and functional images?
Attachment: ec3wmT1.hdr
Aug 12, 2011  01:08 PM | Jennifer Stevens
RE: error in roi data extraction during setup
other file...
Attachment: ec3wmT1.img
Aug 14, 2011  04:08 AM | Alfonso Nieto-Castanon - Boston University
RE: error in roi data extraction during setup
Dear Jennifer,
 
This seems to me the result of an incorrect segmentation step. Typically I would expect the ec3*.img file (csf mask after erosion) to contain a considerably larger mask than the <1 cm3 mask in the file that you attached. You can check the quality of the segmentation in your case simply displaying the files named c1wmt1.img to c3wmt1.img -gray/white/csf areas-. Typical 'correct' segmentation steps produce relatively crisp segment borders and high values (close to 1) within each of the gray/white/csf areas, while 'incorrect' segmentation steps produce (due to the relatively strong priors in SPM) relatively smooth segment borders and lower values within each of the gray/white/csf areas.
 
In any way, my guess would be that the problem might be related to the relatively low-res structurals that you are entering into the toolbox. Typically, when you let the toolbox perform the entire spatial preprocessing of the data, you would enter your raw structural volumes (e.g 1mm voxels) and the toolbox will perform the normalization/segmentation on these high-res files, and then the toolbox would automatically enter the normalized structurals resampled to 2mm isotropic voxels in the setup->strucuturals field, and the normalized gray/white/csf areas -without resampling- in the setup->rois->grey/white/csf fields. Alternatively, when you have already performed all of the spatial preprocessing steps outside of the toolbox, you would typically enter the normalized structurals in the setup->structurals field (typically after resampling to a 2mm or similar resolution, since the toolbox will use this resolution as the resolution for all voxel-based analyses), and the normalized grey/white/csf masks resulting from the segmentation of your original structural volumes in the setup->rois->grey/white/csf fields. I believe what you might be doing instead is entering the normalized structural volumes resampled to 3mm voxels into the setup->structurals field, and leaving the setup->rois->grey/white/csf fields empty. This will cause the toolbox to attempt to perform the segmentation on the provided structural volumes, and this segmentation might be failing due to the relatively low-resolution of the provided structurals. If this is the case, what I would suggest is to perform the segmentation step in SPM using the original normalized structural volumes before resampling (e.g. the file named wmT1.nii), choosing to output the 'native space' grey/white/csf output files in the segmentation batch definition, and then enter the resulting files (e.g. named c1wmT1 to c3wmT1 files in the setup->rois->gray/white/csf fields in the toolbox (no need to resample these files), and re-run the 'setup' step as above (and please delete the files named ec2wmt1.img and ec3wmt1.img to avoid the toolbox from using these incorrect files). Alternatively, if you had already perform the segmentation step on your data originally (e.g. if you had files named wc1T1.nii to wc1T3.nii, normalized outputs of the segmentation of your original T1.nii structural volumes), then you can simply enter these files into the setup->rois/gray/white/csf fields in the toolbox directly (no need to resample these files), and re-run the 'setup' step as above (without needing to repeat the already-performed segmentation).
 
Let me know if this helps.
 
Sep 27, 2011  03:09 PM | Tomas Ros
RE: error in roi data extraction during setup
Dear Alfonso, 

Actually I keep getting the same error, during the "importing ROI data" step, as Jennifer below when I use the 13a toolbox (I downloaded the new rex file to no avail).

??? Error using ==> mtimes 
Inner matrix dimensions must agree. 
Error in ==> rex>rex_image at 909 

        txt=strvcat(txt,[... )


 I checked all my functional & structural data and it seems fine. Importantly, running the same parameter file with version 12p does not seem to produce this error and everything works. 

With thanks,
Tomas Ros

Originally posted by Jennifer Stevens:
Dear Alfonso,
 
Thank you very much for the suggestions, and links to updated files.  I really appreciate your help. 
 
I understand the issue with degrees of freedom, but haven't been able to pinpoint the underlying problem.
 
I believe that the functional data (option "b") were correctly specified.  The full list of scans was included.  There were 280 scans in the session, so that at least shouldn't create a problem with degrees of freedom.
 
The problem may stem from segmentation.  I used the updated version of rex.m which you sent, and ran Setup with only the GM, WM, and CSF ROIs.  Received this new error:
 
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> rex>rex_image at 909
        txt=strvcat(txt,[...
 
Perhaps too few voxels remain in the eroded masks.  Setup didn't create an ewc1* image, but I'm guessing that the error occurred before this step.  ewc2 and ewc3 were created.  ewc3 contains very few voxels for any participant.  I'm attaching an ewc3. 
 
I normalized the structural T1 images before importing them into conn, and resliced them to match the voxel sizes for the functional images- 3x3x3 (they were originally 1x1x1).  Would help with the degrees of freedom to reslice T1s to an intermediate resolution, like 2x2x2?  Or does conn care whether the resolution is the same for structural and functional images?
Sep 27, 2011  09:09 PM | Alfonso Nieto-Castanon - Boston University
RE: error in roi data extraction during setup
Dear Tomas,

Thanks for reporting this. This issue (??? Error using ==> mtimes) has been fixed in the conn release 13.b, please let me know whether everything seems to be working fine now.

Thanks
Alfonso
 
Sep 28, 2011  03:09 PM | Tomas Ros
RE: error in roi data extraction during setup
Works now, thank you!