Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "Index exceeds matrix dimensions" in demo_connectome_encoding #88

Closed
karanaggarwal1994 opened this issue Nov 27, 2017 · 6 comments

Comments

@karanaggarwal1994
Copy link

karanaggarwal1994 commented Nov 27, 2017

[feConnectomeInit] fe-structure Memory Storage:1.05 Gb
The size of the sparse tensor Phi is (Na,Nv,Nf) = (129241,190589,500000)
The size of the dictionary D is (Ntheta,Na) = (96,129241)
Index exceeds matrix dimensions.

Error in demo_connectome_encoding (line 163)
fascicles_indices = unique(inds(:,3));

Got error while running the demo_connectome_encoding.m

++ WARNING: nifti_read_buffer(/home/karan/life/Demo_Data_for_Multidimensional_Encoding_of_Brain_Connectomes/STN/sub-FP/dwi/run01_fliprot_aligned_trilin.nii.gz):
data bytes needed = 323042844
data bytes input = 0
number missing = 323042844 (set to 0)
++ WARNING: nifti_read_buffer(/home/karan/life/Demo_Data_for_Multidimensional_Encoding_of_Brain_Connectomes/STN/sub-FP/dwi/run01_fliprot_aligned_trilin.nii.gz):
data bytes needed = 323042844
data bytes input = 0
number missing = 323042844 (set to 0)
++ WARNING: nifti_read_buffer(/home/karan/life/Demo_Data_for_Multidimensional_Encoding_of_Brain_Connectomes/STN/sub-FP/dwi/run01_fliprot_aligned_trilin.nii.gz):
data bytes needed = 323042844
data bytes input = 0
number missing = 323042844 (set to 0)
++ WARNING: nifti_read_buffer(/home/karan/life/Demo_Data_for_Multidimensional_Encoding_of_Brain_Connectomes/STN/sub-FP/dwi/run01_fliprot_aligned_trilin.nii.gz):
data bytes needed = 323042844
data bytes input = 0
number missing = 323042844 (set to 0)
++ WARNING: nifti_read_buffer(/home/karan/life/Demo_Data_for_Multidimensional_Encoding_of_Brain_Connectomes/STN/sub-FP/dwi/run01_fliprot_aligned_trilin.nii.gz):
data bytes needed = 323042844
data bytes input = 0
number missing = 323042844 (set to 0)
++ WARNING: nifti_read_buffer(/home/karan/life/Demo_Data_for_Multidimensional_Encoding_of_Brain_Connectomes/STN/sub-FP/dwi/run01_fliprot_aligned_trilin.nii.gz):
data bytes needed = 323042844
data bytes input = 0
number missing = 323042844 (set to 0)

And warning in the command prompt.

@karanaggarwal1994 karanaggarwal1994 changed the title Error in demo_connectome_encoding Error "Index exceeds matrix dimensions" in demo_connectome_encoding Nov 27, 2017
@ccaiafa
Copy link
Collaborator

ccaiafa commented Nov 27, 2017

Dear @karanaggarwal1994,
Thank you for your message. Unfortunately, I can not replicate the error you got. I just tested and it worked OK on our Linux server.
It seems like the array Phi_subtensor is empty for you.
Could you please set a breakpoint at line 163 and type the following commands in Matlab?
You should obtain the results displayed below:
K>> size(Phi_subtensor)
ans =
7201 93 500000

K>> inds
inds =
67 81 106803
630 57 311373
As you can see the array Phi_subtensor should have dimensions (7201x93x500000) with only two non-zero entries at positions (67,81,106803) and (630,57,311373).

Also, it would be useful to know which version of Matlab you are using and OS (Windows, Linux, MacOS).

Thank you for your feedback
Cesar

@karanaggarwal1994
Copy link
Author

Thanks for your quick response
Output:

K>> size(Phi_subtensor)

ans =

    7201          93      500000

K>> inds

inds =

 []

K>>

Matlab Version: 2017b
OS: CentOS7 (Linux)

@ccaiafa
Copy link
Collaborator

ccaiafa commented Nov 28, 2017

Hi @karanaggarwal1994
Yes, your array Phi_subtensor is empty. That's why you can not find its elements.
I wonder if you have successfully loaded the demo datasets. I noticed that you got WARNING messages using a function called nifti_read_buffer. ENCODE should use the function niftiRead instead, which is provided by VISTASOFT.
I recommend you to check that you already downloaded VISTASOFT and MBA toolbox and included them in the Matlab path so ENCODE will be able to find the proper functions.
Let me know how it goes.
Cesar

@karanaggarwal1994
Copy link
Author

I have downloaded and included Vistasoft and MBA toolbox in MATLAB path.
The warning comes after executing the line 43 in ~/vistasoft/fileFitlers/nifti/niftiRead.m
Output at line 42 for ni :
K>> ni

ni =

struct with fields:

          data: [107×141×101×106 int16]
         fname: '/home/karan/life/Demo_Data_for_Multidimensional_Encoding_of_Brain_Connectomes/STN/sub-FP/dwi/run01_fliprot_aligned_trilin.nii.gz'
          ndim: 4
           dim: [107 141 101 106]
        pixdim: [1.5000 1.5000 1.5000 11]
     scl_slope: 1
     scl_inter: 0
       cal_min: 0
       cal_max: 24247
    qform_code: 2
    sform_code: 2
      freq_dim: 0
     phase_dim: 0
     slice_dim: 0
    slice_code: 0
   slice_start: 0
     slice_end: 0
slice_duration: 0
     quatern_b: 0
     quatern_c: 0
     quatern_d: 0
     qoffset_x: -81.5000
     qoffset_y: -121.5000
     qoffset_z: -61.5000
          qfac: 1
       qto_xyz: [4×4 double]
       qto_ijk: [4×4 double]
       sto_xyz: [4×4 double]
       sto_ijk: [4×4 double]
       toffset: 0
     xyz_units: 'mm'
    time_units: 'sec'
    nifti_type: 1
   intent_code: 0
     intent_p1: 0
     intent_p2: 0
     intent_p3: 0
   intent_name: ''
       descrip: 'Raw Eddy Corrected'
      aux_file: ''
       num_ext: 0

Warning

++ WARNING: nifti_read_buffer(/home/karan/life/Demo_Data_for_Multidimensional_Encoding_of_Brain_Connectomes/STN/sub-FP/dwi/run01_fliprot_aligned_trilin.nii.gz):
data bytes needed = 323042844
data bytes input = 0
number missing = 323042844 (set to 0)

Also, in the same file you have mentioned comments

% If volumesToLoad is not included in the arguments, all the data
% are returned. If volumesToLoad is empty ([]) returns only the header
    % fileName is a string and the file exists.
    % For some reason, the volumeToLoad is not yet implemented.
    % We should just implement it here, by reading the whole
    % thing and only returning the relevant volumes.  I think
    % that is represented by the 4th dimension, but I should ask
    % someone who knows.

@karanaggarwal1994
Copy link
Author

It is working now.

The problem was dataset was corrupt, and the warning came because of the same reason.
I downloaded all the files again, then it worked fine.

Thanks @ccaiafa
I am closing the issue.

@ccaiafa
Copy link
Collaborator

ccaiafa commented Nov 29, 2017

Great!
Best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants