Thanks!
I forgot to set the qform_code, so avwhd was basically ignoring all the
other fields because qform_code was 0.
One more question - what does fslview do with this orientation
information. How are the images displayed, and what is the definition
of the axes in fslview? (what is +x, +y and +z and where is it on the
screen)?
thanks
zrinka
On Mar 26, 2005, at 2:59 AM, Mark Jenkinson wrote:
> Hi Zrinka,
>
> What we do in avwhd is show what is effectively read into our i/o
> library from the nifti file. It doesn't show all the fields in the
> same
> format as the nifti1.h file, partly so they are more human readable.
> So, for instance, we shown qform_code and qform_name where
> the latter is the ascii string associated with the former. So only
> qform_code is stored in the file, and the qform_name is completely
> determined from the qform_code. Similarly for qto_xyz which
> show the affine matrix associated with the quaternion parameters,
> since the quaternions themselves are much less human friendly.
>
> So it looks like you are doing the right thing, except that if you
> want to have valid qforms in the file, then you should set the
> qform_code to something other than 0 (which represents 'Unknown').
>
> Also, note that our i/o was based on code written by Bob Cox, and
> modified by me. You are welcome to reuse this code yourself or
> make your own modifications. There will also be a 'reference library'
> based on this code coming from the nifti data format working group
> soon, which also might help.
>
> Hope this clears things up for you.
> All the best,
> Mark
>
>
>
>
> Zrinka Bilusic wrote:
>
>> Hello!
>> I am working on some code that creates nifti images (the nifti pair)
>> and I was trying to use avwhd
>> to read the header infromation to test my code. My code is based on
>> the information in the nifti
>> spec file (http://nifti.nimh.nih.gov/pub/dist/src/nifti1.h) and some
>> sample code from Bob Cox.
>>
>> In addition to the basic analyze files, I am adding the nifti-1 flag
>> (magic), and the qform info
>> (quaternion b, c and d and qfac).
>>
>> When I use avwhd to read the header - it does recognize it as a
>> nifti-1 format, but it does not
>> show me any of the additional nifti fields. It (avwhd imagename)
>> actually prints fields that are not
>> in the nifti header file like qform_xorient and sto_xyz (or are
>> they?) Is this expected? Or am I doing
>> something wrong when setting these fields?
>>
>> Here is the output of both 'avwhd testAnalyze.img' and 'avwhd -x
>> testAnalyze.img':
>>
>> thanks!
>>
>> avwhd testAnalyze
>> Byte swapping
>> filename testAnalyze.hdr
>>
>> sizeof_hdr 348
>> data_type INT16
>> dim0 3
>> dim1 128
>> dim2 128
>> dim3 23
>> dim4 1
>> dim5 1
>> dim6 1
>> dim7 1
>> vox_units Unknown
>> time_units Unknown
>> datatype 4
>> nbyper 2
>> bitpix 16
>> pixdim0 0.0000000000
>> pixdim1 1.5625000000
>> pixdim2 1.5625000000
>> pixdim3 4.0000000000
>> pixdim4 5100.0000000000
>> pixdim5 1.0000000000
>> pixdim6 1.0000000000
>> pixdim7 1.0000000000
>> vox_offset 0
>> cal_max 3607.0000
>> cal_min 0.0000
>> scl_slope 0.000000
>> scl_inter 0.000000
>> phase_dim 0
>> freq_dim 0
>> slice_dim 0
>> slice_name Unknown
>> slice_code 0
>> slice_start 0
>> slice_end 0
>> slice_duration 0.000000
>> time_offset 0.000000
>> intent Unknown
>> intent_code 0
>> intent_name
>> intent_p1 0.000000
>> intent_p2 0.000000
>> intent_p3 0.000000
>> qform_name Unknown
>> qform_code 0
>> qto_xyz:1 1.562500 0.000000 0.000000 0.000000
>> qto_xyz:2 0.000000 1.562500 0.000000 0.000000
>> qto_xyz:3 0.000000 0.000000 4.000000 0.000000
>> qto_xyz:4 0.000000 0.000000 0.000000 1.000000
>> qform_xorient Left-to-Right
>> qform_yorient Posterior-to-Anterior
>> qform_zorient Inferior-to-Superior
>> sform_name Unknown
>> sform_code 0
>> sto_xyz:1 0.000000 0.000000 0.000000 0.000000
>> sto_xyz:2 0.000000 0.000000 0.000000 0.000000
>> sto_xyz:3 0.000000 0.000000 0.000000 0.000000
>> sto_xyz:4 0.000000 0.000000 0.000000 0.000000
>> sform_xorient Unknown
>> sform_yorient Unknown
>> sform_zorient Unknown
>> file_type NIFTI-1
>> file_code 2
>> descrip
>> aux_file
>>
>>
>>
>> avwhd -x testAnalyze
>> <nifti_image
>> nifti_type = 'NIFTI-1'
>> header_filename = 'testAnalyze.hdr'
>> image_filename = 'testAnalyze.img'
>> image_offset = '0'
>> ndim = '3'
>> nx = '128'
>> ny = '128'
>> nz = '23'
>> dx = '1.5625'
>> dy = '1.5625'
>> dz = '4'
>> datatype = '4'
>> datatype_name = 'INT16'
>> nvox = '376832'
>> nbyper = '2'
>> byteorder = 'LSB_FIRST'
>> cal_min = '0'
>> cal_max = '3607'
>> />
>>
>>
>
>
Zrinka Bilusic-Vezmar
UCLA Brain Mapping
660 Charles Young Drive South
Los Angeles, CA 90095
310-794-5060
[log in to unmask]
www.brainmapping.org
|