Giter Site home page Giter Site logo

antsApplyTransforms with c3d-converted affine: itk::ERROR: TxtTransformIOTemplate(0x2912350): Could not create an instance of MatrixOffsetTransformBase_double_3_3 about ants HOT 12 CLOSED

antsx avatar antsx commented on May 29, 2024
antsApplyTransforms with c3d-converted affine: itk::ERROR: TxtTransformIOTemplate(0x2912350): Could not create an instance of MatrixOffsetTransformBase_double_3_3

from ants.

Comments (12)

stnava avatar stnava commented on May 29, 2024

MatrixOffsetTransformBase_double_3_3

is a base class and should not be passed to antsApplyTransforms.

you should pass a "real" transform, i.e. affine, rigid, etc.

though i did note that "MatrixOffsetTransformBase_double_4_4"

is listed ... probably should not be. there are work-arounds:

  1. change the txt file to contain a compatible type e.g. affine or rigid or
    whatever.

  2. use a mat file

  3. register MatrixOffsetTransformBase_double_3_3 yourself

we moved away from txt files b/c they lack precision.

also, no guarantees of correctness when mixing tools.

brian

On Mon, Apr 28, 2014 at 5:27 PM, sgiavasis [email protected] wrote:

Hello,

I am trying to run antsApplyTransforms where one of the transforms is a
c3d-converted affine from FSL FLIRT (.mat -> .txt). When I run the command
I get this error (the final --transform, affine.txt is the one in question):

antsApplyTransforms --default-value 0 --dimensionality 4 --input
/home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/_scan_rest_1_rest/_csf_threshold_0.98/_gm_threshold_0.7/_wm_threshold_0.98/_compcor_ncomponents_5_selector_pc10.linear1.wm0.global0.motion1.quadratic0.gm0.compcor1.csf0/_bandpass_freqs_0.009.0.1/frequency_filter_0/bandpassed_demeaned_filtered.nii.gz
--interpolation Gaussian --output
bandpassed_demeaned_filtered_antswarp.nii.gz --reference-image
/home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/anat_preproc_0/anat_brain_only/mprage_resample_calc.nii.gz
--transform
/home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/anat_mni_ants_register_0/calculate_ants_warp/transform2Warp.nii.gz
--transform
/home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/anat_mni_ants_register_0/calculate_ants_warp/transform1Affine.mat
--transform
/home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/fsl_to_itk_func_mni_4d_0/_scan_rest_1_rest/fsl_reg_2_itk/affine.txt

Using double precision for computations.
Input scalar image:
/home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/_scan_rest_1_rest/_csf_threshold_0.98/_gm_threshold_0.7/_wm_threshold_0.98/_compcor_ncomponents_5_selector_pc10.linear1.wm0.global0.motion1.quadratic0.gm0.compcor1.csf0/_bandpass_freqs_0.009.0.1/frequency_filter_0/bandpassed_demeaned_filtered.nii.gz
Reference image:
/home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/anat_preproc_0/anat_brain_only/mprage_resample_calc.nii.gz
Transform reader for
/home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/fsl_to_itk_func_mni_4d_0/_scan_rest_1_rest/fsl_reg_2_itk/affine.txt
caught an ITK exception:

