Introduction
I have written a tcl script, ResultViewer.hx
, based on work from Steffen Prohaska that allows
- visualisation in Amira of affine registered brains compared with a template
- selection of what kind of affine (9dof, ght etc)
- selection of a template brain (FC6475, FCWB)
- calculation of surface-based affine registration
There is also a related simpler script StackViewer which simply allows rapid scanning through a directory of confocal scripts.
Install
- You need the Amira mesh toolbox (on gjac or gj8c) or ZIB Amira for surface based affine registrations
git clone git@bitbucket.org:jefferis/resultviewer.git
somewhere sensible- This also lives on JData here
/Volumes/JData/JPeople/Steffen/2011-07-29_InitBrainPosGHT
- Make sure that you have a template brain called
TemplateStem.surf
in the hx subfolder- use a downsampled brain to make this and aim for ~ 20k faces in the surface model
Configuring
- make downsampled versions of your images in a folder called
images4um
that is next to the folder containing registrations e.g.- MyBigRegistrationFolder
- images4um
- Registration
- warp
- affine
- Make a keylist file, a text file which contains the key for one brain per line
- TCL will look for the registration folders like this:
${refbrain}_${brainkey}_${chan}_${regtype}.list
- so make sure that the key corresponds to everything between the name of the refbrain and the channel
- so for a registration folder called
IS2_AABD4-1_01_9dof.list
the key would beAABD4-1
- the script currently assumes that the reference (nc82) channel will be channel 1
- Double click/drag and drop
src/ResultViewer.hx
onto Amira to get started- This lives at
/Volumes/JData/JPeople/Steffen/2011-07-29_InitBrainPosGHT/src/ResultViewer.hx
if you are using the JData version.
- You will get a blue node in your object pool
- Click on it
- Choose the Reg root dir e.g.
/Volumes/JData/JPeople/Aaron/YourRegistrationFolder/Registrations/IS2/Registration
- Choose the key list file e.g.
/Volumes/JData/JPeople/Aaron/YourRegistrationFolder/Registrations/IS2/Registration/mynicebrains.txt
- the key list can be called anything and the location doesn't matter
- Choose your reg type e.g. 9dof or ght
- this must be eveything between the last underscore after the channel number and
.list
(${refbrain}_${brainkey}_${chan}_${regtype}.list
)
- Choose your Ref Brain e.g. FCWB
- Tick Save registration at CMTK if you want to save in CMTK format
- if you want to use this as an initial affine registration (to feed into image based affine) then you should save as XXX_ght.list and use
munger.pl
's-H
switch - if you want to use this as an affine to pass to the warp program then you should save as XXXX_9dof.list
Resampling Brains
- You should have some resampled brains as input
- This script expects them to live in a folder called
images4um
(though you can choose any voxel size you want within reason) - Voxel dimensions in the range 2x2x2 um to 4x4x4 um are sensible
- In R with AnalysisSuite you can use
NrrdResample(<infile>,<outdir>,voxdims=c(2,2,2))
- See using_showclones for a longer example
Selecting brains
- move the brain num slider to move the brains in a list (
there must be 2 or more at the moment)
- Tick selected to choose a brain
- Click SaveSelected button to save your selected brains
- if your input was
mynicebrains.txt
this will make a file calledmynicebrains.txt-sel.txt
- if you already had a file called
mynicebrains.txt-sel.txt
it will make a backup calledmynicebrains.txt-sel.txt.bak
- if you already had a backup file called
mynicebrains.txt-sel.txt.bak
it will be overwritten
- Save at least every few hundred brains (it seems to crash after ~ 1000)
- If you want to restart with an existing selection click LoadSelected
Calculating Affine Registrations
If the existing registration is poor (or non-existent) you can often make a good one using Amira's surface based registration
- Click SetupReg
- a red surface model should appear
- Turn off
curbrainview
(volume rendering) so you can see more clearly
- Click on
curbrain.surf
- Click on the Transform editor (4th icon along)
- Choose Manipulator … Tab Box
- Make sure that you have the arrow selected (top left icon in viewer pane)
- Drag the red surface model on top of your reference
- Either click on
curbrain.AlignSurfaces
- choose Trafo
rigid
- Hit Surfaces
- choose Trafo
rigid + unifiorm scale
- Hit Surfaces
- choose Trafo
affine
- OR scale it using the green corners if the size is different
- then click on
curbrain.AlignSurfaces
- choose Trafo
affine
- Hit Surfaces
- You now have an affine that can be used to initialise either an image based affine or a warping registration
- Go back to ResultViewer.hx
- Hit SaveReg
ToDo
Make affine directories if they don't exist (so that one can make surface based registrations from scratch)Add a surface for IS2- make it possible to look at reformatted images directly (rather than applying registration to original image)
- resample images