saalfeldlab / bigwarp

A tool for manual pointwise deformable registration using bigdataviewer.
GNU General Public License v2.0
25 stars 14 forks source link

Export affine transformation only? #71

Closed zmiller22 closed 4 years ago

zmiller22 commented 5 years ago

I am trying to use the antsApplyTransforms command to apply a transformation generated in BigWarp using the export warp field option to another image (same dimensions, modality, etc). I see that export warp field has an ignore affine transformation option, but is there an option to export only the affine transformation? In general, if someone could point me to somewhere I can find more information about the outputted warp field in BigWarp other than the Wiki I would appreciate it!

bogovicj commented 5 years ago

@zmiller22 ,

Is there a particular reason you'd like to use antsApplyTransforms and not the "built in" Bigwarp functions to apply the transformation?

The Big Warp Apply fiji plugin does not handle applying only the affine part of the transformation at the moment. That is a problem, and this functionality should be added - thanks for pointing that out.

Adding this feature to the scripts should be quick work...

Still, I think you could accomplish what you want right now by: 1) Creating a multichannel image in which each channel is an image you want to warp / transform. 2) Run bigwarp with the multichannel image from (1) 3) Choose the affine-only transformation option F8 4) Export the moving image(s)

zmiller22 commented 5 years ago

Thanks for the fast and detailed reply. Right now we have 3 imaging modalities generating images a, b, and c. We used BigWarp to register modality a to modality b, and ANTs to register modality b to modality c. Ideally, if we could get the transformation from BigWarp in the right format, we could use antsApplyTransforms to sequentially apply transforms and effectively allign modality a to modality c since a->b->c is the same as a->c without having to actually do another transformation. We would like to automate this process in a script instead of having to use the GUI each time, and I thought ANTs might be a good way to do this. Although if BigWarp can be used as a command line tool, that might be a better route to go. Unfortunately I couldn't get it to install using conda. Is this no longer supported?

zmiller22 commented 5 years ago

Also for some reason f8 is no longer bringing up the transformation options (but used to). Maybe a new bug? Really appreciate you keeping this up to date by the way it has been a huge help to our lab.

bogovicj commented 5 years ago

Thanks for those details, that helps my understanding a lot.

This conversation turned to question of usage more than bugs - would you mind moving this to the forum here: https://forum.image.sc/

A Partial non-answer

The main difficulty will be exporting the warp field in a format that ANTs is happy with - it can be picky (rightly so) about what it accepts. And while fiji is pretty good about writing 3d nifti and nrrd files, its generally not great about writing 4d images meant to be interpreted as 3d vector fields - what the warp field are.

A partial answer

I have utilities that can usually apply both bigwarp transform and ants transforms in this repo: https://github.com/saalfeldlab/template-building Check this out in particular.

All that being said, I do think the forum is a better place for this conversation.

Also for some reason f8 is no longer bringing up the transformation options (but used to).

Weird, I'll see if I can reproduce

Really appreciate you keeping this up to date by the way it has been a huge help to our lab.

Thanks for your kind words, and glad you're findit it useful. It's why we made it! :)

zmiller22 commented 5 years ago

Thanks. Is there a way to transfer these posts over there or do you just want me to re-post the question over there?

bogovicj commented 5 years ago

Awesome thanks.
Not worth it to repost everything, but maybe just write your second post there, and link to this issue.

zmiller22 commented 5 years ago

Done

bogovicj commented 4 years ago

Havn't heard for awhile, so I'll assume you have what you need. Closing this issue.