itk::ExceptionObject (0x2912c10)
Location: "unknown"
File:
/home/likewise-open/CHILDMIND/steven.giavasis/antsbin_NEW/ITKv4/Modules/IO/TransformBase/include/itkTransformIOBase.hxx
Line: 70
Description: itk::ERROR: TxtTransformIOTemplate(0x2912350): Could not
create an instance of MatrixOffsetTransformBase_double_3_3
The usual cause of this error is not registering the transform with
TransformFactory
Currently registered Transforms:
"AffineTransform_double_2_2"
"AffineTransform_double_3_3"
"AffineTransform_double_4_4"
"AffineTransform_double_5_5"
"AffineTransform_double_6_6"
"AffineTransform_double_7_7"
"AffineTransform_double_8_8"
"AffineTransform_double_9_9"
"AffineTransform_float_2_2"
"AffineTransform_float_3_3"
"AffineTransform_float_4_4"
"AffineTransform_float_5_5"
"AffineTransform_float_6_6"
"AffineTransform_float_7_7"
"AffineTransform_float_8_8"
"AffineTransform_float_9_9"
"BSplineDeformableTransform_double_2_2"
"BSplineDeformableTransform_double_3_3"
"BSplineDeformableTransform_float_2_2"
"BSplineDeformableTransform_float_3_3"
"BSplineSmoothingOnUpdateDisplacementFieldTransform_double_2_2"
"BSplineSmoothingOnUpdateDisplacementFieldTransform_double_3_3"
"BSplineSmoothingOnUpdateDisplacementFieldTransform_float_2_2"
"BSplineSmoothingOnUpdateDisplacementFieldTransform_float_3_3"
"BSplineTransform_double_2_2"
"BSplineTransform_double_3_3"
"BSplineTransform_float_2_2"
"BSplineTransform_float_3_3"
"CenteredAffineTransform_double_2_2"
"CenteredAffineTransform_double_3_3"
"CenteredAffineTransform_float_2_2"
"CenteredAffineTransform_float_3_3"
"CenteredEuler3DTransform_double_3_3"
"CenteredEuler3DTransform_float_3_3"
"CenteredRigid2DTransform_double_2_2"
"CenteredRigid2DTransform_float_2_2"
"CenteredSimilarity2DTransform_double_2_2"
"CenteredSimilarity2DTransform_float_2_2"
"CompositeTransform_double_2_2"
"CompositeTransform_double_3_3"
"CompositeTransform_double_4_4"
"CompositeTransform_double_5_5"
"CompositeTransform_double_6_6"
"CompositeTransform_double_7_7"
"CompositeTransform_double_8_8"
"CompositeTransform_double_9_9"
"CompositeTransform_float_2_2"
"CompositeTransform_float_3_3"
"CompositeTransform_float_4_4"
"CompositeTransform_float_5_5"
"CompositeTransform_float_6_6"
"CompositeTransform_float_7_7"
"CompositeTransform_float_8_8"
"CompositeTransform_float_9_9"
"ConstantVelocityFieldTransform_double_2_2"
"ConstantVelocityFieldTransform_double_3_3"
"ConstantVelocityFieldTransform_float_2_2"
"ConstantVelocityFieldTransform_float_3_3"
"DisplacementFieldTransform_double_2_2"
"DisplacementFieldTransform_double_3_3"
"DisplacementFieldTransform_float_2_2"
"DisplacementFieldTransform_float_3_3"
"Euler2DTransform_double_2_2"
"Euler2DTransform_float_2_2"
"Euler3DTransform_double_3_3"
"Euler3DTransform_float_3_3"
"FixedCenterOfRotationAffineTransform_double_3_3"
"FixedCenterOfRotationAffineTransform_float_3_3"
"GaussianExponentialDiffeomorphicTransform_double_2_2"
"GaussianExponentialDiffeomorphicTransform_double_3_3"
"GaussianExponentialDiffeomorphicTransform_float_2_2"
"GaussianExponentialDiffeomorphicTransform_float_3_3"
"GaussianSmoothingOnUpdateDisplacementFieldTransform_double_2_2"
"GaussianSmoothingOnUpdateDisplacementFieldTransform_double_3_3"
"GaussianSmoothingOnUpdateDisplacementFieldTransform_float_2_2"
"GaussianSmoothingOnUpdateDisplacementFieldTransform_float_3_3"
"GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform_double_2_2"
"GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform_double_3_3"
"GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform_float_2_2"
"GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform_float_3_3"
"IdentityTransform_double_2_2"
"IdentityTransform_double_3_3"
"IdentityTransform_double_4_4"
"IdentityTransform_double_5_5"
"IdentityTransform_double_6_6"
"IdentityTransform_double_7_7"
"IdentityTransform_double_8_8"
"IdentityTransform_double_9_9"
"IdentityTransform_float_2_2"
"IdentityTransform_float_3_3"
"IdentityTransform_float_4_4"
"IdentityTransform_float_5_5"
"IdentityTransform_float_6_6"
"IdentityTransform_float_7_7"
"IdentityTransform_float_8_8"
"IdentityTransform_float_9_9"
"MatrixOffsetTransformBase_double_4_4"
"MatrixOffsetTransformBase_double_4_4"
"QuaternionRigidTransform_double_3_3"
"QuaternionRigidTransform_float_3_3"
"Rigid2DTransform_double_2_2"
"Rigid2DTransform_float_2_2"
"Rigid3DPerspectiveTransform_double_3_2"
"Rigid3DPerspectiveTransform_float_3_2"
"Rigid3DTransform_double_3_3"
"Rigid3DTransform_float_3_3"
"ScalableAffineTransform_double_3_3"
"ScalableAffineTransform_float_3_3"
"ScaleLogarithmicTransform_double_3_3"
"ScaleLogarithmicTransform_float_3_3"
"ScaleSkewVersor3DTransform_double_3_3"
"ScaleSkewVersor3DTransform_float_3_3"
"ScaleTransform_double_2_2"
"ScaleTransform_double_3_3"
"ScaleTransform_double_4_4"
"ScaleTransform_float_2_2"
"ScaleTransform_float_3_3"
"ScaleTransform_float_4_4"
"ScaleVersor3DTransform_double_3_3"
"ScaleVersor3DTransform_float_3_3"
"Similarity2DTransform_double_2_2"
"Similarity2DTransform_float_2_2"
"Similarity3DTransform_double_3_3"
"Similarity3DTransform_float_3_3"
"TimeVaryingBSplineVelocityFieldTransform_double_2_2"
"TimeVaryingBSplineVelocityFieldTransform_double_3_3"
"TimeVaryingBSplineVelocityFieldTransform_float_2_2"
"TimeVaryingBSplineVelocityFieldTransform_float_3_3"
"TimeVaryingVelocityFieldTransform_double_2_2"
"TimeVaryingVelocityFieldTransform_double_3_3"
"TimeVaryingVelocityFieldTransform_float_2_2"
"TimeVaryingVelocityFieldTransform_float_3_3"
"TranslationTransform_double_2_2"
"TranslationTransform_double_3_3"
"TranslationTransform_double_4_4"
"TranslationTransform_double_5_5"
"TranslationTransform_double_6_6"
"TranslationTransform_double_7_7"
"TranslationTransform_double_8_8"
"TranslationTransform_double_9_9"
"TranslationTransform_float_2_2"
"TranslationTransform_float_3_3"
"TranslationTransform_float_4_4"
"TranslationTransform_float_5_5"
"TranslationTransform_float_6_6"
"TranslationTransform_float_7_7"
"TranslationTransform_float_8_8"
"TranslationTransform_float_9_9"
"VelocityFieldTransform_double_2_2"
"VelocityFieldTransform_double_3_3"
"VelocityFieldTransform_float_2_2"
"VelocityFieldTransform_float_3_3"
"VersorRigid3DTransform_double_3_3"
"VersorRigid3DTransform_float_3_3"
"VersorTransform_double_3_3"
"VersorTransform_float_3_3"

