[Elastix] Averaging using WeightedCombinationTransform
Pelt, R.F.P. van
R.F.P.v.Pelt at tue.nl
Tue Jul 9 17:19:32 CEST 2013
Hi Marius,
Thanks for your prompt reply.
Of course transformix does not resample to a certain location, but -at- a certain location.
Momentary lapse of reason from my side - sorry for that.
Still, after averaging a good choice for the resulting volume characteristics should be made. (Also taking into account the direction cosines)
When setting the characteristics (origin, spacing, etc.) equal to that of 001, I do get a result, but we're surely not in the right frame of reference.
I take the weighted average of all transformations where 001 is the moving image.
Say T1 = 1/(N -1) Sum_j Tj1 , with N the number of data sets
I've experimented a bit, but I'm not quite sure what's best:
- For the dimensions and spacing I tried the maximum or median over all data sets
- For the origin I tried the average over all datasets
- For the transformmatrix, I'm still not sure: also an average? Surely we have to check for orthonormality here.
When this would works out, I continue to create the subject-based average (with * is the transformation composition):
001 -> transform with T1
002 -> transform with T1 * T12 (by overwriting the initialtransform parameter)
003 -> transform with T1 * T13 (by overwriting the initialtransform parameter)
The results will be averaged voxel-wise, and therefore it is important for me to find the 'right' joint reference space.
Could you make suggestions / recommendations?
Thanks again for your help.
Best wishes,
Roy
From: M.Staring at lumc.nl [mailto:M.Staring at lumc.nl]
Sent: maandag 8 juli 2013 10:13
To: Pelt, R.F.P. van
Cc: elastix at bigr.nl
Subject: RE: Averaging using WeightedCombinationTransform
Hi Roy,
From: Pelt, R.F.P. van [mailto:R.F.P.v.Pelt at tue.nl]
Sent: woensdag 3 juli 2013 14:48
To: Staring, M. (LKEB)
Cc: elastix at bigr.nl<mailto:elastix at bigr.nl>
Subject: RE: Averaging using WeightedCombinationTransform
Hi Marius,
Thanks again, it sure helped my understanding of the weighted transform!
<snip>
For the output volume I provide an appropriate output size and spacing, but also force the origin to (0,0,0) and transformmatrix to identity.
(Am I allowed to do this? I doubt if I can just resample to this origin location, but I'd rather not register the averaged volume again?!)
One resamples at some origin not to some origin.
This means that if your images are not at the origin (0,0,0) but say around some point O, then you should resample at that location. If you resample to image 001 (as you do below) you should use origin and direction cosines of that image.
With the DirectionCosines set to true, only part of my data actually ends up in the volume, so a translational part is missing.
I think this is due to you using origin zero instead of that of image 001.
Without the DirectionCosines used, I get a result, but the data in the three resulting combined volumes are nowhere close to each other.
(They should end up quite close to each other, as this combined transformation should be the closest transformation you can get from the currently considered volume to the overall average volume)
Do you have an idea what I'm missing / overlooking here?
My generated TransformParameters.avg.txt:
//-----------------------------------------------------------------------------------------------------------------
<snip>
(Size 144 144 52)
(Index 0 0 0)
(Spacing 2.08333 2.08333 2.7)
(Origin 0.0 0.0 0.0) <------ Use origin of image 001
(Direction 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0) <------ Use DC of image 001
(UseDirectionCosines "true")
<snip>
Sorry for the long question, but I hope it is specific and clear enough to understand what I'm trying to achieve.
Thanks again for the support.
Best wishes,
Roy
So, perhaps you can try changing origin and DC and see if that helps you.
HTH, Marius
From: M.Staring at lumc.nl<mailto:M.Staring at lumc.nl> [mailto:M.Staring at lumc.nl]
Sent: vrijdag 7 juni 2013 9:17
To: Pelt, R.F.P. van; elastix at bigr.nl<mailto:elastix at bigr.nl>
Subject: RE: Averaging using WeightedCombinationTransform
Hi Roy,
You do: transformix <snip> -jac all -jacmat all
so you ask to compute the spatial Jacobians of the transformation. However, the WeightedCombinationTransform does not have the spatial Jacobian implemented, as the error message says. If you are interested I can give you some pointers on how to implement it. But you can also compute the spatial derivative from the resulting deformation field, by taking a finite difference derivative. We have implemented that in ITKTools, see
https://github.com/ITKTools/ITKTools
pxdeformationfieldoperator
In transformix we indeed catch this exception, and then continue with the other tasks.
HTH, Marius
From: elastix-bounces at bigr.nl<mailto:elastix-bounces at bigr.nl> [mailto:elastix-bounces at bigr.nl] On Behalf Of Pelt, R.F.P. van
Sent: dinsdag 4 juni 2013 14:44
To: elastix at bigr.nl<mailto:elastix at bigr.nl>
Subject: [Elastix] Averaging using WeightedCombinationTransform
Hi all,
After some parameter tweaking, I have a affine + on-rigid registration working for multiple data sets.
Also I can compute the inverse transformations using the DisplacementMagnitudePenalty metric.
Great library, and so far so good :)
Now I would like to average a number of transformation to come to a 'normal' data set.
I've included in my parameter file:
---
(Transform "WeightedCombinationTransform")
(NormalizeCombinationWeights "true" )
(NumberOfParameters 2)
(TransformParameters 1 1)
(SubTransforms "output\f002_m001\TransformParameters.0.txt" "output\f003_m001\TransformParameters.0.txt")
---
And subsequently I run:
---
elastix -f fixed_001.mhd -m fixed_001.mhd -out result -p transform_average.txt
transformix -in fixed_001.mhd -tp result\TransformParameters.0.txt -out result -def all -jac all -jacmat all
---
I get a result, but with some errors and warnings:
---
Description: itk::ERROR: MultiThreader(000000000481C510): Exception occurred during SingleMethodExecute
c:\users\wyke\documents\elastix4.6\src\components\transforms\weightedcombinationtransform\itkWeightedCombinationTransform.h:185:
itk::ERROR: WeightedCombinationTransform(0000000002C56A60): Not implemented for WeightedCombinationTransform
Error occurred while writing spatial Jacobian determinant image.
However, transformix continues anyway.
---
My questions:
-Am I right to provide the fixed volume for both the fixed and moving parameters of Elastix?
(i.e., identical to the computation of the inverse)
- How do I choose the best output dimensions?
Should I make an educated estimate, and change the TransformParameters.0.txt generated by Elastix?
- Not sure about the error. Seems to be a hardcoded erroneous path to c:\users\wyke.
Does this relate to this discussion: http://lists.bigr.nl/pipermail/elastix/2012-August/000896.html?
- Any chance on getting the full spatial Jacobian?
I need to use the information after the averaging is done.
Should I manually take the derivative of the resulting averaged deformation field?
Thanks again!
- Roy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bigr.nl/pipermail/elastix/attachments/20130709/ebbb98a9/attachment-0001.html>
More information about the Elastix
mailing list