Dear SPMers,
I have written some software to convert all
Supermosaic dicom images in one directory to SPM analyze in batch
mode.
The software is
1.A little ansi c program (dcmsmosaic.c).
It complies perfectly on windows and linux/freebsd ... (linux
makefile included)
Program input:
<matrix size>
<number of slices per volume> <number of volumes per file> <start
number for output> <raw data file>
the raw data file is the supermosaic
dcm image without the header (can be done with xmedcon or vtk)
Program output:
A number of raw data files (as many as there
are volumes in the file). The files are name sequentially, starting from
<start number for output>
to <start number for output>+<number of
volumes>. The file name is left zero padded to span 4 digits.
Each files represent the raw data of one volume
with the slices stacked in memory, as it should be.
An example :
4 volumes with 8 slices per
volume, the Supermosiac dicom file will look like this (volume
slice)
--------------------------------
| 1a | 1b | 1c
|| 2a | 2b | 2c |
--------------------------------
| 1d | 1e | 1f || 2a | 2b | 2c |
--------------------------------
| 1g | 1h | || 2a | 2b |
|
================================
| 3a | 3b | 3c
|| 4a | 4b | 4c |
--------------------------------
| 3d | 3e | 3f || 4a | 4b | 4c |
--------------------------------
| 3g | 3h | || 4a | 4b |
|
--------------------------------
The program will generate 4 files, numbered from a given
startnumber to startnumber+nr of volumes.
The slices will be stacked as follows:
file i
ia
ib
ic
id
ie
if
ig
ih
Attention: my program does not work for
inverted files. If there is need, I might program this.
2. An example linux/unix/freebsd/... shell
script
This script is an example of how to convert a directory
of supermosaic dicom files to SPM analyze files.
It works perfectly on my machine
;-).
!!!!!! Be sure to check the
documentation in the source code and make the necessary adaptations in the
software!!!!!
If there are any problems or you
alter/improve the source code, please contact me!!!!
Pieter
Vandemaele