Error in extracting ROISignals

Submitted by hbaetschmann on

Hi Chao-Gan,

There is a problem with masks containing NaN-values. Because Matlabs function 'unique' handles each NaN-value as a distinct value, in a multilabel ROI-defining mask with NaN-values each mask voxel with the value NaN is considered as a separate ROI. This situation can lead to maximum size exceeding errors when calculationg the covariance matrix.

I recommend to modify in the function y_ExtractROISignal the line 197  

195 if IsMultipleLabel == 1
196           Element = unique(MaskROI);
197            Element(find(Element==0)) = []; % This is the background 0
198            SeedSeries_MultipleLabel = zeros(nDimTimePoints,length(Element));
199            for iElement=1:length(Element)
200                
201                SeedSeries_MultipleLabel(:,iElement) = mean(AllVolume(:,find(MaskROI==Element(iElement))),2);
202                
203                MaskROILabel{1,iROI}{iElement,1} = num2str(Element(iElement));
204
205            end
206            SeedSeries{1,iROI} = SeedSeries_MultipleLabel;
207        else
208            SeedSeries{1,iROI} = mean(AllVolume(:,find(MaskROI)),2);
209        end

by new 
 
197                    Element( Element==0 | isnan(Element) ) = []; % This is the background ( 0 or NaN )

 

Best Hansruedi

 

YAN Chao-Gan

Sun, 12/18/2016 - 23:16

Hi Hansruedi,

The users should take care of the "NaN" values before entering into DPARSF.

Best,

Chao-Gan