Can't read initial transform
/home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/fsl_to_itk_func_mni_4d_0/_scan_rest_1_rest/fsl_reg_2_itk/affine.txt

The file that the c3d_affine_tool created, affine.txt, contains this:

#Insight Transform File V1.0
#Transform 0
Transform: MatrixOffsetTransformBase_double_3_3
Parameters: 0.999937 0.00118774 -0.0111388 -0.00188052 0.99805 -0.0623922
0.011043 0.0624092 0.99799 -1.25486 -30.7644 -31.7582
FixedParameters: 0 0 0

So c3d_affine_tool is creating a type of transform which is not included
in that list which the antsApplyTransforms error message provided. At first
we thought this may be a c3d_affine_tool version or ITK-SNAP version issue,
but even with the nightly build version of c3d this still happens.

Any help would be appreciated. Thank you!


Reply to this email directly or view it on GitHubhttps://github.com//issues/84
.

from ants.

sgiavasis avatar sgiavasis commented on May 29, 2024

Thanks for the quick response!

I'm going to try out some of your suggestions and post back.

from ants.

sgiavasis avatar sgiavasis commented on May 29, 2024

As a quick test, I changed the text file to contain a compatible type. When I tried to use it, I got an error. I shelved it for a second and just tried the same command with a rigid or affine .mat produced by antsRegistration (a product of a functional to anatomical registration) and got the same error:

