Print

Print


Hi everyone,

 Marko Wilke suggested I run a toy example, which I did, and spm_write_vol ran without error.   The difference, it turns out, is similar in spirit to what Donald had suggested might be the issue, and had to do with the file named in fname.  Namely, if I set fname to a full path, I get the error, but if I set fname to the desired filename in the current directory, I get no error.  

What is a little strange is that -- when fname is set to a full path --  the error is triggered *after* the .hdr file is produced in the desired directory; it's only the writing of the .img file that triggers the error.  So, although permissions don't seem to be the problem (since the .hdr file *does* get written), the writing of the .img file is not compatible with full path specification.   Does anyone have an idea of why this might be?

Thanks for everyone's help!

David Romano

On Sat, Dec 8, 2012 at 8:18 PM, David Romano <[log in to unmask]> wrote:
Thanks Christopher and Donald,

I'm including the command history as Christopher had suggested, and that may address some of Donald's suggestions as well.

Here is what I did in more detail:

>> header.fname= 'image.img'
>> header.dt=[16 0]
>> header.dim = double(array_size')
>> header.mat = array_to_mni_matrix
>> header.pinfo = [1/255 0 0]'
>>
>> spm_write_vol(volume,array)

(The value of the pinfo field was taken from the image data I've been working with, which are grey (c1) and white (c2) images, so it make sense that the intensities would be divided by 255 to obtain percentage values.)

As an alternative, I also try to obtain the same result by specifying as little as possible,

>> header.fname= 'image.img'
>> header.dim = double(array_size')
>> header.mat = array_to_mni_matrix
>>
>> header = spm_create_vol(header)
>>
>> spm_write_vol(volume,array)

but I get the identical error messages.

As to Donald's suggestion that permissions may be problem, I can only say that I've never encountered permission issues before; I'm also on a Mac
and I'm not sure how to implement the Mac analogue of the PC suggestion.  I would also be surprised if it were a permission issue since it seems all the relevant files show me as having read/write permission, but I wouldn't rule it out.

Finally, I did something similar that actually worked, but in that case I could simply use the volume information from a existing image since my array had the right dimensions.  In this case I don't have a pre-existing image with the same dimensions, so I have to create the volume information from scratch, and I wonder whether this is where the problem might be.  Another possibility I've been wondering about is whether there is some kind of version clash happening in the background:  I'm using spm8 r4290 with MATLAB R2011b.

Again, any help would be appreciated!  Thanks to Christopher, Donald, and Tibor for your responses so far.

David Romano


On Sat, Dec 8, 2012 at 12:35 PM, MCLAREN, Donald <[log in to unmask]> wrote:
I'd start with these potential issues:
(1) Write permission to volume.fname;
(2) This has to do with the backup process that runs on your PC. Disable
it (from the toolbar tray) before doing SPM analysis.

I'd also make sure that you have all the fields that you need and that
they have reasonable values. Load an existing image from SPM to make
sure you have all the fields and that there values make sense.

Best Regards, Donald McLaren
=================
D.G. McLaren, Ph.D.
Research Fellow, Department of Neurology, Massachusetts General Hospital and
Harvard Medical School
Postdoctoral Research Fellow, GRECC, Bedford VA
Website: http://www.martinos.org/~mclaren
Office: (773) 406-2464
=====================
This e-mail contains CONFIDENTIAL INFORMATION which may contain PROTECTED
HEALTHCARE INFORMATION and may also be LEGALLY PRIVILEGED and which is
intended only for the use of the individual or entity named above. If the
reader of the e-mail is not the intended recipient or the employee or agent
responsible for delivering it to the intended recipient, you are hereby
notified that you are in possession of confidential and privileged
information. Any unauthorized use, disclosure, copying or the taking of any
action in reliance on the contents of this information is strictly
prohibited and may be unlawful. If you have received this e-mail
unintentionally, please immediately notify the sender via telephone at (773)
406-2464 or email.


On Sat, Dec 8, 2012 at 12:16 PM, David Romano <[log in to unmask]> wrote:
> mat2file
> Cant open file.