questions about data processing assistant for resting state fmri

hello

i was wondering if anyone is familiar with the DPARSF toolkit for resting state fmri. it seems to me that the images have to be converted to dicom images to use this toolkit. is the correct because my image are currently in the par/rec format. also, is this toolkit used to preprocess images for a resting state fmri analysis or can the images be preprocessed in the ususal manner. i apologize if these are really simple questions, but i am just starting to look at conducting a resting state fmri and would greatly appreciate any and all help or suggestions.

thank you in advance for your time

j

You also can start with NIfTI images but not DICOM images.
I strongly recommend you download the multimedia course, it will tell you how to perform the analysis with DPARSF and will keep you out of many unnecessary errors.
http://restfmri.net/forum/Course
The preprocessing steps are based on SPM5 (or SPM8), so you can use it to do the preprocessing not only on resting-state fMRI data but also on the task data.

hi all,
i just downloaded the latest version of REST (v 1.3), and using it on matlab2007b. i have a directory of normalized NifTi images that i want it to see (I used the directory name suggested in your video tutorial), but unfortunately the GUI keeps coming up with the error 

' There is no data or non-data files in this directory
/data/bc249/restingstate/FunImgNormalized'

Please re-select.

any help would be highly appreciated!
best regards,

bhisma

After you arranged your data as "/data/bc249/restingstate/FunImgNormalized", you can continued multi-step analysis in DPARSF by click some checkboxes.
But I guess you just click "OK" button in REST V1.3, and you get the error message.
The usages of REST and DPARSF are a little different. The course has depict it.
If you meet further errors, please give more details, such as: you file structure, what button you clicked.
Best wishes!

hi yan,

thanks for your quick reply. i have now downloaded DPARSF v 1.0 beta, and am trying to run detrend and ReHo on the unsmoothed data, using the GUI.  it recognises my normalized Nifti files alright, but says that the number of timepoints in the images is zero. this is not true, as opening it in FSLview shows that there are 512 volumes in each Nifti image.

the exact error message reads:
The detected timepoints of the subject "filename.nii" is 0, it is different from the predefined time points :512. please check your data"

i was wondering if you could please help!
many thanks,
bhisma

DPARSF and REST can process NIfTI .hdr/.mig pairs file currently (same as SPM5).
Please convert your compressed .nii file to NIfTI .hdr/.mig pairs file by FSL or MRIcroN first.
Best wishes!

hi yan,
thanks for your helpful comments before. i have converted all  compressed .nii files to series of 3D files with fslchfiletype, and arranged the normalized data in a subject specific directory within another directory named 'FunImgNormalized'. this was detected by DPARSF. i have disabled all options other than detrend and filter, as i already have unsmoothed normalized images.
however, DPARSF crashes immediately after starting with the following error message.
_____________________
>> addpath ~/Download/REST2007V1.3_090525/
>> addpath ~/Download/DPARSF_V1.0Beta_090713/
>>
>> DPARSF

Removing the linear trend:

     Read 3D EPI functional images: "/shared/ExptData/AIMSrsfMRI/mike_preprocessed/FunImgNormalized/22001".??? Error using ==> rest_ReadNiftiImage at 103
Meet error while reading the data

Error in ==> rest_readfile at 61
            [Outdata,Header]= rest_ReadNiftiImage(imageIN,volumeIndex);

Error in ==> rest_to4d at 42
        [theOneTimePoint, VoxelSize, Header] = rest_readfile(theFilename);

Error in ==> rest_detrend at 23
    [AllVolume,VoxelSize,theImgFileList, Header] =rest_to4d(ADataDir);

Error in ==> DPARSF_run at 450
        rest_detrend([AutoDataProcessParameter.DataProcessDir,filesep,FunImgDir,filesep,AutoDataProcessParameter.SubjectID{i}],
        '_detrend');

Error in ==> DPARSF>pushbuttonRun_Callback at 806
    [Error]=DPARSF_run(handles.Cfg);

Error in ==> gui_mainfcn at 96
        feval(varargin{:});

Error in ==> DPARSF at 31
    gui_mainfcn(gui_State, varargin{:});
 
??? Error while evaluating uicontrol Callback
____________________

i would be very grateful for any help!
many thanks,

