Back to PLS Help

cannot access image file
cherif
Posted on 09/20/07 15:16:10
Number of posts: 5
cherif posts:

Hi,

I am new to functional connectivity, so forgive the basic problems!
I am trying to use PLS for fMRI data, using the gui.
In the Edit Runs window, I manage to load my 4D NIFTI files, and they are found ok and recognized as having the correct number of scans.
However, when I try to create the datamat, I get
ERROR: Cannot access the image file: fmcsm5_run1.nii

Any ideas?

Thanks in advance,
Cherif

Replies:

Untitled Post

I'm Online
jshen
Posted on 09/20/07 17:28:59
Number of posts: 291
jshen replies:

quote:
Hi,

I am new to functional connectivity, so forgive the basic problems!
I am trying to use PLS for fMRI data, using the gui.
In the Edit Runs window, I manage to load my 4D NIFTI files, and they are found ok and recognized as having the correct number of scans.
However, when I try to create the datamat, I get
ERROR: Cannot access the image file: fmcsm5_run1.nii

Any ideas?

Thanks in advance,
Cherif

Open MRI session window and click "Edit Runs..." buton, please check whether "Data Directory" and "Data Files" are filled correctly.

If this doesn't help, please upload your *session.mat onto your FTP site, and post the Link here. I will be able to see more clearly from your session file.



Untitled Post
cherif
Posted on 09/21/07 16:14:38
Number of posts: 5
cherif replies:

Hi Jimmy,

No luck with the directories. Looks fine to me.
You can download the session file from
web.mit.edu/cherif/www/mody096_fMRIsession.mat

Thanks,
Cherif


Untitled Post

I'm Online
jshen
Posted on 09/21/07 16:33:51
Number of posts: 291
jshen replies:

quote:
Hi,

I am new to functional connectivity, so forgive the basic problems!
I am trying to use PLS for fMRI data, using the gui.
In the Edit Runs window, I manage to load my 4D NIFTI files, and they are found ok and recognized as having the correct number of scans.
However, when I try to create the datamat, I get
ERROR: Cannot access the image file: fmcsm5_run1.nii

Any ideas?

Thanks in advance,
Cherif


looks like you have fmcsm5_run1.nii in run1,
while you have fmcsm5.nii in run2~6.

Is it true? or the file in run1 is also fmcsm5.nii?

If this doesn't help, please upload both:
fmcsm5_run1.nii and
fmcsm5.nii

and I will try to duplicate what you did.



Untitled Post
cherif
Posted on 09/21/07 19:44:54
Number of posts: 5
cherif replies:

All files were originally called the same (fmcsm5.nii), but I simply renamed the first one just in case the problem came from having different filenames. I still got the same error on that first file though, so didn't bother changing the other names to match the run numbers.

I have uploaded the whole data directory to
http://web.mit.edu/cherif/www/mody096.zip
note that the files in each run directory are different, despite being called the same.

cherif


Untitled Post

I'm Online
jshen
Posted on 09/24/07 15:59:05
Number of posts: 291
jshen replies:

quote:
Hi,

I am new to functional connectivity, so forgive the basic problems!
I am trying to use PLS for fMRI data, using the gui.
In the Edit Runs window, I manage to load my 4D NIFTI files, and they are found ok and recognized as having the correct number of scans.
However, when I try to create the datamat, I get
ERROR: Cannot access the image file: fmcsm5_run1.nii

Any ideas?

Thanks in advance,
Cherif

I just tested with your image data, and I realized that this error message also indicated that the image data you provided is not supported by PLSgui program.

PLSgui program requires that the image data to be properly pre-processed: including properly aligned, registered, and smoothed. In addition, PLSgui can only support image file with any of 48 orthogonal orientations starting from Version 4.0509151:

Version 4.0509151  September 15, 2005
    1.    PLSgui is now support NIFTI data format. This includes
        file extension support for both single file (.nii) and
        dual file (.img/.hdr); temporal dimension support (4th
        dimension in the data); and data value scaling support
        (Y = scl_slope * X + scl_inter). It also support some
        of the sform or qform affine transform. This includes
        any scaling (to get voxel_size), any translation (to get
        originator), any flipping, and a few Rotation (only N*90
        degrees, where N must be integer).

If it is slightly off the orthogonal orientation, the program will also accept it starting from Version 4.0511071:

