====== Preview ====== Imagine you have two sets of experiments with two different template brains. You have two large data sets that you would like to compare, but they are in separate frames of reference. You therefore need to compute the transformation that maps one template onto the other. For the purposes of this comparison, you will need to decide which of the two templates is going to be the master template. This is particularly important because the warping registrations are not simply invertible (finding A->B does not automatically give you B->A), so you need to decide which direction you expect to run most comparisons. It may be difficult to calculate a registration automatically if the brains have been imaged with very different parameter sets or different fields of view, but you can help by specifying landmarks in the two brains to generate a starting transformation. This is described in detail in [[calculating an initial registration from landmarks]]. Once you have the registration, then you can convert images from one frame of reference to the other using the command line tools or use my R tools to work with neuronal tracings. ====== Reformatting Images ====== For images you can use the ''reformatx'' tool to convert them (in earlier versions of the registration software the program was called reformat and had different command line switches). You would do something like this: reformatx --floating floatingimage.nrrd -o outfile.nrrd TemplateImage.nrrd bridgingreg.list See the [[https://neuro.sri.com/cmtk/wiki/index.php/Main_Page|CMTK wiki]] page on [[https://neuro.sri.com/cmtk/wiki/index.php/Command_Line_Tools:_reformatx|reformatx]] and the nascent CMTK manual for more details. Here is a specific example that includes some additional switches that I have used to convert a brain from Jai Yu's T1 reference brain and our IS2 reference brain. reformatx --verbose \ --floating AL-PNs_mask_MF_final_IS2ViaIS2h_SAGP55-1_02.nrrd \ --o AL-PNs_mask_MF_final_T1_SAGP55-1_02.nrrd \ /Volumes/JData/JPeople/Common/Neuroanatomy/ReferenceBrains/DicksonReferenceBrain/T1.PIC \ /Volumes/JData/JPeople/Common/Neuroanatomy/ReferenceBrains/T1_IS2_BridgingReg/Registration/warp/T1_IS2_01_warp_m0g80c8e1e-1x26r4.list [[http://teem.sourceforge.net/nrrd/|Nrrd]] is my preferred image output format from CMTK (the main alternative is [[http://nifti.nimh.nih.gov/|nifti]]). It can be opened by Fiji/ImageJ and [[http://www.slicer.org/pages/Introduction|3D Slicer]]. I have also written an I/O plugin for Amira. ====== Reformatting Tracings ====== To reformat neuronal tracings etc, you will need a tool which Torsten baptised gregxform. This transforms arbitrary coordinates from one frame of reference to another. You can call this with something like: gregxform AontoBregistrationfile.list and then type in space separated 3D coords in frame A and get back space separated coords in frame B. There are a number of utility functions in my R AnalysisSuite that help with actually doing this with neuron tracings. In particular if you have a neuron you can use the function **''TransformNeuron''** # Read in a neuron in the Neurolucida ASCII format. OldNeuron=ReadNeuronFromAsc("tracing.asc") # Now transform it TransformedNeuron=TransformNeuron(OldNeuron,warpfile="Registration/warp/T1_average-goodbrains-warp40-5_e1e-2_warp_m0g40c4e1e-1x16r3.list") # save in AmiraMesh format using the original neuron name WriteNeuronToAM(x,AMFile=file.path(x$CellType,paste(x$NeuronName,sep=".","am"))) This calls the base function **''transformedPoints''** to do the actual work. If you specify a warping transform, you can also choose whether to apply the initial affine alone or affine+warp with the ''transform=c("warp","affine")'' option to ''TransformNeuron''. ====== Available Bridging Registrations ====== We have made available a number of bridging registrations between different commonly used template brains: http://github.com/jefferis/BridgingRegistrations If a pair that you need is missing, we will be happy to try and help.