ENH: Support initialization from ITK transform files in TransformBase#1342
ENH: Support initialization from ITK transform files in TransformBase#1342vboussot wants to merge 1 commit intoSuperElastix:mainfrom
Conversation
…se\n\nAdded support in TransformBase::ReadInitialTransformFromFile to detect and load ITK-formatted transform files (*.itk.txt) using TransformIO.\n Introduced a new method ReadInitialItkTransformFromConfiguration() for handling such transforms separately from standard elastix .txt parameter files.\n This enables direct reuse of transforms generated by ITK pipelines.
|
Interesting proposal, thanks @vboussot However, this is larger than the minimal stylish pull request I had in mind for you, just to let GitHub know that you are no longer a "first-time contributor"! I think your proposal needs some more discussion, and possibly a few more iterations. (In the mean time, GitHub will still think you're a "first-time contributor", so it won't automatically approve the so-called "workflow" of your pull request.) elastix does already support ITK transform files as input, but in an indirect way. You may find it less convenient, but it should work, for the most commonly used ITK transform types. For an initial transform, this works by the following tags // Elastix TransformParameterFile.txt
(Transform "File")
(TransformFileName "ITK-Transform.tfm")Or with a TOML file: // Elastix TransformParameterFile.toml
Transform = "File"
TransformFileName = "ITK-Transform.tfm"Assuming that "ITK-Transform.tfm" is an ITK transform file. So then, the transform is specified by an ITK file, but the Elastix TransformParameterFile may still have extra parameters. For example, it may still refer to a prior transform (elastix transform parameter What do you think? |
|
Yes, you're right, Elastix already supports ITK transform files via (Transform "File"). My PR simply builds on that existing mechanism, I’ve reused the same logic internally. The goal is to make it more intuitive and convenient to use an ITK transform directly with the -t0 flag. So this is really just syntactic sugar, no new transform logic, just a simpler and more direct way to do something that’s already supported, but currently a bit more verbose. |
This PR adds support for using ITK transform files (*.itk.txt) as initial transforms in Elastix via the -t0 flag.
While Elastix already supports exporting transforms in ITK format, I’ve often needed the reverse, initializing a registration from an existing ITK transform. This addition closes that gap, enabling reuse of transforms from ITK pipelines.
A small contribution, as suggested 😉, but it adds a feature I’ve personally missed many times and I suspect I’m not the only one.