Re: [HCP-Users] Warping volume atlas and X, Y, Z of single point with standard2acpc_dc.nii.gz

2019-01-03 Thread Timothy Coalson
Yes, even if you did that and got it into the 2mm space correctly in FSL
conventions (this is not easy), the absolute warp file will have near-zero
values in one of the corners, even though the voxel that should have values
close to 0 should generally be towards the center of the volume.

Tim


On Thu, Jan 3, 2019 at 6:32 PM Glasser, Matthew  wrote:

> I believe that FSL convertwarp converts between relative and absolute
> conventions, though the FSL coordinates issue might prevent that from being
> helpful.
>
> Matt.
>
> From: Timothy Coalson 
> Date: Thursday, January 3, 2019 at 2:30 PM
> To: Matt Glasser 
> Cc: Georgios Michalareas , "hcp-users@humanconnectome.org"
> 
> Subject: Re: [HCP-Users] Warping volume atlas and X, Y, Z of single point
> with standard2acpc_dc.nii.gz
>
> On Thu, Jan 3, 2019 at 10:47 AM Glasser, Matthew 
> wrote:
>
>> 1) FSL does not respect Workbench’s header info, so the labels get
>> removed.  You might need to use wb_command -volume-resample or copy over
>> the header info.
>>
>
> Yes, use wb_command -volume-warpfield-resample and the enclosing voxel
> method.
>
>
>> 2) FSL has a utility to do this I believe (std2imgcoord), but it will be
>> slow (we used to use this for warping surfaces before we had the
>> wb_command. Not sure about the error message.
>>
>
> The wb_command error message means what it says - the warpfield is a
> volume file, and any coordinates that are outside of its bounding box have
> a completely unknown warp, because there is no voxel in that location to
> tell it what the displacement vector is.
>
> There isn't a direct way to put a coordinate through a warpfield in
> workbench, but since you specifically want to transform a voxel grid
> through it, you can get there with a few tricks.  First, convert the
> "native to standard" warpfield to "world" convention with wb_command
> -convert-warpfield - this convention gives at each voxel, the displacement
> that should be added to the coordinate (in proper nifti mm coordinates,
> rather than FSL's difficult conventions).  You can then resample this to
> the 2mm space with wb_command -volume-affine-resample (use an identity
> affine, and probably trilinear resampling) to get the 2mm voxel grid you
> want.  This is close, but the last step will need to be done manually,
> because the warpfield gives the relative displacement, but you want the
> absolute coordinate.  So, in each voxel, you need to add the coordinates of
> the center of the voxel - there is no command to do this, so do it in
> matlab, or python, or...
>
>
>> Matt.
>>
>> On 1/3/19, 10:31 AM, "hcp-users-boun...@humanconnectome.org on behalf of
>> Georgios Michalareas" > g...@ae.mpg.de> wrote:
>>
>> >Hi and Happy Hew Year,
>> >
>> >
>> >I have 2 questions regarding warping a volume atlas  and X,Y,Z
>> >coordinates of single points with the  standard2acpc_dc.nii.gz warp.
>> >
>> >Excuse me If my questions are too naive. Here they are:
>> >
>> >
>> >Question 1:
>> >
>> >==
>> >
>> >I would like to transform the volume atlas file
>> >
>> >MNINonLinear/ROIs/Atlas_ROIs.2.nii.gz
>> >
>> >from standard space to native space using the warp
>> >
>> >MNINonLinear/xfms/standard2acpc_dc.nii.gz
>> >
>> >I tried using "applywarp"
>> >
>> >'applywarp  --in=Atlas_ROIs.2.nii.gz  --ref=T1_native.nii.gz
>> >--out=WARPED_Atlas_Native.nii.gz
>>
>> >--warp=/mnt/beegfs/home/georgios.michalareas/workspace/projects/matthprob_
>> >MEG/data/smri/raw_nifti/BRS27/MNINonLinear/xfms/standard2acpc_dc.nii.gz
>> >--interp=spline'
>> >
>> >but in the resulting nifti there is no atlas label information .
>> >
>> >
>> >Question 2:
>> >
>> >==
>> >
>> >I would like to take the X,Y,Z coordinates of any voxel J in the 2mm
>> >template volume
>> >
>> >HCPpipelines-3.27.0/global/templates/MNI152_T1_2mm.nii.gz
>> >
>> >apply the standard2acpc_dc.nii.gz  warping to them and get the new X,Y,Z
>> >coordinates of J in the native space.
>> >
>> >The reason I want to do this is to make a regular reference 2 mm grid
>> >from the corrdinates of the voxels of the 2mm template volume and warp
>> >each of the grid vertices to native space.
>> >
>> >I made a surf.gii file containing a pseudo-surface which had as vertices
>> >the coordinates of all voxels of the 2mm template MNI152_T1_2mm.nii.gz ,
>> >and a dummy single face:
>> >
>> >g=
>> >faces: [1 2 3]
>> >  mat: [4×4 double]
>> > vertices: [902629×3 single]
>> >
>> >I then applied
>> >
>> >wb_command -surface-apply-warpfield  mrigrid.surf.gii
>> >Tfm_native2standard.nii.gz  WARPED2NATIVE_mrigrid.surf.gii -fnirt
>> >Tfm_standard2native.nii.gz
>> >
>> >but I got the following error
>> >
>> >While running:
>>
>> >/mnt/beegfs/home/georgios.michalareas/workspace/toolboxes/other/workbench-
>> >v1.3.2/workbench/bin_rh_linux64/../exe_rh_linux64/wb_command
>> >-surface-apply-warpfield mrigrid.surf.gii 

Re: [HCP-Users] Warping volume atlas and X, Y, Z of single point with standard2acpc_dc.nii.gz

2019-01-03 Thread Glasser, Matthew
I believe that FSL convertwarp converts between relative and absolute 
conventions, though the FSL coordinates issue might prevent that from being 
helpful.

Matt.

From: Timothy Coalson mailto:tsc...@mst.edu>>
Date: Thursday, January 3, 2019 at 2:30 PM
To: Matt Glasser mailto:glass...@wustl.edu>>
Cc: Georgios Michalareas mailto:g...@ae.mpg.de>>, 
"hcp-users@humanconnectome.org" 
mailto:hcp-users@humanconnectome.org>>
Subject: Re: [HCP-Users] Warping volume atlas and X, Y, Z of single point with 
standard2acpc_dc.nii.gz

On Thu, Jan 3, 2019 at 10:47 AM Glasser, Matthew 
mailto:glass...@wustl.edu>> wrote:
1) FSL does not respect Workbench’s header info, so the labels get
removed.  You might need to use wb_command -volume-resample or copy over
the header info.

Yes, use wb_command -volume-warpfield-resample and the enclosing voxel method.

2) FSL has a utility to do this I believe (std2imgcoord), but it will be
slow (we used to use this for warping surfaces before we had the
wb_command. Not sure about the error message.

The wb_command error message means what it says - the warpfield is a volume 
file, and any coordinates that are outside of its bounding box have a 
completely unknown warp, because there is no voxel in that location to tell it 
what the displacement vector is.

There isn't a direct way to put a coordinate through a warpfield in workbench, 
but since you specifically want to transform a voxel grid through it, you can 
get there with a few tricks.  First, convert the "native to standard" warpfield 
to "world" convention with wb_command -convert-warpfield - this convention 
gives at each voxel, the displacement that should be added to the coordinate 
(in proper nifti mm coordinates, rather than FSL's difficult conventions).  You 
can then resample this to the 2mm space with wb_command -volume-affine-resample 
(use an identity affine, and probably trilinear resampling) to get the 2mm 
voxel grid you want.  This is close, but the last step will need to be done 
manually, because the warpfield gives the relative displacement, but you want 
the absolute coordinate.  So, in each voxel, you need to add the coordinates of 
the center of the voxel - there is no command to do this, so do it in matlab, 
or python, or...

Matt.

On 1/3/19, 10:31 AM, 
"hcp-users-boun...@humanconnectome.org
 on behalf of
Georgios Michalareas" 
mailto:hcp-users-boun...@humanconnectome.org>
 on behalf of
g...@ae.mpg.de> wrote:

>Hi and Happy Hew Year,
>
>
>I have 2 questions regarding warping a volume atlas  and X,Y,Z
>coordinates of single points with the  standard2acpc_dc.nii.gz warp.
>
>Excuse me If my questions are too naive. Here they are:
>
>
>Question 1:
>
>==
>
>I would like to transform the volume atlas file
>
>MNINonLinear/ROIs/Atlas_ROIs.2.nii.gz
>
>from standard space to native space using the warp
>
>MNINonLinear/xfms/standard2acpc_dc.nii.gz
>
>I tried using "applywarp"
>
>'applywarp  --in=Atlas_ROIs.2.nii.gz  --ref=T1_native.nii.gz
>--out=WARPED_Atlas_Native.nii.gz
>--warp=/mnt/beegfs/home/georgios.michalareas/workspace/projects/matthprob_
>MEG/data/smri/raw_nifti/BRS27/MNINonLinear/xfms/standard2acpc_dc.nii.gz
>--interp=spline'
>
>but in the resulting nifti there is no atlas label information .
>
>
>Question 2:
>
>==
>
>I would like to take the X,Y,Z coordinates of any voxel J in the 2mm
>template volume
>
>HCPpipelines-3.27.0/global/templates/MNI152_T1_2mm.nii.gz
>
>apply the standard2acpc_dc.nii.gz  warping to them and get the new X,Y,Z
>coordinates of J in the native space.
>
>The reason I want to do this is to make a regular reference 2 mm grid
>from the corrdinates of the voxels of the 2mm template volume and warp
>each of the grid vertices to native space.
>
>I made a surf.gii file containing a pseudo-surface which had as vertices
>the coordinates of all voxels of the 2mm template MNI152_T1_2mm.nii.gz ,
>and a dummy single face:
>
>g=
>faces: [1 2 3]
>  mat: [4×4 double]
> vertices: [902629×3 single]
>
>I then applied
>
>wb_command -surface-apply-warpfield  mrigrid.surf.gii
>Tfm_native2standard.nii.gz  WARPED2NATIVE_mrigrid.surf.gii -fnirt
>Tfm_standard2native.nii.gz
>
>but I got the following error
>
>While running:
>/mnt/beegfs/home/georgios.michalareas/workspace/toolboxes/other/workbench-
>v1.3.2/workbench/bin_rh_linux64/../exe_rh_linux64/wb_command
>-surface-apply-warpfield mrigrid.surf.gii Tfm_native2standard.nii.gz
>WARPED2NATIVE_mrigrid.surf.gii -fnirt Tfm_standard2native.nii.gz
>
>ERROR: surface exceeds the bounding box of the warpfield
>
>Is there a way to just transform any X,Y,Z of standard space to the
>corresponding X,Y,Z of Native Space.
>
>
>Thank you very much for your help
>
>Best
>
>Giorgos
>
>
>
>
>
>
>
>
>--

Re: [HCP-Users] Warping volume atlas and X, Y, Z of single point with standard2acpc_dc.nii.gz

2019-01-03 Thread Timothy Coalson
On Thu, Jan 3, 2019 at 10:47 AM Glasser, Matthew  wrote:

> 1) FSL does not respect Workbench’s header info, so the labels get
> removed.  You might need to use wb_command -volume-resample or copy over
> the header info.
>

Yes, use wb_command -volume-warpfield-resample and the enclosing voxel
method.


> 2) FSL has a utility to do this I believe (std2imgcoord), but it will be
> slow (we used to use this for warping surfaces before we had the
> wb_command. Not sure about the error message.
>

The wb_command error message means what it says - the warpfield is a volume
file, and any coordinates that are outside of its bounding box have a
completely unknown warp, because there is no voxel in that location to tell
it what the displacement vector is.

There isn't a direct way to put a coordinate through a warpfield in
workbench, but since you specifically want to transform a voxel grid
through it, you can get there with a few tricks.  First, convert the
"native to standard" warpfield to "world" convention with wb_command
-convert-warpfield - this convention gives at each voxel, the displacement
that should be added to the coordinate (in proper nifti mm coordinates,
rather than FSL's difficult conventions).  You can then resample this to
the 2mm space with wb_command -volume-affine-resample (use an identity
affine, and probably trilinear resampling) to get the 2mm voxel grid you
want.  This is close, but the last step will need to be done manually,
because the warpfield gives the relative displacement, but you want the
absolute coordinate.  So, in each voxel, you need to add the coordinates of
the center of the voxel - there is no command to do this, so do it in
matlab, or python, or...


> Matt.
>
> On 1/3/19, 10:31 AM, "hcp-users-boun...@humanconnectome.org on behalf of
> Georgios Michalareas"  g...@ae.mpg.de> wrote:
>
> >Hi and Happy Hew Year,
> >
> >
> >I have 2 questions regarding warping a volume atlas  and X,Y,Z
> >coordinates of single points with the  standard2acpc_dc.nii.gz warp.
> >
> >Excuse me If my questions are too naive. Here they are:
> >
> >
> >Question 1:
> >
> >==
> >
> >I would like to transform the volume atlas file
> >
> >MNINonLinear/ROIs/Atlas_ROIs.2.nii.gz
> >
> >from standard space to native space using the warp
> >
> >MNINonLinear/xfms/standard2acpc_dc.nii.gz
> >
> >I tried using "applywarp"
> >
> >'applywarp  --in=Atlas_ROIs.2.nii.gz  --ref=T1_native.nii.gz
> >--out=WARPED_Atlas_Native.nii.gz
> >--warp=/mnt/beegfs/home/georgios.michalareas/workspace/projects/matthprob_
> >MEG/data/smri/raw_nifti/BRS27/MNINonLinear/xfms/standard2acpc_dc.nii.gz
> >--interp=spline'
> >
> >but in the resulting nifti there is no atlas label information .
> >
> >
> >Question 2:
> >
> >==
> >
> >I would like to take the X,Y,Z coordinates of any voxel J in the 2mm
> >template volume
> >
> >HCPpipelines-3.27.0/global/templates/MNI152_T1_2mm.nii.gz
> >
> >apply the standard2acpc_dc.nii.gz  warping to them and get the new X,Y,Z
> >coordinates of J in the native space.
> >
> >The reason I want to do this is to make a regular reference 2 mm grid
> >from the corrdinates of the voxels of the 2mm template volume and warp
> >each of the grid vertices to native space.
> >
> >I made a surf.gii file containing a pseudo-surface which had as vertices
> >the coordinates of all voxels of the 2mm template MNI152_T1_2mm.nii.gz ,
> >and a dummy single face:
> >
> >g=
> >faces: [1 2 3]
> >  mat: [4×4 double]
> > vertices: [902629×3 single]
> >
> >I then applied
> >
> >wb_command -surface-apply-warpfield  mrigrid.surf.gii
> >Tfm_native2standard.nii.gz  WARPED2NATIVE_mrigrid.surf.gii -fnirt
> >Tfm_standard2native.nii.gz
> >
> >but I got the following error
> >
> >While running:
> >/mnt/beegfs/home/georgios.michalareas/workspace/toolboxes/other/workbench-
> >v1.3.2/workbench/bin_rh_linux64/../exe_rh_linux64/wb_command
> >-surface-apply-warpfield mrigrid.surf.gii Tfm_native2standard.nii.gz
> >WARPED2NATIVE_mrigrid.surf.gii -fnirt Tfm_standard2native.nii.gz
> >
> >ERROR: surface exceeds the bounding box of the warpfield
> >
> >Is there a way to just transform any X,Y,Z of standard space to the
> >corresponding X,Y,Z of Native Space.
> >
> >
> >Thank you very much for your help
> >
> >Best
> >
> >Giorgos
> >
> >
> >
> >
> >
> >
> >
> >
> >--
> >
> >Dr. Georgios Michalareas
> >Neuroscience Department
> >Max Planck Institute for Empirical Aesthetics
> >
> >email: g...@aesthetics.mpg.de
> >phone: +49 69 8300479-325
> >
> >
> >___
> >HCP-Users mailing list
> >HCP-Users@humanconnectome.org
> >http://lists.humanconnectome.org/mailman/listinfo/hcp-users
>
>
> 
> The materials in this message are private and may 

Re: [HCP-Users] Warping volume atlas and X, Y, Z of single point with standard2acpc_dc.nii.gz

2019-01-03 Thread Glasser, Matthew
1) FSL does not respect Workbench’s header info, so the labels get
removed.  You might need to use wb_command -volume-resample or copy over
the header info.

2) FSL has a utility to do this I believe (std2imgcoord), but it will be
slow (we used to use this for warping surfaces before we had the
wb_command. Not sure about the error message.

Matt.

On 1/3/19, 10:31 AM, "hcp-users-boun...@humanconnectome.org on behalf of
Georgios Michalareas"  wrote:

>Hi and Happy Hew Year,
>
>
>I have 2 questions regarding warping a volume atlas  and X,Y,Z
>coordinates of single points with the  standard2acpc_dc.nii.gz warp.
>
>Excuse me If my questions are too naive. Here they are:
>
>
>Question 1:
>
>==
>
>I would like to transform the volume atlas file
>
>MNINonLinear/ROIs/Atlas_ROIs.2.nii.gz
>
>from standard space to native space using the warp
>
>MNINonLinear/xfms/standard2acpc_dc.nii.gz
>
>I tried using "applywarp"
>
>'applywarp  --in=Atlas_ROIs.2.nii.gz  --ref=T1_native.nii.gz
>--out=WARPED_Atlas_Native.nii.gz
>--warp=/mnt/beegfs/home/georgios.michalareas/workspace/projects/matthprob_
>MEG/data/smri/raw_nifti/BRS27/MNINonLinear/xfms/standard2acpc_dc.nii.gz
>--interp=spline'
>
>but in the resulting nifti there is no atlas label information .
>
>
>Question 2:
>
>==
>
>I would like to take the X,Y,Z coordinates of any voxel J in the 2mm
>template volume
>
>HCPpipelines-3.27.0/global/templates/MNI152_T1_2mm.nii.gz
>
>apply the standard2acpc_dc.nii.gz  warping to them and get the new X,Y,Z
>coordinates of J in the native space.
>
>The reason I want to do this is to make a regular reference 2 mm grid
>from the corrdinates of the voxels of the 2mm template volume and warp
>each of the grid vertices to native space.
>
>I made a surf.gii file containing a pseudo-surface which had as vertices
>the coordinates of all voxels of the 2mm template MNI152_T1_2mm.nii.gz ,
>and a dummy single face:
>
>g=
>faces: [1 2 3]
>  mat: [4×4 double]
> vertices: [902629×3 single]
>
>I then applied
>
>wb_command -surface-apply-warpfield  mrigrid.surf.gii
>Tfm_native2standard.nii.gz  WARPED2NATIVE_mrigrid.surf.gii -fnirt
>Tfm_standard2native.nii.gz
>
>but I got the following error
>
>While running:
>/mnt/beegfs/home/georgios.michalareas/workspace/toolboxes/other/workbench-
>v1.3.2/workbench/bin_rh_linux64/../exe_rh_linux64/wb_command
>-surface-apply-warpfield mrigrid.surf.gii Tfm_native2standard.nii.gz
>WARPED2NATIVE_mrigrid.surf.gii -fnirt Tfm_standard2native.nii.gz
>
>ERROR: surface exceeds the bounding box of the warpfield
>
>Is there a way to just transform any X,Y,Z of standard space to the
>corresponding X,Y,Z of Native Space.
>
>
>Thank you very much for your help
>
>Best
>
>Giorgos
>
>
>
>
>
>
>
>
>--
>
>Dr. Georgios Michalareas
>Neuroscience Department
>Max Planck Institute for Empirical Aesthetics
>
>email: g...@aesthetics.mpg.de
>phone: +49 69 8300479-325
>
>
>___
>HCP-Users mailing list
>HCP-Users@humanconnectome.org
>http://lists.humanconnectome.org/mailman/listinfo/hcp-users



The materials in this message are private and may contain Protected Healthcare 
Information or other information of a sensitive nature. If you are not the 
intended recipient, be advised that any unauthorized use, disclosure, copying 
or the taking of any action in reliance on the contents of this information is 
strictly prohibited. If you have received this email in error, please 
immediately notify the sender via telephone or return mail.

___
HCP-Users mailing list
HCP-Users@humanconnectome.org
http://lists.humanconnectome.org/mailman/listinfo/hcp-users


[HCP-Users] Warping volume atlas and X, Y, Z of single point with standard2acpc_dc.nii.gz

2019-01-03 Thread Georgios Michalareas
Hi and Happy Hew Year,


I have 2 questions regarding warping a volume atlas  and X,Y,Z 
coordinates of single points with the  standard2acpc_dc.nii.gz warp.

Excuse me If my questions are too naive. Here they are:


Question 1:

==

I would like to transform the volume atlas file

MNINonLinear/ROIs/Atlas_ROIs.2.nii.gz

from standard space to native space using the warp

MNINonLinear/xfms/standard2acpc_dc.nii.gz

I tried using "applywarp"

'applywarp  --in=Atlas_ROIs.2.nii.gz  --ref=T1_native.nii.gz 
--out=WARPED_Atlas_Native.nii.gz 
--warp=/mnt/beegfs/home/georgios.michalareas/workspace/projects/matthprob_MEG/data/smri/raw_nifti/BRS27/MNINonLinear/xfms/standard2acpc_dc.nii.gz
 
--interp=spline'

but in the resulting nifti there is no atlas label information .


Question 2:

==

I would like to take the X,Y,Z coordinates of any voxel J in the 2mm 
template volume

HCPpipelines-3.27.0/global/templates/MNI152_T1_2mm.nii.gz

apply the standard2acpc_dc.nii.gz  warping to them and get the new X,Y,Z 
coordinates of J in the native space.

The reason I want to do this is to make a regular reference 2 mm grid 
from the corrdinates of the voxels of the 2mm template volume and warp 
each of the grid vertices to native space.

I made a surf.gii file containing a pseudo-surface which had as vertices 
the coordinates of all voxels of the 2mm template MNI152_T1_2mm.nii.gz , 
and a dummy single face:

g=
    faces: [1 2 3]
  mat: [4×4 double]
     vertices: [902629×3 single]

I then applied

wb_command -surface-apply-warpfield  mrigrid.surf.gii 
Tfm_native2standard.nii.gz  WARPED2NATIVE_mrigrid.surf.gii -fnirt  
Tfm_standard2native.nii.gz

but I got the following error

While running:
/mnt/beegfs/home/georgios.michalareas/workspace/toolboxes/other/workbench-v1.3.2/workbench/bin_rh_linux64/../exe_rh_linux64/wb_command
 
-surface-apply-warpfield mrigrid.surf.gii Tfm_native2standard.nii.gz 
WARPED2NATIVE_mrigrid.surf.gii -fnirt Tfm_standard2native.nii.gz

ERROR: surface exceeds the bounding box of the warpfield

Is there a way to just transform any X,Y,Z of standard space to the 
corresponding X,Y,Z of Native Space.


Thank you very much for your help

Best

Giorgos








-- 

Dr. Georgios Michalareas
Neuroscience Department
Max Planck Institute for Empirical Aesthetics

email: g...@aesthetics.mpg.de
phone: +49 69 8300479-325


___
HCP-Users mailing list
HCP-Users@humanconnectome.org
http://lists.humanconnectome.org/mailman/listinfo/hcp-users