|
|
(2 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| <h1><center><b>Maverick: VisibleManTxtToMhd</b></center></h1>
| | #REDIRECT [[Maverick]] |
| | |
| = Introduction =
| |
| | |
| Use this program to import the Visible Man's data into a format that can be read by Maverick and other ITK and VTK-based applications.
| |
| | |
| == Background ==
| |
| | |
| The Visible Man's CT data consists of a pair of files per CT slice:
| |
| | |
| * The slice's data is stored in a binary-encoded format (.fre) that isn't readable by many programs
| |
| ** e.g., c_vm1013.fre, c_vm1014.fre, ...
| |
| ** The binary data (uncompressed) for the slice actually occurs at the end of this file
| |
| ** The header size for this file (the information before the data begins) is of variable length
| |
| * A text file (.txt) that describes the acquisition parameters of the slice
| |
| ** e.g., c_vm1013.fre.txt, c_vm1014.fre.txt, ...
| |
| ** Describes the origin, spacing, directions, kEv, etc for each slice
| |
| | |
| == Operation ==
| |
| | |
| This utility program will convert a list of .txt files from the visible man collection to corresponding .mhd files. Those .mhd files are part of the MetaImage standard which is supported by ITK, VTK, Slicer, Analyze, and numerous other packages. The .mhd files point to the .fre files and allow those corresponding slices to be read by MetaImage compliant libraries and applications.
| |
| | |
| = Usage =
| |
| | |
| At this time this utility program is only available with a command-line interface.
| |
| | |
| Maverick/bin/VisibleManTxtToMhd <input.txt> <output.mhd>
| |
| | |
| The first argument is the path to the visible man's .txt file to be converted.
| |
| | |
| The second argument is the output path to the .mhd file to be created.
| |
| | |
| <em>Warning</em>: The .mhd files only point to the binary data (in this case the .fre file) that they describe. The slice data is not duplicated in the .mhd file. Therefore, to use this .mhd file to read the slice data, the .mhd file must be created and/or placed in the same directory as the .fre file to which it points.
| |
| | |
| <em>Hint</em>: The .mhd files are text files. Any text editor can be used to create or modify these files. Additional MetaImage documentation is ONLINE.
| |
| | |
| = Use cases =
| |
| | |
| == Linux ==
| |
| | |
| Consider a directory that contains a subset of the Visible Man's CT data:
| |
| | |
| c_vm1013.fre
| |
| c_vm1013.fre.txt
| |
| c_vm1014.fre
| |
| c_vm1014.fre.txt
| |
| c_vm1015.fre
| |
| c_vm1015.fre.txt
| |
| c_vm1016.fre
| |
| c_vm1016.fre.txt
| |
| c_vm1017.fre
| |
| c_vm1017.fre.txt
| |
| c_vm1018.fre
| |
| c_vm1018.fre.txt
| |
| c_vm1019.fre
| |
| c_vm1019.fre.txt
| |
| c_vm1020.fre
| |
| c_vm1020.fre.txt
| |
| c_vm1021.fre
| |
| c_vm1021.fre.txt
| |
| c_vm1022.fre
| |
| c_vm1022.fre.txt
| |
| c_vm1023.fre
| |
| c_vm1023.fre.txt
| |
| c_vm1024.fre
| |
| c_vm1024.fre.txt
| |
| c_vm1025.fre
| |
| c_vm1025.fre.txt
| |
| c_vm1026.fre
| |
| c_vm1026.fre.txt
| |
| c_vm1027.fre
| |
| c_vm1027.fre.txt
| |
| | |
| === Processing a single .txt file ===
| |
| | |
| You can process an individual file using, for example, the command:
| |
| | |
| VisibleManTxtToMhd c_vm1013.fre.txt c_vm1013.fre.txt.mhd
| |
| | |
| That will create a file called <em>c_vm1013.fre.txt.mhd</em> that contains the following:
| |
| | |
| NDims = 3
| |
| DimSize = 512 512 1
| |
| HeaderSize = -1
| |
| Offset = 123 125 389
| |
| Orientation = -1 0 0 0 -1 0 0 0 1
| |
| ElementType = MET_USHORT
| |
| ElementByteOrderMSB = True
| |
| ElementSpacing = 0.488281 0.488281 1
| |
| ElementDataFile = LIST
| |
| c_vm1013.fre
| |
| | |
| That <em>c_vm1013.fre.txt.mhd</em> file captures the dimensions, origin (Offset), orientation, and pixel spacing for the data contained in the file c_vm1013.fre. The line "HeaderSize = -1" forces the data to be read from the end of the .fre file, thereby skipping an arbitrary-sized header.
| |
| | |
| === Processing multiple .txt files ===
| |
| | |
| You can create a for-loop to process all of the .txt files in a directory. If your shell is bash, the following for-loop will work:
| |
| | |
| for i in *txt; do ~/src/Maverick-VS9/bin/RelWithDebInfo/VisibleManTxtToMhd $i $i.mhd; done
| |
| | |
| The result of that command will be a new directory listing that resembles the following:
| |
| | |
| <pre>
| |
| c_vm1013.fre
| |
| c_vm1013.fre.txt
| |
| c_vm1013.fre.txt.mhd
| |
| c_vm1014.fre
| |
| c_vm1014.fre.txt
| |
| c_vm1014.fre.txt.mhd
| |
| c_vm1015.fre
| |
| c_vm1015.fre.txt
| |
| c_vm1015.fre.txt.mhd
| |
| c_vm1016.fre
| |
| c_vm1016.fre.txt
| |
| c_vm1016.fre.txt.mhd
| |
| c_vm1017.fre
| |
| c_vm1017.fre.txt
| |
| c_vm1017.fre.txt.mhd
| |
| c_vm1018.fre
| |
| c_vm1018.fre.txt
| |
| c_vm1018.fre.txt.mhd
| |
| c_vm1019.fre
| |
| c_vm1019.fre.txt
| |
| c_vm1019.fre.txt.mhd
| |
| c_vm1020.fre
| |
| c_vm1020.fre.txt
| |
| c_vm1020.fre.txt.mhd
| |
| c_vm1021.fre
| |
| c_vm1021.fre.txt
| |
| c_vm1021.fre.txt.mhd
| |
| c_vm1022.fre
| |
| c_vm1022.fre.txt
| |
| c_vm1022.fre.txt.mhd
| |
| c_vm1023.fre
| |
| c_vm1023.fre.txt
| |
| c_vm1023.fre.txt.mhd
| |
| c_vm1024.fre
| |
| c_vm1024.fre.txt
| |
| c_vm1024.fre.txt.mhd
| |
| c_vm1025.fre
| |
| c_vm1025.fre.txt
| |
| c_vm1025.fre.txt.mhd
| |
| c_vm1026.fre
| |
| c_vm1026.fre.txt
| |
| c_vm1026.fre.txt.mhd
| |
| c_vm1027.fre
| |
| c_vm1027.fre.txt
| |
| c_vm1027.fre.txt.mhd
| |
| </pre>
| |
| | |
| == Windows ==
| |
| | |
| Install cygwin and follow the directions for linux.
| |