Hi Mark, thanks for the reply.

The problem is this (hopefully it will clarify), if I use flirt to create a linear registration of the mean of the functional data to the structural I get a matrix that cannot be applied by applywarp or applyxfm to the full functional data but I can do this with flirt. I couldn't work out why feat would do the registration but I couldn't do it by the command line so I ended up going through all the steps and seeing where it fails and it was at the first linear transform. I don't use fieldmaps either, we don't have them for this data :(. The problem seems to be that feat uses flirt to apply the concatenation of linear transforms whereas I was using applywarp and then after that did not work I tried applyxfm4d (I didn't know flirt could do this until I dug through the logs in feat).

Could I clarify, for future reference, if I use field maps with epi_reg do I get a .mat file that is a warp or a .nii.gz file as normal?

My files aren't that big, I got confused by the log in feat as it says it's using hi-res images but it just means T1's so that's where the hi-res bit came from. I am using ~600mb or less files at 64x64x64 as you say. I also use 2mm space. I don't think that should be a problem?

Maybe you could try the matrix above. I don't know why it would be doing this. The matrix doesn't look that contorted and I don't really have problems with any other files.

Thanks,

Tom


On Fri, May 2, 2014 at 9:14 AM, Mark Jenkinson <[log in to unmask]> wrote:
Hi,

When you use bbr with fieldmaps then the transformation is non-linear rather than linear.  I cannot tell from your email if you are using fieldmaps or not, but I will assume you are.  In that case then only flirt and applywarp are capable of applying the correct transformation.  The epi_reg script should write out an appropriate warp for applywarp.  So I'm not sure what you mean by applywarp does not work but flirt alone does.  Applyxfm4D is not intended for non-linear transformations and this should not be used if you have fieldmaps.

The reason it is using all of your memory might be due to the size of your timeseries.  The epi_reg script tries to apply the warp to the whole 4D dataset, and this may be large, depending on your images, as going to MNI space (especially the 1mm or 0.5mm versions) will *really* increase the size of the images.  For instance, if your functional images were 64x64x64x300 then the file size would be about 600MB (as each value is typically stored with 8 bytes).  However, if you resampled to the 1mm MNI space, which is 182x218x182, then the file size would become 16GB!   And given that most programs require two copies of something in memory at some point during their execution, this means that it will probably slow down or crash on a machine with less than 30GB of memory.

The second paragraph above would also apply to the non-fieldmap case, with just linear transformations, as you are still trying to create a very large file.

If you really need to create a high-resolution standard space version of your image then you probably need to use a machine with a lot of memory.  Alternatively, you might think about resampling to a lower-resolution standard space, such as a 3mm or 4mm resolution, which is often what is done for ICA analyses.

I hope this helps.
All the best,
Mark



On 1 May 2014, at 18:01, Thomas Nickson <[log in to unmask]> wrote:

I've noticed that this can be applied with flirt and flirt alone, applywarp and applyxfm4d does not work. Seems to be a bug.



On Thu, May 1, 2014 at 4:46 PM, Thomas Nickson <[log in to unmask]> wrote:
Hi All,

I have been trying to register some functional images to mni space. I have used a number of methods but I have found that if I use standard functional and structural images and put them in epi_reg then at the stage of applying the linear transformation from the non-bbr flirt it eats all of the machines ram and is then killed. It's only this one file but I don't understand why it happens.

If I run it using applyxfm4d instead it doesn't use all of the ram instantly but it's been running for over an hour and is increasingly using all the ram. I suspect it is just a slower version of the same problem.

The mat file doesn't look too strange but maybe someone else has had this problem or knows what I am doing wrong. I have tried feat which seems to use the same method, just running epi_reg but with the added step of generating hi-res structural images, and this seems to work but running epi_reg alone does not. It crashes.

0.9999879953  -0.004211583523  0.002482311973  1.383813017
0.004258561284  0.99980606  -0.01923345401  -6.171911295
-0.00240082707  0.01924379718  0.9998119479  62.65789894
0  0  0  1

Any help appreciated,