Version 4.0511071  November 7, 2005
    1.    Images whose cardinal planes are slightly off
        Cartesian coordinates will also be loaded. However,
        this approximation is based on the following
        assumption: In affine matrix, any value (absolute)
        below a tenth of the third largest value (absolute)
        can be ignored and replaced with 0. In this case,
        fields 'old_affine' & 'new_affine' will be added
        into hdr.hist. If you can not accept the above
        assumption, simply discard any nii structure with
        fields 'old_affine' & 'new_affine'.

However, I found that your image data is a way skewed:

for affine matrix R = [
    3.1250         0         0
         0    3.0509    1.2986
         0    0.6764    5.8578
],

By default, the program will not ignore elements 0.6764 and 1.2986.

Since SPM5 will convert all different image data into its own interpolated template. So it can display your image correctly like this:



However, PLSgui is based on voxel calculation. If you ignore the elements 0.6764 and 1.2986 above, it will display your image incorrectly like this:



Therefore, my suggestion will be:
  1. Find a 3D interpolate program to process your image data frame by frame. Basically, the affine matrix in your image header should be implemented in the data itself;
  2. If you cannot find any program to process your data, and you can tolerate the difference, then you simply change R( find( abs(R) < min(R_sort(end-2:end))/10 ) )  in line 259 of program xform_nii.m to R( find( abs(R) < min(R_sort(end-2:end))/1.0 ) ). In this case, data will be processed based on the incorrect image above.



Untitled Post
cherif
Posted on 09/25/07 15:31:13
Number of posts: 5
cherif replies:

Thanks for the detailed reply Jimmy!

Well, if I interpolate, I will lose image quality, so that is not ideal.
The second option if I understand well allows PLS to process the data in the orientation I give it. Apart from esthetics, is there a downside? what am I losing? does the processing make assumptions based on knowing the orientation to be orthogonal?

thanks,
cherif


Untitled Post

I'm Online
jshen
Posted on 09/25/07 16:23:34
Number of posts: 291
jshen replies:

quote:
Thanks for the detailed reply Jimmy!

Well, if I interpolate, I will lose image quality, so that is not ideal.
The second option if I understand well allows PLS to process the data in the orientation I give it. Apart from esthetics, is there a downside? what am I losing? does the processing make assumptions based on knowing the orientation to be orthogonal?

thanks,
cherif
If you modified the xform_nii.m and let it display incorrectly without error message, I would say that it can load the data in the orientation that is "roughly" close to the one that is given by the NIfTI data.

Here is the reason that I use "roughly" close to:
  1. When you have an affine matrix that is still workable (although rejected by default according to the criteria I described before), the L-R, A-P, I-S orientations are well adjusted, but the detail position is a little bit distorted. Using your fMRI data for example, the affine matrix is [-3.1250 0 0; 0 -3.0509 -1.2986; 0 -0.6764 5.8578], the program will properly put it into RAS orientation, but you can find that the chin position looks a bit too closer to the neck, etc. etc.
  2. However, if the head is skewed 45 degree, i.e. you have an affine matrix like this: [1 0 0; 0 1 1; 0 1 1], then you can not even tell the orientation at all.
In other words, the program will do its best to rotate, and flip your image data according to the affine matrix inside it, but it can not skew your image data back to the correct position.

Therefore, the downside of this option is that you may have difficulty to locate the brain area precisely, the AC origin is not correct, and you should use voxel units instead of milimeter units.

Actually, the PLS processing is not affected at all. This is because that the PLS will calculate the result based on your data, not its position.

So, why not give it a try, if those are the data you have. Just keeping in mind what I described above about the position distortion when you view your results.

Please let me know if you have further question.



Untitled Post
cherif
Posted on 09/25/07 18:51:38
Number of posts: 5
cherif replies:

Great Jimmy, thanks!

I will play around with this and let you know if I run into any more issues.

Best,
cherif



Login to reply to this topic.

  • Keep in touch

Enter your email above to receive electronic messages from Baycrest, including invitations to programs and events, newsletters, updates and other communications.
You can unsubscribe at any time.
Please refer to our Privacy Policy or contact us for more details.

  • Follow us on social
  • Facebook
  • Instagram
  • Linkedin
  • Pinterest
  • Twitter
  • YouTube

Contact Us:

3560 Bathurst Street
Toronto, Ontario
Canada M6A 2E1
Phone: (416) 785-2500

Baycrest is an academic health sciences centre fully affiliated with the University of Toronto