Another note, I just did a little experimenting, and it appears that using a RAS oriented image for the initial recon-all run (I've been using all LAS images) will fix the left-right flipping that occurs with mri_surf2surf.

However the mesh is still oriented incorrectly, such that a-p is facing superior-inferiror. 

-zack

On Mon, Sep 29, 2014 at 1:07 PM, Zachary Greenberg <zacharyigreenberg@gmail.com> wrote:
Hi Doug,

Thanks for your continued help with this.

I use freeview -v rawavg.mgz -f lh.pial.native

The problem I was mentioning in my first message though, is that the native pial surface mesh output from mri_surf2surf is only oriented correctly in freeview, but not in any other mesh viewer (such as Matlab, Blender, Unity, Pyqt, etc...). 

For example, if I convert the lh.pial.native mesh to ascii with mris_convert lh.pial.native lh.pial.native.asc, I can then use all the tri and vert coordinates from that ascii file to plot the mesh in matlab (or some other viewer by converting the  .asc to .obj).

Viewing the Mesh in any of those third party methods will reveal that the mesh is flipped (left is right, so loading the left hem coords reveals the right hem) and oriented such that the respective poles of the brain (frontal and occipital) are pointing superior and inferior as apposed to a-p.

This is where I'm stumped. Does freeview do something to remap the left-right flip and orient the mesh correctly? 

Thanks again.

-zack

On Wed, Sep 24, 2014 at 8:48 AM, Douglas N Greve <greve@nmr.mgh.harvard.edu> wrote:

When I run your commands, the pial is correctly oriented and placed.
What is your freeview command? This is what I use

freeview -v rawavg.mgz --surface ../surf/lh.pial.native:edgecolor=yellow

On 09/23/2014 06:11 PM, Zachary Greenberg wrote:
> Hi Doug,
>
> Thanks for getting back to me and sorry for the delay. Yes I can
> actually. If I corregister the CT to orig.nii and then pick out the
> points in freeview they look pretty good. This is a pretty painful
> process though. Is there an easy way to save a set of points in a text
> file from freeview?
>
> Ideally, I would like to be able to do this with the native pial
> surface as well, but I still have the problem of it appearing rotated
> and flipped in freeview. Is there a way to fix this?
>
> Thanks again for your help,
>
> Best,
> -Zack
>
> On Thu, Sep 18, 2014 at 12:50 PM, Douglas N Greve
> <greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu>> wrote:
>
>
>     Can you get it to display correctly on the pial surface in
>     conformed space?
>
>     On 09/17/2014 08:04 PM, Zachary Greenberg wrote:
>     > Hello Freesurfer experts,
>     >
>     > I am having a tough time getting my pial surfaces into the correct
>     > anatomical space. I work with ECoG Patients, so we have pre-implant
>     > high resolution T1s (GE SPGR), and post-implant high resolution CTs
>     > that show the location of ECoG electrodes within the patient's
>     skull.
>     > Our goal: display ECoG electrodes in their correct positions on the
>     > patient's native pial surface.
>     >
>     > Right now, my pipeline works like this:
>     > -ACPC align the T1, leave it in LAS orientation.
>     > -recon-all the acpc T1, using -3T -all -openmp 8 -use-gpu
>     > -corregister the CT to the acpc T1 (SPM), get electrode coords
>     in T1 space
>     > -plot the electrodes on the resultant .pial surface from freesurfer
>     >
>     > The problem is, I can definitely tell that the position of the pial
>     > mesh is off (probably by 10 millimeters or so), as the electrodes
>     > (which have the correct coordinates from the T1 correg, confirmed
>     > visually by overlaying the CT on T1) are not in their correct
>     > positions on the mesh. Likewise, DTI fibers reconstructed from EPIs
>     > correctly corregistered to the T1 also appear off position
>     within the
>     > .pial mesh.
>     >
>     > Here is what I have tried:
>     >
>     > compute the transform from .pial to .pial.native as suggested on
>     > https://surfer.nmr.mgh.harvard.edu/fswiki/FsAnat-to-NativeAnat
>     >
>     > tkregister2 --mov rawavg.mgz --targ orig.mgz --reg
>     register.native.dat --noedit --regheader
>     > mri_surf2surf --sval-xyz pial --reg register.native.dat
>     rawavg.mgz --tval lh.pial.native --tval-xyz --hemi lh --s subjectname
>     > This results in a mesh that is flipped (left is right) and rotated
>     > such that anterior is inferior (frontal cortex is pointing
>     downward).
>     > The mesh appears this way when plotted in any viewer besides
>     > freesurfer (MATLAB mesh, Pyqt) but appears in the correct
>     orientation
>     > in freeview. Replacing orig.mgz with the original T1.nii in the
>     > command above produces the opposite effect, freeview plots the
>     > orientation wrong, and any other viewer plots the Mesh oriented
>     > correctly, and the mesh appears to be identical to the originally
>     > output .pial mesh (electrodes are still wrong).
>     >
>     > Any help in pin pointing what is going wrong here would be greatly
>     > appreciated. I have a feeling it has something to do with the mesh
>     > being in surface RAS and the original T1 being in LAS.
>     >
>     > Thanks a bunch,
>     > -Zack
>     >
>     >
>     >
>     >
>     >
>     > _______________________________________________
>     > Freesurfer mailing list
>     > Freesurfer@nmr.mgh.harvard.edu
>     <mailto:Freesurfer@nmr.mgh.harvard.edu>
>     > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>
>     --
>     Douglas N. Greve, Ph.D.
>     MGH-NMR Center
>     greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu>
>     Phone Number: 617-724-2358 <tel:617-724-2358>
>     Fax: 617-726-7422 <tel:617-726-7422>
>
>     Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
>     <http://surfer.nmr.mgh.harvard.edu/fswiki/BugReporting>
>     FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2
>     www.nmr.mgh.harvard.edu/facility/filedrop/index.html
>     <http://www.nmr.mgh.harvard.edu/facility/filedrop/index.html>
>     Outgoing:
>     ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/
>
>     _______________________________________________
>     Freesurfer mailing list
>     Freesurfer@nmr.mgh.harvard.edu <mailto:Freesurfer@nmr.mgh.harvard.edu>
>     https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>
>
>     The information in this e-mail is intended only for the person to
>     whom it is
>     addressed. If you believe this e-mail was sent to you in error and
>     the e-mail
>     contains patient information, please contact the Partners
>     Compliance HelpLine at
>     http://www.partners.org/complianceline . If the e-mail was sent to
>     you in error
>     but does not contain patient information, please contact the
>     sender and properly
>     dispose of the e-mail.
>
>
>
>
> --
> *Zachary Greenberg*
> /Assistant Imaging Specialist/
> /Department of Neurological Surgery/
> /University of California, San Francisco/