bhisma

hi yan,

sorry for so many emails. i got DPARSF to work by changing the filetype to ANALYZE (using fslchfiletype). previously i had changed them to NIFTI_PAIR, and that did not work for some reason (which gave the error message in my previous email above).

i then detrended and filtered the data (the set of 3D files in Analyze hdr img format) using default settings. i then tried to run ReHo on these images, using the mask 91x109x91 2mmx2mmx2mm voxel size (same dimensions as my unsmoothed normalized detrended filtered images).  this runs for a while but throws up a error message at the end - copied below:

__________________________________--
REST Version: 1.3, Release: 20090525

ReHo :"/shared/ExptData/AIMSrsfMRI/mike_preprocessed/FunImgNormalized/22001_detrend_filtered"

     Read these 3D EPI functional images.    wait...
     Read 3D EPI functional images: "/shared/ExptData/AIMSrsfMRI/mike_preprocessed/FunImgNormalized/22001_detrend_filtered".............................................................................................................................

Exception occured.    ()
    Error using ==> rest_ReadNiftiImage at 103
Meet error while reading the data
    103#line,        rest_ReadNiftiImage,    in "/home/PSYCHOLOGY/gs901072/Download/REST2007V1.3_090525/rest_ReadNiftiImage.m"
    61#line,        rest_readfile,    in "/home/PSYCHOLOGY/gs901072/Download/REST2007V1.3_090525/rest_readfile.m"
    43#line,        rest_loadmask,    in "/home/PSYCHOLOGY/gs901072/Download/REST2007V1.3_090525/rest_loadmask.m"
    63#line,        reho,    in "/home/PSYCHOLOGY/gs901072/Download/REST2007V1.3_090525/reho.m"
    320#line,        btnComputeReho_Callback,    in "/home/PSYCHOLOGY/gs901072/Download/REST2007V1.3_090525/reho_gui.m"
    96#line,        gui_mainfcn,    in "/tmp/mathworks_downloads/toolbox/matlab/guide/gui_mainfcn.m"
    34#line,        reho_gui,    in "/home/PSYCHOLOGY/gs901072/Download/REST2007V1.3_090525/reho_gui.m"
>>

Here's a copy of the log produced by ReHo:

REST Version:1.3, Release 20090525
-------------------------------------------------------------------------------
 
ReHo computation log 20090811_1818
-------------------------------------------------------------------------------
 
 
-------------------------------------------------------------------------------
Remove Linear Trend options:
    remove linear trend BEFORE filter: No
 
 
-------------------------------------------------------------------------------
Ideal Band Pass filter options:
    Use Filter: No
    Band Low: 0.01
    Band High: 0.08
    Sample Period(i.e. TR): 2
 
 
-------------------------------------------------------------------------------
ReHo input parameters:
    Input Data Directories( ): 
    -------------------------------------------------------------------------------
    620# /shared/ExptData/AIMSrsfMRI/mike_preprocessed/FunImgNormalized/22001_detrend_filtered
    -------------------------------------------------------------------------------
    Mask file: /home/PSYCHOLOGY/gs901072/Download/REST2007V1.3_090525/mask/BrainMask_05_91x109x91.img
    Cluster Count: 27
 
 
-------------------------------------------------------------------------------
ReHo output parameters:
    Output Prefix: RehoMap2
    Output Data Directories: /shared/ExptData/AIMSrsfMRI/mike_preprocessed/RehoOutput
    Want mean ReHo map computation: Yes 
 
 
-------------------------------------------------------------------------------

i would be very grateful for any suggestion of what i might be doing wrong!
many thanks,

bhisma

Is your linux 64 bit?
Please refer to http://restfmri.net/forum/node/102
You may need to recompile related NIFTI reading program files based on SPM5 in your OS as dargonchow did.
And I suggest you convert your data to 3D NIfTI images, since ANALYZE images will lose the Left/Right information.
Best wishes!

hi yan,

thanks for your responses. to make sure that the problems that i am experiencing were not just due to my machine being 64 bit, i have now run the same steps in a 32 bit Debian machine, but with no luck. this time, i did NOT convert the .nii images to ANALYZE pairs, as you recommended, but to the NIFTI_PAIR images using fslchfiletype. however, this comes up with the familiar error message at the detrending stage while using DPARSF

