Front Page Forums Re: BioMap File Format

#827
Markus Stoeckli
Moderator

The format we are using is the Analyze (TM) 7.5 file format. It is extremely simple: the intensity data is written uncompressed in the binary format to the *.img file and the header file *.hdr specifies the content. The corresponding m/z values are saved as an array of single precision values in the *.t2m file (same for all the spectra in the image file) . We chose this format because its simplicity and because most clinical applications can import it. Below you find the type definition we used in the VB application.

Best regards,

Markus

[code] Public Type uAnaHdr
sizeof_hdr As Long ‘0+4’
data_type As String * 10 ‘4+10′
db_name As String * 18 ’14+18′
extents As Long ’32+4′
session_error As Integer ’36+2′
regular As Byte ’38+1′
hkey_un0 As Byte ’39+1’
End Type ‘total 40 bytes’

Public Type uAnaDim
dims(7) As Integer ‘0+16′
unused8 As Integer ’16+2′
unused9 As Integer ’18+2′
unused10 As Integer ’20+2′
unused11 As Integer ’22+2′
unused12 As Integer ’24+2′
unused13 As Integer ’26+2′
unused14 As Integer ’28+2′
datatype As Integer ’30+2′
bitpix As Integer ’32+2′
dim_un0 As Integer ’34+2′
pixdim(7) As Single ’36+32′
vox_offset As Single ’68+4′
funused1 As Single ’72+4′
funused2 As Single ’76+4′
funused3 As Single ’80+4′
cal_max As Single ’84+4′
cal_min As Single ’88+4′
compressed As Single ’92+4′
verified As Single ’96+4’
glmax As Long ‘100+4’
glmin As Long ‘104+4’
End Type ‘total 108 bytes’

Type uAnaHist
descrip As String * 80 ‘0+80′
aux_files As String * 24 ’80+24’
orient As Byte ‘104+1’
orginator As String * 10 ‘105+10’
generated As String * 10 ‘115+10’
scannum As String * 10 ‘125+10’
patient_id As String * 10 ‘135+10’
exp_date As String * 10 ‘145+10’
exp_time As String * 10 ‘155+10’
hist_un0 As String * 3 ‘165+3’
views As Long ‘168+4’
vols_added As Long ‘172+4’
start_field As Long ‘176+4’
field_skip As Long ‘180+4’
omax As Long ‘184+4’
omin As Long ‘188+4’
smax As Long ‘192+4’
smin As Long ‘196+4’
End Type ‘total 200 bytes’

Public Type uAnaDsr
hk As uAnaHdr ‘0+40′
dime As uAnaDim ’40+108’
hist As uAnaHist ‘148+200’
End Type ‘total 348 bytes’

‘Acceptable values for datatype

Public Const DT_SIGNED_SHORT = 4
Public Const DT_SIGNED_INT = 8
Public Const DT_FLOAT = 16
Public Const DT_DOUBLE = 64

Public Sub WriteAnalyzeHeader()
On Error Resume Next
Dim ah As uAnaDsr
ah.hk.sizeof_hdr = 348
ah.hk.extents = 16384
ah.hk.regular = Asc("r"«»)

ah.dime.dims(0) = 4
ah.dime.dims(1) = DPoints
ah.dime.dims(2) = XPoints
ah.dime.dims(3) = YPoints
ah.dime.dims(4) = 1
ah.dime.pixdim(0) = 1
ah.dime.pixdim(1) = 1
ah.dime.pixdim(1) = ImgXPoints
ah.dime.pixdim(2) = 1
ah.dime.pixdim(2) = ImgYPoints
ah.dime.pixdim(3) = 1
ah.dime.datatype = 4
ah.dime.bitpix = 16
End Sub[/code]