I ended up trying a bit of a hack, and it seems to have worked, but I
don't know if I can trust it. I used the AnalyzeFMRI package in R to
output my data in an Analyze file. I had to change the voxel size and
origin in the header manually. And then I copied a .mat file from
another 3D Analyze file produced by FreeSurfer with the same
dimensions as my output and named it the same as my new Analyze file.
I don't really know how the .mat file works, so as I said, I don't
know if I can trust it. The .mat file is from a the same data that
I'm analyze in R, so it should have the same orientation. Perhaps one
of the FreeSurfer gurus can tell me if this is a really stupid thing
to do or not.
Regards,
-Alessandro
On 4/4/07, freesurfer-request(a)nmr.mgh.harvard.edu
<freesurfer-request(a)nmr.mgh.harvard.edu> wrote:
> Date: Wed, 04 Apr 2007 09:10:45 +0200
> From: Glenn Lawyer <d.g.lawyer(a)medisin.uio.no>
> Subject: [Freesurfer] Freesurfer and R
> To: freesurfer(a)nmr.mgh.harvard.edu
> Message-ID: <46134F75.2070803(a)medisin.uio.no>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi,
>
> I'm also using R to look at some FreeSurfer data, mostly to play with
> significance values. To do this, I convert them to ascii (mris_convert)
> and load them into R with the read.table function. When I am done, I
> write a new ascii file, mris_convert it back to a *.w or *.sig, and load
> it into tksurfer. The function to write the file is trivial, but here it
> is for completeness:
>
> ## more FreeSurfer specific stuff.
> ## the modified significance values in a text file called "fdr.txt"
> ## posindex is a global variable tracking which pvalues were
> ## positive in the original sig file
> ## (recall that FS stores sig values as log10(sig), with the
> ## sign indicating direction of effect)
> ## vindex is a global variable tracking the vertex number
> ## associated with a given sig value
> write.fs.output <- function(){
> fdr <- dget('fdr.txt')
> fdr <- log10(fdr)
> fdr[posindex] <- fdr[posindex] * -1
> cat("0.000\n", length(fdr), "\n", file="AA-TT_cmfdr.ascii")
> for (i in 1:length(fdr)){
> cat(vindex[i], fdr[i], "\n", sep="\t",
> file="AA-TT_fdr.ascii", append=TRUE)
> }
> }
>