??? Error using ReadNiftiImage at 103 

if i convert to Analyze, then your program can go through the detrending without a hassle, but NIFTI_PAIR seems to pose this problem.
i would be really grateful for any insight/help! How crucial is the left right information in Analyze file format - for the rest of the DPARSF pipeline - i.e. does it involve any flipping at any visualization stage?

bhisma



Hi!
Sorry for the later reply since I have gone out for a vacation.
Plese refer to http://restfmri.net/forum/node/131 : Fix the error of reading and writing NIfTI images in REST on multiple OS (especially 64 bit linux)
Hope it works this time.
Best wishes!

 hi yan,

thanks for your helpful pointer. i have downloaded and run the fix_read_write script, (my machine is Fedora Core 10, 64 Bit Intel dual core, with SPM8 - with latest updates, and Matlab 2009a), and am running the detrended filtered images on DPARSF , using my userdefined mask of 91x109x91, 2mmx2mmx2mm (located in the /mask subdirectory within REST). unfortunately i still get this error message 

>> DPARSF
  Read these 3D EPI functional images. wait...
  Read 3D EPI functional images: "/shared/ExptData/AIMSrsfMRI/FunImgNormalizedDetrendedFiltered/22001".............................................................................................................................
??? Error using ==> rest_loadmask at 37
There are no appropriate default mask file:
 Volume size=79*95*69 ,Voxel size=2*2*2;
 Volume size=53*63*46, Voxel size=3*3*3;
 Volume size=91*109*91, Voxel size=2*2*2;
 Volume size=61*73*61, Voxel size=3*3*3;
 Please set bMask = 0.

Error in ==> reho at 63
mask=rest_loadmask(nDim1, nDim2, nDim3, AMaskFilename);

