maintain crosshair in gui when switching between views (tlrc to orig)

A few comments and suggestions regarding this issue:

  1. The automatic warp on demand capability applies only to data that has only been affine transformed. That requires an affine warp to be present in the header of the dataset. The warp comes from either the dataset itself or from the first anatomical dataset in the session directory that contains an anatomical warp.

  2. If the data has been processed with obliquity in a separate step, that won't be included in the warp in the header, I believe, so that functionality may not be useful for you.

  3. My quick testing found that InstaCorr works with some limitations. InstaCorr allows selection of datasets in the same view as the underlay. I didn't see a difference in A or B controllers. If the underlay is +orig, then the dataset selection must be +orig view also (or equivalent NIFTI sform/qform code); similiarly for +tlrc views. InstaCorr proceeds with normal interaction. Switching between orig and tlrc views does move the crosshairs using the affine warp in the header of the anat dataset, but InstaCorr is no longer updated with mouse clicks. Switching the view back allows for resetting the InstaCorr setup though. Normally, starting in a particular view and then going to InstaCorr setup will not allow a dataset selection if there is no valid dataset view of that view in the directory. However going back into the setup after switching views, unfortunately, allows it because the menu has already been populated with the dataset of the opposite view. Applying the wrong view then causes a crash.

  4. Nonlinear transformations. Nowadays, we typically recommend using nonlinear alignment. These are usually composed of a nonlinear warp transformation and an affine part. These are now slow to compute, so we don't have any warp-on-demand capability for that. Computing coordinates between orig native space and the template space can be done with 3dNwarpXYZ as in this example:

3dNwarpXYZ -nwarp ‘anatQQ.WARP.nii anatQQ.aff12.1D’  [-iwarp] testxyz.1D

where testxyz.1D has a list of xyz coordinates in RAI (DICOM order - right to left, anterior to posterior, inferior to superior). The -iwarp option can be added if if going from the native space to the standard space. Check the directions and the results by looking at the resulting locations on the anatomical data.

  1. Vecwarp works similarly for applying affine warps backward or forwards to sets of xyz coordinates.

Coordinate conversion between native and standard spaces has important uses in clinical and surgical applications, but you have to be very careful on how these are computed. Overall, the warp-on-demand feature is a little too mysterious, so I would avoid relying on it. Nonlinear alignment makes that feature less relevant to most processing pipelines, but scripting with 3dNwarpXYZ is a better alternative.