ANTs
ANTs copied to clipboard
can't read initial transform ANTs0GenericAffine.mat
Hi,
I am trying to run antsApplyTransforms to apply the transformation parameters from a structural-to-template warping to functional data (bucket data set from afni, which contains several sub-bricks with each sub-brick giving beta weights or t-values for a specific regressor of interest). structural and functional data have been of course previously coregisterd to each other. I used the following code: antsApplyTransforms -d 4 -v 1 -r Zach_Template.nii -i stats.s201_REML.nii -o stats_warped_ -t ANTs1Warp.nii.gz -t ANTs0GenericAffine.mat
I get the following message:
Using double precision for computations. Input scalar image: stats.s201_REML.nii Reference image: Zach_Template.nii Can't read initial transform ANTs0GenericAffine.mat
I found that somebody posted a similar problem on source forge:https://sourceforge.net/p/advants/discussion/840261/thread/c0485b2c/?limit=25
I still don t understand what causes the problem and how I can fix it?
Thank you in advance Carolin
Hi @carolin31 , Can you post the data so I can check it on my machine?
Hi Nick,
thank you very much for the quick response. The data is on Zion. Here is the link:
/tmp/yassamri/R21/caro/201/ANTs
Let me know, if you should not be able to access them.
Thanks again!
Caro
On Wed, Jul 25, 2018 at 3:15 PM, Nick Tustison [email protected] wrote:
Hi @carolin31 https://github.com/carolin31 , Can you post the data so I can check it on my machine?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ANTsX/ANTs/issues/614#issuecomment-407913971, or mute the thread https://github.com/notifications/unsubscribe-auth/AnxlwzbAcy4_5YNkA6ymrORdWcfCh1Dbks5uKO3kgaJpZM4Vg2j1 .
I don't know what the problem is. You have a couple things incorrect on your command line but they don't have anything to do with the error your getting. However, fix them with the command below and tell me what you get.
$ antsApplyTransforms -d 3 -v 1 -r Zach_Template.nii -i stats.s201_REML.nii -o stats_warped.nii.gz -t ANTs1Warp.nii.gz -t ANTs0GenericAffine.mat
Hi,
when I run your corrected comment, ANTs finishes the computation and I do get a warped output image. But when I look at the image its just black.
I used the -d 4 option because the stats.s201_REML.nii image contains several images. One image includes beta weights for regressor 1, the next image includes the t values for regressor 1, the next image contains the beta weights for regressor 2, the next contains the t values for regressor 2 and so on. So its not a time series, but the nii file 'stats.s201_REML.nii' contains several images.
Hi @carolin31 ,
ITK nifti I/O reads the stats.s201_REML.nii image as a 3-D image with each voxel having 30+ components. Note how this is different from a 4-D image where the fourth dimension is used to store the 30+ components. The latter could be handled via the time-series option in antsApplyTransforms
. Can you extract each of these components to separate scalar 3-D volumes?
Nick
Hi Nick, so are you saying that I can not use antsApplyTransforms on this kind of dataset? And that I have to find a way to first transform the stats file into individual images?
A related question that I would have then, what is the difference between the -d4 option and using -e3? I tried to run the -d 4 option on a time series and it didn't t work either. I get the same error message: Can 't read initial transform ANTs0GenericAffine.mat. But the -e3 option worked on the time series (but not on my stats dataset). Could you give an example for what kind of dataset the -d4 option can be used?
Thanks a lot! Caro
so are you saying that I can not use antsApplyTransforms on this kind of dataset? And that I have to find a way to first transform the stats file into individual images?
Yes, as antsApplyTransforms
is currently written. A voxel in a time-series 4-D image is a scalar image indexed according to the format voxel[i, j, k, t]
where i
, j
, and k
are the spatial indices and t
is the time index. The image that you have is a 3-D image indexed according to [i, j, k]. Each voxel, in your case, is not a scalar voxel but a voxel array which has 30+ elements. That's why your image doesn't work.
@stnava --- should we add an option to antsApplyTransforms
to accommodate this format?
in itk, this is ( i think ) a vector image. in antsr, we call it multichannel. i recall in v4 that we developed interpolators for this type so it would probably be a matter of typedefs and UI work to add. i think it's already in antsr - certainly via splitMultiChannel
and mergeMultiChannel
functions if not via direct call to some transformation function. @cookpa or @jeffduda may know something more.
brian
Okay, I'll put it on my to-do list. Shouldn't be too hard.
This would be great. I believe that afni is an often used software in fMRI analysis and having to transform the functional images into a common template space is a standard processing step when one wants to do group analysis. We like using ANTs for the normalization because it does a better job than afni, and I just learned that we also had to generate a script, which separates the afni stats data set into individual images and puts it later together again. Unfortunately this script is outdated and does not include the newer antsApplyTransform function.
Will the older Ants function 'WarpImageMultiTransform' lead to a worse result than when I use antsApplyTransforms?
Okay, so I have a bit more information. The quicklook nifti plugin shows that this AFNI image is a 3-D image with N
components. I thought it was a multichannel image as I described above. Apparently I was wrong. It's actually a 5-D image where the fifth dimension contains the components. The fourth dimension has a size of 1. I went through the trouble of modifying antsApplyTransforms
to work with multichannel images so I think I'm going to push the changes in case anybody runs into this issue. So @stnava , I guess the question is do we want to make an afni-specific option to accommodate these images? It would be pretty easy but just want to run it by folks before I make those changes.
@carolin31 WarpImageMultiTransform
still works so if you have old scripts that use it, you certainly can. It just doesn't offer the flexibility for some of the new capabilities we have in the toolkit.
https://github.com/ANTsX/ANTs/commit/3735311732d3b8f8bcb8c95fe386aac3b657c7e2
@stnava Another option would be to open up dimension = 5
in ExtractSliceFromImage
and then create an inverse operation somewhere.
My feeling is that it’s annoying to deal with this Nonintuitive data representation but perhaps afni is worth accommodating.
Let’s think for another day.
On Tuesday, July 31, 2018, Nick Tustison [email protected] wrote:
@stnava https://github.com/stnava Another option would be to open up dimension = 5 in ExtractSliceFromImage and then create an inverse operation somewhere.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ANTsX/ANTs/issues/614#issuecomment-409401673, or mute the thread https://github.com/notifications/unsubscribe-auth/AATyfvUmfR9yKn2GYJPCWGCxwC5KUcDIks5uMOn8gaJpZM4Vg2j1 .
--
brian
Sounds good.
Is it necessary to handle the 5D convention explicitly? I think the ITK NIFTI reader can read it into an ITK vector image.
In NIFTI the 4th dimension is reserved for time. So a multi-component image that does not represent a time series is (NIFTI_INTENT_VECTOR) is 5D with dimensions X,Y,Z,1,N for N components. By NIFTI_INTENT_VECTOR they mean an array of scalar values, not necessarily a vector with any physical interpretation like a warp field.
Color and complex images have a non-scalar pixel type, but not a 5th dimension. So an RGB image from DTI is 3D but has datatype code DT_RGB = 128 in the NIFTI header. This is stored as an array of 24-bit pixels, rather than as three volumes of R, G, B. But I think ITK handles this - at least it reads into SNAP no problem.
I believe this issue was fixed by https://github.com/ANTsX/ANTs/commit/3735311732d3b8f8bcb8c95fe386aac3b657c7e2
https://github.com/ANTsX/ANTs/pull/1191