Can't read initial transform /home/likewise-open/CHILDMIND/steven.giavasis/deleteThis/transform1Affine.mat

This is in an attempt to register a functional timeseries to a template. I am providing three transforms: 1. an ANTS-generated affine from anatomical-to-template, 2. an ANTS-generated nonlinear warp from the same anatomical-to-template, and 3. the functional-to-anatomical (which is what is throwing the error).

And as above, 3. (the func to anat) throws this error whether I use a c3d-transformed affine or an affine created by antsRegistration.

Any idea what could be tripping up, or how I could go about finding more information about the error?

from ants.

stnava avatar stnava commented on May 29, 2024

sounds convoluted. no ideas. might want to provide the data then i can
give you the right commands --- but sorry cant help with c3d.

brian

On Tue, Apr 29, 2014 at 4:55 PM, sgiavasis [email protected] wrote:

As a quick test, I changed the text file to contain a compatible type.
When I tried to use it, I got an error. I shelved it for a second and just
tried the same command with a rigid or affine .mat produced by
antsRegistration (a product of a functional to anatomical registration) and
got the same error:

Can't read initial transform
/home/likewise-open/CHILDMIND/steven.giavasis/deleteThis/transform1Affine.mat

This is in an attempt to register a functional timeseries to a template. I
am providing three transforms: 1. an ANTS-generated affine from
anatomical-to-template, 2. an ANTS-generated nonlinear warp from the same
anatomical-to-template, and 3. the functional-to-anatomical (which is what
is throwing the error).

And as above, #3 #3 throws this
error whether I use a c3d-transformed affine or an affine created by
antsRegistration.

Any idea what could be tripping up, or how I could go about finding more
information about the error?


Reply to this email directly or view it on GitHubhttps://github.com//issues/84#issuecomment-41730973
.

from ants.

stnava avatar stnava commented on May 29, 2024

example of mapping fmri to a template:

https://github.com/stnava/RfMRI/blob/master/scripts/ants_2_template.sh

brian

On Tue, Apr 29, 2014 at 5:02 PM, brian avants [email protected] wrote:

sounds convoluted. no ideas. might want to provide the data then i can
give you the right commands --- but sorry cant help with c3d.

brian

On Tue, Apr 29, 2014 at 4:55 PM, sgiavasis [email protected]:

As a quick test, I changed the text file to contain a compatible type.
When I tried to use it, I got an error. I shelved it for a second and just
tried the same command with a rigid or affine .mat produced by
antsRegistration (a product of a functional to anatomical registration) and
got the same error:

Can't read initial transform
/home/likewise-open/CHILDMIND/steven.giavasis/deleteThis/transform1Affine.mat

This is in an attempt to register a functional timeseries to a template.
I am providing three transforms: 1. an ANTS-generated affine from
anatomical-to-template, 2. an ANTS-generated nonlinear warp from the same
anatomical-to-template, and 3. the functional-to-anatomical (which is what
is throwing the error).

