embl-cba / elastixWrapper

13 stars 2 forks source link

Use initial transformation not functional? #15

Closed DSbioimaging closed 2 years ago

DSbioimaging commented 2 years ago

I am trying to use a translation transform before using affine in two separate registration passes but the use initial transform setting seems not to anything since the program shows the result right away.

To break down the issue in simpler steps:

I have identical issues also when attempting a first Euler rigid registration followed by BSpline where there is a duplicated rigid transform without any computation. My current solution involves using the interpolated files from the first registration pass and feed them it to the second registration round, not ideal.

Thank you for releasing this by the way!

tischi commented 2 years ago

Hi @DSbiomedAU, usually this should work. In the "Temporary directory for intermediate files" there should be an elastix.log file. Could you post this here? Maybe we can see what is going on.

Another question: Where do you save the Transform1 file? I think it may not work if this is in the "Temporary directory for intermediate files"...

DSbioimaging commented 2 years ago

Hi @tischi, I think I found the problem by looking at the log file as you suggested. I was saving the transformation files without a ".txt" file extension and elastix was throwing an error in the log about it. They are not saved in the temp folder btw. After fixing my mistake I can see that the second transformation is now applied (e.g. first translation, second Euler) and it doesn't just apply the first transformation. I'm not sure it is actually using the first transformation file to initialize the registration but most likely it is working as intended. log without .txt extension elastix.log log with .txt extension elastix.log

Thanks! It has been bugging me for a while, now I will be able to apply multiple transforms in succession without resampling the images at each step. Maybe this could be another documentation improvement point? Users always find a way to make mistakes. ;)

tischi commented 2 years ago

Looking at my documentation I must admit I was underwhelmed ;-) There is a lot of room for improvement and I will add everything you suggested! Thanks a lot!

I just have to strike a balance in order not to rewrite the official elastix manual, which, by the way, is a fantastic read!

DSbioimaging commented 2 years ago

You make a good point about not rewriting the manual. ;-) The documentation of the wrapper is quite good and got me going within few attempts, I hit those minor stumbling blocks when trying to use more advanced features.

I agree that the official manual is quite nice and clear!

tischi commented 2 years ago

thanks a lot! I added some more documentation: https://github.com/embl-cba/elastixWrapper/commit/d41a655c4d60fb86f1189891465955f1ef94d1d7