devel > gifti_tool examples
Showing 1-1 of 1 posts
Display:
Results per page:
Apr 10, 2008  11:04 PM | Richard Reynolds
gifti_tool examples
Hi All,

Here are some examples from gifti_tool (from the -help output). Since not everyone will have the tool, it might be good to post for discussion of MetaData copy and comparison.

I will include examples of dataset creation and modification, for developers wanted interesting test data.

Example #7, at the bottom shows copying MetaData between datasets. I hope this formats well...

- rick


4. create a new gifti dataset from nothing, where:

- the dataset has 3 DataArray elements
- the data will be of type 'short' (NIFTI_TYPE_INT16)
- the intent codes will reflect a t-test
- the data will be 2-dimensional (per DataArray), 5 by 2 shorts
- memory will be allocated for the data (a modification option)
- the result will be written to created.gii

gifti_tool -new_dset \
-new_numDA 3 -new_dtype NIFTI_TYPE_INT16 \
-new_intent NIFTI_INTENT_TTEST \
-new_ndim 2 -new_dims 5 2 0 0 0 0 \
-mod_add_data -write_gifti created.gii

5. modify a gifti dataset

a. apply various modifications at the GIFTI level and to all DAs

- set the Version attribute at the GIFTI level
- set 'Date' as GIFTI MetaData, with value of today's date
- set 'Description' as GIFTI MetaData, with some value
- set all DA Intent attributes to be an F-test
- set 'Name' as an attribute of all DAs, with some value
- read created.gii, and write to first_mod.gii

gifti_tool -mod_gim_atr Version 1.0 \
-mod_gim_meta Date "`date`" \
-mod_gim_meta Description 'modified surface' \
-mod_DA_atr Intent NIFTI_INTENT_FTEST \
-mod_DA_meta Name 'same name for all DAs' \
-infile created.gii -write_gifti first_mod.gii

b. modify the 'Name' attribute is DA index #42 only

gifti_tool -mod_DA_meta Name 'data from pickle #42' \
-mod_DAs 42 \
-infile stats.gii -write_gifti mod_stats.gii

6. compare 2 gifti datasets
(compare GIFTI structures, compare data, and report all diffs)

gifti_tool -compare_gifti -compare_data -compare_verb 3 \
-infiles created.gii first_mod.gii

7. copy MetaData from one dataset to another
(any old Value will be replaced if the Name already exists)

- copy every (ALL) MetaData element at the GIFTI level
- copy MetaData named 'Label' per DataArray element
- only apply DataArray copies to indices 0, 3 and 6
- first input file is the source, second is the destination
- write the modified 'destination.gii' dataset to meta_copy.gii

gifti_tool -copy_gifti_meta ALL \
-copy_DA_meta Label \
-DA_index_list 0 3 6 \
-infiles source.gii destination.gii \
-write_gifti meta_copy.gii