Command line program to reorder multi-volume Analyze images. Multi-volume Analyze files should be ordered slice-by-slice, with all the slices in one volume grouped together; this is repeated for each subsequent volume. However, images may also be ordered volume-by-volume for each slice, i.e., for the first slice, all volumes (time points) are grouped together; this is repeated for each subsequent slice. This program converts between the two ordering schemes. It is required when some DICOM images (in particular from Philips MR scanners) are sorted by the latter scheme and this ordering is retained during conversion of the DICOM images to Analyze format using dtoa.
Before running swap34, ensure that the number of volumes and the number of slices-per-volume is known. This can be obtained by viewing the original Analyze file (e.g., by using ibx), scrolling through the images and noting when the jump between slices occurs.
Run the program by typing
swap34Enter the input image filename as prompted. Then enter the number of images in the third dimension of this file currently (i.e. not the number of images you finally want to be in the third dimension). Enter the number of image sets in the fourth dimension, again as stored in the input file. Finally enter the destination filename which will contain the reordered images.
For a multi-volume Analyze file which has been converted from Philips DICOM images using dtoa and so is ordered incorrectly, as described above, which contains 3 slices per volume and 6 volumes, enter 6 for the third dimension and 3 for the fourth dimension. The destination Analyze file will be ordered correctly, slice-by-slice, with the 10 slices per volume grouped together, followed by the subsequent volume, and so on.
An Analyze file, ordered as follows
slice 1, volume 1 | slice 1, volume 2 | slice 1, volume 3 | slice 1, volume 4 | slice 1, volume 5 | slice 1, volume 6 |
slice 2, volume 1 | slice 2, volume 2 | slice 2, volume 3 | slice 2, volume 4 | slice 2, volume 5 | slice 2, volume 6 |
slice 3, volume 1 | slice 3, volume 2 | slice 3, volume 3 | slice 3, volume 4 | slice 3, volume 5 | slice 3, volume 6 |
on running swap34 with third dimension 6 and fourth dimension 3 becomes
slice 1, volume 1 | slice 2, volume 1 | slice 3, volume 1 |
slice 1, volume 2 | slice 2, volume 2 | slice 3, volume 2 |
slice 1, volume 3 | slice 2, volume 3 | slice 3, volume 3 |
slice 1, volume 4 | slice 2, volume 4 | slice 3, volume 4 |
slice 1, volume 5 | slice 2, volume 5 | slice 3, volume 5 |
slice 1, volume 6 | slice 2, volume 6 | slice 3, volume 6 |