And as above, #3 #3 throws this
error whether I use a c3d-transformed affine or an affine created by
antsRegistration.

Any idea what could be tripping up, or how I could go about finding more
information about the error?


Reply to this email directly or view it on GitHubhttps://github.com//issues/84#issuecomment-41730973
.

from ants.

sgiavasis avatar sgiavasis commented on May 29, 2024

The example you linked helped me get this working, actually. When I created the anatomical-to-template warps in the script above and then ran the antsApplyTransforms, I got a registered functional that was off-center.

But I added my functional-to-anatomical affine (the c3d-converted one, hand-edited to have an 'appropriate' transform type) as a third transform to the antsApplyTransforms command, and it worked! The only difference ended up being the two anatomical warps (the 1Warp and 0GenericAffine).

My original anatomical warp transforms that did not play well with the functional-to-anatomical in antsApplyTransforms were created with antsRegistration parameters gleaned from the antsIntroduction.sh script. I'm curious- are the parameters in the script above fine-tuned for mapping fmri to template? Why were they chosen? etc.

Thanks for your time!

from ants.

stnava avatar stnava commented on May 29, 2024

glad it worked for you. no fine tuning. the parameters in the example
were just chosen to be fast.

brian

The example you linked helped me get this working, actually. When I created
the anatomical-to-template warps in the script above and then ran the
antsApplyTransforms, I got a registered functional that was off-center.

But I added my functional-to-anatomical affine (the c3d-converted one,
hand-edited to have an 'appropriate' transform type) as a third transform
to the antsApplyTransforms command, and it worked! The only difference
ended up being the two anatomical warps (the 1Warp and 0GenericAffine).

My original anatomical warp transforms that did not play well with the
functional-to-anatomical in antsApplyTransforms were created with
antsRegistration parameters gleaned from the antsIntroduction.sh script.
I'm curious- are the parameters in the script above fine-tuned for mapping
fmri to template? Why were they chosen? etc.

Thanks for your time!


Reply to this email directly or view it on
GitHubhttps://github.com//issues/84#issuecomment-41850547
.

from ants.

sgiavasis avatar sgiavasis commented on May 29, 2024

Got it. One last semi-related question- antsApplyTransforms doesn't accept a dimension argument of 4 for timeseries I noticed- does this mean you are keeping WarpTimeSeriesImageMultiTransform around for now?

Also I would call this issue resolved if you need to close it.

from ants.

stnava avatar stnava commented on May 29, 2024

WarpTimeSeriesImageMultiTransform is deprecated and may be removed.

antsApplyTransforms covers transformation of

scalars, vectors, time series and tensors

brian

On Thu, May 1, 2014 at 4:22 PM, sgiavasis [email protected] wrote:

Got it. One last semi-related question- antsApplyTransforms doesn't accept
a dimension argument of 4 for timeseries I noticed- does this mean you are
keeping WarpTimeSeriesImageMultiTransform around for now?

Also I would call this issue resolved if you need to close it.


Reply to this email directly or view it on GitHubhttps://github.com//issues/84#issuecomment-41952392
.

from ants.

chrisgorgo avatar chrisgorgo commented on May 29, 2024

@sgiavasis could you point me to code (C-PAC) which is doing the FSL .mat to ITK conversion that worked for you at the end?

from ants.

tina-ebi avatar tina-ebi commented on May 29, 2024

Hi There,
I would like to register two T1 structural Images. First, I manually registered them by ITK-snap. But when I want to register them by ANTs, I get an error (I have attached pictures).
any help would be appreciated.

error
myscript

from ants.

gdevenyi avatar gdevenyi commented on May 29, 2024

Please do not revive a discussion from 2014 to ask a question.

  1. Please read the examples provided
  2. Open a new issue if you are still having problems.

from ants.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.