Duke-UNC Brain Imaging and Analysis Center
BIAC Forums | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password   Forgot your Password?
 All Forums
 Support Forums
 Analysis Software Support
 readmr error
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

xu
Junior Member

25 Posts

Posted - Sep 16 2008 :  11:15:20 AM  Show Profile  Reply with Quote
Hi all,

I have problem to use readmr, and I got error as following,

--------------------------------*
>> cd U:\Pediatrics\FSE.01\Analysis\freesurfer\FSE0008\mri
>> data1=readmr('T1.bxh')
??? Error using ==> readmr
In an assignment A(:) = B, the number of elements in A and B
must be the same.
--------------------------------*

Could anyone tell me how to solve the problem?

Thanks in advance,

Amy

petty
BIAC Staff

USA
453 Posts

Posted - Sep 16 2008 :  2:45:39 PM  Show Profile  Reply with Quote
this typically means that your bxh header is incorrect.

you'll want to verify that the information in the bxh actually reflects the image.

ie: are dimension, voxel sizes, file names correct?
Go to Top of Page

syam.gadde
BIAC Staff

USA
421 Posts

Posted - Sep 16 2008 :  2:53:24 PM  Show Profile  Reply with Quote
I actually have access to that data, so I tried the same thing, and readmr works for me. Are you using the latest version of the BIAC MATLAB tools? You can find them in \\gall\programs\MATLAB\BIAC . They were last updated March 25, 2008.
Go to Top of Page

xu
Junior Member

25 Posts

Posted - Sep 17 2008 :  12:05:38 PM  Show Profile  Reply with Quote
Thanks Petty and Syam,

Actually, the readmr function works well in my office computer, but it had problem in Dr.Lewis’s home computer with same image files. He installed Matlab 7.1, and latest version of BIAC tools, any suggestion?

Thanks again,

Amy
Go to Top of Page

dvsmith
Advanced Member

USA
218 Posts

Posted - Aug 18 2009 :  6:57:06 PM  Show Profile  Visit dvsmith's Homepage  Reply with Quote
Quick question about readmr:

Does it always fail to load an MR image if the image is composed of all 0s and a single 1? I have mask with a single voxel that readmr fails to load. It throws the following error:

??? Error using ==> readmr
Can't read enough bytes in header for file L_S1_-34_-34_40.nii.gz!

The image loads fine in any other program. And, if increase to the size of the mask within the image, it will eventually load correctly. This problem seems to be limited to very small ROIs (< 10 voxels).

Thanks,
David
Go to Top of Page

syam.gadde
BIAC Staff

USA
421 Posts

Posted - Aug 18 2009 :  7:24:52 PM  Show Profile  Reply with Quote
I'm sure this is a silly bug on my part. I will take a look.
Go to Top of Page

dvsmith
Advanced Member

USA
218 Posts

Posted - Aug 18 2009 :  7:53:01 PM  Show Profile  Visit dvsmith's Homepage  Reply with Quote
Thanks, Syam. I tried it with an older (3.1.4) and the newest version of the tools, and it didn't make a difference. Let me know if I can provide more details...

Cheers,
David
Go to Top of Page

syam.gadde
BIAC Staff

USA
421 Posts

Posted - Aug 19 2009 :  10:08:16 AM  Show Profile  Reply with Quote
readmr saves a copy of the image header in the structure it returns. However, it did not account for compressed images and so for very well compressed images that are smaller than the calculated header size (348 in the case of NIFTI files) it was trying to read too many bytes.

I have put a new copy of the function here:

http://ww.biac.duke.edu/home/gadde/readmr.m

Can you copy it, add to your path and see if it works?
Go to Top of Page

dvsmith
Advanced Member

USA
218 Posts

Posted - Aug 19 2009 :  10:28:28 AM  Show Profile  Visit dvsmith's Homepage  Reply with Quote
can you check the link? even after adding the www instead of the ww, it's still broken.
Go to Top of Page

syam.gadde
BIAC Staff

USA
421 Posts

Posted - Aug 19 2009 :  11:38:44 AM  Show Profile  Reply with Quote
Maybe our web server restricts some files based on extension. I've put a copy on fatt here:

\\fatt\data\BIAC\Programs\User_Scripts\Gadde\readmr.m


Go to Top of Page

dvsmith
Advanced Member

USA
218 Posts

Posted - Aug 19 2009 :  6:13:47 PM  Show Profile  Visit dvsmith's Homepage  Reply with Quote
success -- this version of readmr.m can handle the most extreme version of a mask (i.e., one with a single voxel).

thanks!
Go to Top of Page

syam.gadde
BIAC Staff

USA
421 Posts

Posted - Aug 20 2009 :  07:35:36 AM  Show Profile  Reply with Quote
Great, thanks for testing. This will go into the next release.
Go to Top of Page

dvsmith
Advanced Member

USA
218 Posts

Posted - Jul 21 2011 :  2:15:03 PM  Show Profile  Visit dvsmith's Homepage  Reply with Quote
Hi Syam,

Maybe a potential bug in the readmr version on the cluster...

>> x = readmr('run1.bxh')
x =
data: [4-D double]
info: [1x1 struct]

>> y = readmr('run1.nii.gz')
??? Error using ==> readmr at 2044
Error using ==> autodetectmr at 199
Undefined function or variable 'vers'.

I tried to make sure the java path was loaded, but it still threw the same error:
>> javaaddpath /usr/local/packages/MATLAB/BIAC/java/
>> y = readmr('run1.nii.gz')
??? Error using ==> readmr at 2044
Error using ==> autodetectmr at 199
Undefined function or variable 'vers'.

This does not happen on Mac, so it seems specific to the tools on the cluster.

Thanks!
David

Go to Top of Page

petty
BIAC Staff

USA
453 Posts

Posted - Jul 21 2011 :  2:38:53 PM  Show Profile  Reply with Quote
Ugg ... i thought i found all of those!

Basically, MATLAB removed some arguments from the function fileparts which is spread throughout the BIAC tools. I'll re-sync my local copy.
Go to Top of Page

petty
BIAC Staff

USA
453 Posts

Posted - Jul 21 2011 :  2:39:57 PM  Show Profile  Reply with Quote
OK, try it again ... should work. If you see anything else with the 'vers' error, please let me know.
Go to Top of Page

dvsmith
Advanced Member

USA
218 Posts

Posted - Jul 21 2011 :  3:30:41 PM  Show Profile  Visit dvsmith's Homepage  Reply with Quote
that seems to work. thanks!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
BIAC Forums © 2000-2010 Brain Imaging and Analysis Center Go To Top Of Page
This page was generated in 0.2 seconds. Snitz Forums 2000