users > New groupwise_reformat script
Showing 1-2 of 2 posts
Display:
Results per page:
Aug 5, 2012  07:08 PM | Torsten Rohlfing
New groupwise_reformat script
A quick note - the latest CMTK svn has a nifty new script to facilitate reformatting of groupwise-aligned images.



Use like so:



groupwise_reformat --cubic --short ~/tmp/reformat/%1.nii ~/tmp/affine/average.nii ~/tmp/affine/groupwise.xforms



To explain - this script runs reformatx for each of the aligned moving
images references in "groupwise.xforms". The "average.nii" image defines
the refomating target grid; you can use the generated average image,
like here, or use a different grid.



The "reformat/%1.nii" string is the output file name pattern (and image
type; nii). The "%1" is replaced with the last part of the path of each
image (minus suffix) which in your case is the specimen name. You could
also use %2, %3, and so on, to access higher levels of the path to the
image, e.g., if all your images were stores as
/some/path/SPECIMEN/image.nhdr, then you would want to use %2, because
all %1 replacements would be the same ("image"). Hope this makes sense.



Finally (sorry for reverse order) - all initial options (ie., leading
arguments that begin with "-") are handed over to each of the reformatx
calls. Here, I am using these options to select cubic rather than linear
interpolation and switch pixel type from byte to short to allow for
value under/overruns due to cubic kernel.



What I am not using in the above example, but what will be handy for
multi-level alignments, is that you can give additional transformations
after the groupwise xform, and these will then be applied BEFORE the
transformations to each of the floating images (for example, you could
use an alignment xform here, which rotates and shifts the groupwise
average in whatever position you want it to have in the target grid).



Again, hope this all makes sense. This was literally put together last
night and this morning, so it's not necessarily well thought through
yet.



Torsten
Aug 6, 2012  04:08 AM | Torsten Rohlfing
RE: New groupwise_reformat script
Heads-up - the order of arguments is really not intuititve, so this will be changed very soon - the order of description in my previous post seems more natural - 1. groupwise xform, 2. reference grid, 3. output pattern. I will change the script to match this order.