CoBrALab / minc-toolkit-extras

Extra miscellaneous scripts for minc-toolkit
Other
6 stars 7 forks source link

Rigid registration #7

Closed araikes closed 2 years ago

araikes commented 2 years ago

@gdevenyi,

First, thanks for all of the exceptionally cool improvements you make to existing programs. ants_generate_iterations.sh and antsRegistration_affine_SyN.sh are fantastic and have dramatically improved not only my mouse templates but also the registration of those templates to standard spaces.

Two things:

  1. If anything ultimately comes out of using these (e.g., manuscripts), let me know how you'd like these scripts credited.
  2. If I just need a rigid registration between a _b_0 image (diffusion) and a T2 in order to move my diffusion data to T2 space, what are the right flags to set for antsRegistration_affine_SyN.sh. Is it as simple as antsRegistration_affine_SyN.sh $moving $fixed dwi2struct_ --skip-nonlinear --linear-type rigid?
gdevenyi commented 2 years ago

hi @araikes, glad to see you're enjoying the work.

dramatically improved not only my mouse templates

If you're enjoying those now, take a look at https://github.com/cobralab/optimized_antsMultivariateTemplateConstruction/ for a re-implemented template builder (DBM postprocessing in-progress....)

If anything ultimately comes out of using these (e.g., manuscripts), let me know how you'd like these scripts credited.

I guess for now, point at the repo. I have a sort of article of sorts in my head of "A non-random walk through scale space" which might eventually exist to describe my thoughts and the process of how these tools arose...

Is it as simple as antsRegistration_affine_SyN.sh $moving $fixed dwi2struct_ --skip-nonlinear --linear-type rigid?

Yes, --skip-nonlinear will skip the nonlinear, and --linear-type rigid will restrict the generated affine stages to only translation/rigid.

a _b_0 image (diffusion) and a T2 in

I haven't tried that combination before, as we don't work with DWI sequences much, so I'd be interested to hear how it goes.

araikes commented 2 years ago

@gdevenyi

Right now, I'm running everything in a Singularity container (for "ease" and version locking). The qbatch requirement for the optimized antsMTC is a limiting factor there, I think.

Re: the other points... I'll certainly point to the repo for references and good that much understanding of the rigid registration was accurate.

I'll let you know how the DWI to T2 goes.

gdevenyi commented 2 years ago

The qbatch requirement for the optimized antsMTC is a limiting factor there, I think.

Good news! export QBATCH_SYSTEM="local" makes qbatch just use gnu parallel locally. I tested the code developing it like that. You'll have to check your memory limits to get those right, otherwise it just runs as many commands as CPUs by default.

qbatch has a QBATCH_SYSTEM="container" method, where it passes commands into an "outer" qbatch, which submits jobs to run inside a container on a cluster, I wrapped MAGeTbrain with it, https://github.com/CoBrALab/MAGeTDocker/blob/master/mb-container

araikes commented 2 years ago

I'll have to look into that and see if I can get it operational. If I use QBATCH_SYSTEM="local", I'd likely need QBATCH installed inside the container, yeah?

gdevenyi commented 2 years ago

I'd likely need QBATCH installed inside the container, yeah?

Yup pip install qbatch, and apt-get install -y gnu-parallel

araikes commented 2 years ago

Local QBATCH worked and I was able to generate the template (https://github.com/cobralab/optimized_antsMultivariateTemplateConstruction/). I know there's a lot of defaults.. Any optimal settings you've found with mice?

gdevenyi commented 2 years ago

The defaults are intended to synthesize what I understand to produce the best results.

I suggest is to start with a reference image to define the orientation/resolution, including making one from one of the inputs if you don't have it (or constructing a rigid-only one or such to bootstrap).

Something I think would make things better, but I haven't proven, so it is not yet default is a gradient step schedule, https://github.com/CoBrALab/optimized_antsMultivariateTemplateConstruction/issues/5