Error in ==> DPARSF_run at 511
  reho(
  [AutoDataProcessParameter.DataProcessDir,filesep,FunImgDir,filesep,AutoDataProcessParameter.SubjectID{i}],
  ...

Error in ==> DPARSF>pushbuttonRun_Callback at 806
  [Error]=DPARSF_run(handles.Cfg);

Error in ==> gui_mainfcn at 96
  feval(varargin{:});

Error in ==> DPARSF at 31
  gui_mainfcn(gui_State, varargin{:});
 
??? Error while evaluating uicontrol Callback

Interestingly, when i run the same  images through REST, using the same user-defined mask, the ReHo calculation proceeds fine, as seen here:

ReHo :"/shared/ExptData/AIMSrsfMRI/FunImgNormalizedDetrendedFiltered/22002"

  Read these 3D EPI functional images. wait...
  Read 3D EPI functional images: "/shared/ExptData/AIMSrsfMRI/FunImgNormalizedDetrendedFiltered/22002".............................................................................................................................

  Calculate the rank of time series on voxel by voxel....................
  Calculate the kcc on voxel by voxel for the data set.
  The reho of the data set was finished.

 Regional Homogeneity computation over, elapsed time: 758.86 seconds

ReHo :"/shared/ExptData/AIMSrsfMRI/FunImgNormalizedDetrendedFiltered/22001"

  Read these 3D EPI functional images. wait...
  Read 3D EPI functional images: "/shared/ExptData/AIMSrsfMRI/FunImgNormalizedDetrendedFiltered/22001".............................................................................................................................

  Calculate the rank of time series on voxel by voxel....................
  Calculate the kcc on voxel by voxel for the data set.
  The reho of the data set was finished.

 Regional Homogeneity computation over, elapsed time: 697.17 seconds
>> 

i would be very grateful for any help!

thanks as always!
bhisma

Hi!
I am sorry this error is caused by a bug. Thanks for your report!
Please download the latest release.
New features of DPARSF_V1.0Beta_090909:
1. Fixed the bug of setting user's defined mask.

 hi yan,
sorry to trouble you again, but i seem to get the same error message again when i try to run DPARSF (the new release 090909) on the FunImgNormalizedDetrendedFiltered images, with an user defined mask (91x109x91, 2mmx2mmx2mm). error message reproduced below:

>> addpath ~/Download/DPARSF_V1.0Beta_090909/
>> addpath ~/Download/REST2007V1.3_090525/
>> addpath ~/Download/spm8/
>> REST_Fix_Read_Write_Error
>> DPARSF
Warning: Directory already exists. 
> In DPARSF_run at 512
  In DPARSF>pushbuttonRun_Callback at 835
  In gui_mainfcn at 96
  In DPARSF at 33

  Read these 3D EPI functional images. wait...
  Read 3D EPI functional images: "/shared/ExptData/AIMSrsfMRI/FunImgNormalizedDetrendedFiltered/22001".............................................................................................................................
??? Error using ==> rest_loadmask at 37
There are no appropriate default mask file:
 Volume size=79*95*69 ,Voxel size=2*2*2;
 Volume size=53*63*46, Voxel size=3*3*3;
 Volume size=91*109*91, Voxel size=2*2*2;
 Volume size=61*73*61, Voxel size=3*3*3;
 Please set bMask = 0.

Error in ==> reho at 63
mask=rest_loadmask(nDim1, nDim2, nDim3, AMaskFilename);

Error in ==> DPARSF_run at 514
  reho(
  [AutoDataProcessParameter.DataProcessDir,filesep,FunImgDir,filesep,AutoDataProcessParameter.SubjectID{i}],
  ...

Error in ==> DPARSF>pushbuttonRun_Callback at 835
  [Error]=DPARSF_run(handles.Cfg);

Error in ==> gui_mainfcn at 96
  feval(varargin{:});

Error in ==> DPARSF at 33
  gui_mainfcn(gui_State, varargin{:});
 
??? Error while evaluating uicontrol Callback

>> which DPARSF
/home/PSYCHOLOGY/gs901072/Download/DPARSF_V1.0Beta_090909/DPARSF.m
>> 

many thanks for any help!
bhisma

Hi!

Could you set a breakpoint on the first executable sentence in DPARSF_run.m?

After you set parameters in DPARSF GUI and click "Run" button, it will call DPARSF_run.m, could you tell me what the varaibles (and the details under struct fields) in matlab workspace are while it stoped on the breakpoint?
Thanks a lot!

 hi yan,
i ran DPARSF with the 'dbstop if error' option to locate the exact point at which it was breaking, here is an output from that (with the whos output appended)

>> dbstop if error
>> DPARSF
Warning: Directory already exists. 
> In DPARSF_run at 512
  In DPARSF>pushbuttonRun_Callback at 835
  In gui_mainfcn at 96
  In DPARSF at 33

  Read these 3D EPI functional images. wait...
  Read 3D EPI functional images: "/shared/ExptData/AIMSrsfMRI/FunImgNormalizedDetrendedFiltered/22001".............................................................................................................................
??? Error using ==> rest_loadmask at 37
There are no appropriate default mask file:
 Volume size=79*95*69 ,Voxel size=2*2*2;
 Volume size=53*63*46, Voxel size=3*3*3;
 Volume size=91*109*91, Voxel size=2*2*2;
 Volume size=61*73*61, Voxel size=3*3*3;
 Please set bMask = 0.

Error in ==> reho at 63
mask=rest_loadmask(nDim1, nDim2, nDim3, AMaskFilename);

Error in ==> DPARSF_run at 514
  reho(
  [AutoDataProcessParameter.DataProcessDir,filesep,FunImgDir,filesep,AutoDataProcessParameter.SubjectID{i}],
  ...

Error in ==> DPARSF>pushbuttonRun_Callback at 835
  [Error]=DPARSF_run(handles.Cfg);

Error in ==> gui_mainfcn at 96
  feval(varargin{:});

Error in ==> DPARSF at 33
  gui_mainfcn(gui_State, varargin{:});
 
37 error(sprintf('There are no appropriate default mask file:\n\tVolume size=79*95*69 ,Voxel size=2*2*2;\n\tVolume size=53*63*46, Voxel size=3*3*3;\n\tVolume size=91*109*91, Voxel size=2*2*2;\n\tVolume size=61*73*61, Voxel size=3*3*3;\n Please set b
K>> whos
  Name Size Bytes Class Attributes

  AMaskFilename 1x7 14 char  
  AX 1x1 8 double  
  AY 1x1 8 double  
  AZ 1x1 8 double  
  ext 0x0 0 char  
  name 1x13 26 char  
  pathstr 1x54 108 char  
  versn 0x0 0 char  

_______________________

i then added a break point at line 105 (first executable line of DPARSF_run.m, and ran the same job. here's the whos output from that.

 
>> dbstop in DPARSF_run.m at 105
>> 
>> 
>> DPARSF
105 [ProgramPath, fileN, extn] = fileparts(which('DPARSF_run.m'));
K>> whos
  Name Size Bytes Class Attributes

  AutoDataProcessParameter 1x1 14660 struct  

K>> 

___________________

i was wondering if this is what you were asking for?
many thanks as always,
bhisma

Hi!
Please tell me the following contents:
AutoDataProcessParameter.AMaskFilename
AutoDataProcessParameter.CalReHo.AMaskFilename
AutoDataProcessParameter.CalALFF.AMaskFilename
AutoDataProcessParameter.CalfALFF.AMaskFilename
AutoDataProcessParameter.CalFC.AMaskFilename
Thanks!

hi yan,

i am not sure i am doing the right thing, but it seems i can't get the contents you asked for (this is using a breakpoint at line 105 of DPARSF_run.m):
there is a field called AutoDataProcessParameter.MaskFile, which locates my userdefined mask, but i can not locate the contents that you asked for .
please could you tell me what i am doing wrong?

many thanks,
bhisma

 Name                          Size            Bytes  Class     Attributes
 
  AutoDataProcessParameter      1x1             14660  struct              
 
K>> AutoDataProcessParameter
 
AutoDataProcessParameter = 
 
                   WorkingDir: '/shared/ExptData/AIMSrsfMRI'
               DataProcessDir: '/shared/ExptData/AIMSrsfMRI'
                    SubjectID: {2x1 cell}
                   TimePoints: 620
                           TR: 1.3090
      IsNeedConvertFunDCM2IMG: 0
        RemoveFirstTimePoints: 0
                IsSliceTiming: 0
                  SliceTiming: [1x1 struct]
                    IsRealign: 0
                  IsNormalize: 0
       IsNeedConvertT1DCM2IMG: 0
                    Normalize: [1x1 struct]
    IsDelFilesBeforeNormalize: 1
                     IsSmooth: 0
                       Smooth: [1x1 struct]
               DataIsSmoothed: 0
                    IsDetrend: 0
                     IsFilter: 0
                       Filter: [1x1 struct]
          IsDelDetrendedFiles: 0
                     MaskFile: [1x87 char]
                    IsCalReHo: 1
                      CalReHo: [1x1 struct]
                    IsCalALFF: 0
                      CalALFF: [1x1 struct]
                   IsCalfALFF: 0
                     CalfALFF: [1x1 struct]
                  IsCovremove: 0
                    Covremove: [1x1 struct]
               IsExtractAALTC: 1
               IsExtractROITC: 0
                 ExtractROITC: [1x1 struct]
    IsExtractRESTdefinedROITC: 0
                      IsCalFC: 0
                        CalFC: [1x1 struct]
           IsResliceT1To1x1x1: 0
                  IsT1Segment: 0
            IsWrapAALToNative: 0
         IsExtractAALGMVolume: 0
 
K>> AutoDataProcessParameter.MaskFile
 
ans =
 
/home/PSYCHOLOGY/gs901072/Download/REST2007V1.3_090525/mask/rBrainMask_05_91x109x91.img
 
K>> AutoDataProcessParameter.AMaskFilename
??? Reference to non-existent field 'AMaskFilename'.
 

K>>  

Only guessing is a time-killer and helps little, espicially for coders to locate the bugs in their problems.
I think Yan want to re-encounter your problem to solve the bugs you found.
You may give him the chance to make your problem also emerge on Yan's computer.
 

Thanks for Xiao-Wei's suggestion!
Could you dipict your actions in details?
If you can not locate the contents, could you re-download the latest DPARSF at first?

dear yan,

my actions are as detailed in  my post on 08/09/2009. i am running DPARSF on a set of unsmoothed images that are detrended and filtered and stored in the FunImgNormalizedDetrendedFiltered directory. the matlab version is 2009a, my OS is Fedora Core 10, on a 64 Bit machine running dual core Intel processor.

i am trying to run a ReHo analysis, using DPARSF, and have failed so far due to the error re: user defined masks that it can not seem to find. 

i have re-downloaded DPARSF-v1_090909, and run the same job:
( the only buttons that are clicked in the GUI are ReHo, mReho-1, and specifies the user-defined mask as a resampled mask file of the same dimension as the images themselves. (see attached screenshot)

i have set a break point at line 108 on DPARSF_run.m, and inquired about the fields you asked for. here are the answers.
AutoDataProcessParameter.AMaskFilename=  ??? Reference to non-existent field 'AMaskFilename'.
AutoDataProcessParameter.CalReHo.AMaskFilename = Default
AutoDataProcessParameter.CalALFF.AMaskFilename = Default
AutoDataProcessParameter.CalfALFF.AMaskFilename = Default
AutoDataProcessParameter.CalFC.AMaskFilename= Default

am very grateful for your help.
best,
bhisma


 

Hi!
Thanks for your report!
I have missed a line of code in release 090909. Stupid, haha~~
Please download the latest release: DPARSF_V1.0Beta_090911.zip
Best wishes!
              Chao-Gan

 hi chao-gan,
thanks for the new release. i am trying to get it to run one ReHo analysis (as detailed in my earlier email), and it seems to run through the first subject ok, but then crashes with the following (new!) error message (pasted below).

any help would be great!
thanks,
bhisma

______________

  Read these 3D EPI functional images. wait...
  Read 3D EPI functional images: "/shared/ExptData/AIMSrsfMRI/FunImgNormalizedDetrendedFiltered/22001".............................................................................................................................

  Calculate the rank of time series on voxel by voxel....................
  Calculate the kcc on voxel by voxel for the data set.
  The reho of the data set was finished.

 Regional Homogeneity computation over, elapsed time: 707.09 seconds
??? Undefined function or method 'cfg_util' for input arguments of
type 'cell'.

Error in ==> spm_jobman at 202
  cjob = cfg_util('initjob', mljob);

Error in ==> DPARSF_run at 527
  spm_jobman('run',jobs)

Error in ==> DPARSF>pushbuttonRun_Callback at 841
  [Error]=DPARSF_run(handles.Cfg);

Error in ==> gui_mainfcn at 96
  feval(varargin{:});

Error in ==> DPARSF at 33
  gui_mainfcn(gui_State, varargin{:});
 
??? Error while evaluating uicontrol Callback

>> 

Hi!
I think you encountered this error when you using SPM8.
Could you try SPM5 currently?
There maybe an error in converting SPM5 batch jobs to SPM8 with spm_jobman, I am contacting the SPM team to discuss this issue.
Thanks for your report!
Best wishes!

 hi chao-gan,
i have recently downloaded the latest version of DPARSF (091001) and trying to run the same analysis as i have been talking to you about in my previous emails. this time it gave me a new error message, pasted below.

Read these 3D EPI functional images. wait...
  Read 3D EPI functional images: "/shared/ExptData/AIMSrsfMRI/FunImgNormalizedDetrendedFiltered/22001".............................................................................................................................

  Calculate the rank of time series on voxel by voxel....................
  Calculate the kcc on voxel by voxel for the data set.
  The reho of the data set was finished.

 Regional Homogeneity computation over, elapsed time: 731.66 seconds
??? Undefined function or method 'cfg_util' for input arguments of
type 'cell'.

Error in ==> spm_jobman at 202
  cjob = cfg_util('initjob', mljob);

Error in ==> DPARSF_run at 615
  spm_jobman('run',jobs{1});

Error in ==> DPARSF>pushbuttonRun_Callback at 841
  [Error]=DPARSF_run(handles.Cfg);

Error in ==> gui_mainfcn at 96
  feval(varargin{:});

Error in ==> DPARSF at 33
  gui_mainfcn(gui_State, varargin{:});
 
??? Error while evaluating uicontrol Callback

any help would be highly appreciated!
many thanks,
bhisma

Hi!
I can not repeat the error you encounted with SPM8 (with updates 3408).
Could you update your SPM8 first?
Best wishes!