THD_zzprintf() long string truncation = the ZSS syndrome

Hey Afni friends,

I’m running afni inside of a container right now, one of the commands I’m running is truncating the output for some unknown reason


3dinfo -verb  /mnt/150423/RESULTS/Stern/baseline_ListLength_EVENTS_censored/STATS_150423_REML.nii.gz | grep "Coef" | grep 'not5_LL5'


this returns


*+ WARNING: THD_zzprintf() long string truncation = the ZSS syndrome


and a truncated version of my output.
Its outputting 14 lines but my expected output is only around 20 lines.

AFNI version=AFNI_20.1.01 (Apr 14 2020) [64-bit]

Any ideas whats happening?

Thanks!

Hi-

This doesn’t answer your question directly, but would you get your parsing to work with the following?:


echo `3dinfo -label -sb_delim "\n"  /mnt/150423/RESULTS/Stern/baseline_ListLength_EVENTS_censored/STATS_150423_REML.nii.gz` | grep "Coef" | grep 'not5_LL5'

or, more succinctly:


echo `3dinfo -label -sb_delim "\n"  FILE` | grep "Coef" | grep 'not5_LL5'

–pt

It seems like sb_delim is using the literal characters of '' and ‘n’ so I altered your code a bit and got something to work:


3dinfo -label -sb_delim "," ${FILE} | tr ',' '\n' | grep 'Coef' | grep 'not5_LL5'

It’s a little round about but it should work as a workaround for know.

Howdy-

That’s why I had the


echo ` .... `

around the 3dinfo command-- I think that should still work if you include everything in that line?

Or is the problem that you want to wrap everything in ..., say, to save the output as a variable? In that case, you could do something like:


#tcsh 
set variable = `3dinfo -label  FILE | tr '|' '\n' | grep Coef`
# bash
variable=`3dinfo -label  FILE | tr '|' '\n' | grep Coef`

… which is basically what you had, but you don’t need to change the default subbrick delimiter, then.

–pt

Thanks for the quick replies,

Basically I’m trying to get the index of certain subbricks within an output
the back ticks seemed to mess with the output formatting a bit
I was able to get something working using the following:


3dinfo -subbrick_info ${input_file} | grep "${subbrick}" | grep "'${name}#" > $TFILE
idx=$(echo $(awk '{print $4}' $TFILE))
echo "${idx[@]//#}" > "${work_dir}/idx_${name}_${subbrick}.1D"

I would still be curious to know the reason for the THD_zzprintf() issue.

The THD_zzprintf() function merely has a limit on the maximum length. That could be increased if it is important.

If you are trying to get a single index, would -label2index be easier? You need to know the exact label for that.

3dinfo -label2index ‘aud#0_Coef’ stats.FT+tlrc

  • rick

Unfortunately I’m extracting multiple subbricks at once:


 -- At sub-brick #418 'not5_LL5#0_Coef' datum type is float:     -56.7884 to       84.4562
  -- At sub-brick #420 'not5_LL5#1_Coef' datum type is float:     -68.8189 to       78.3945
  -- At sub-brick #422 'not5_LL5#2_Coef' datum type is float:     -78.8084 to       100.778
  -- At sub-brick #424 'not5_LL5#3_Coef' datum type is float:     -72.1925 to       78.0441
  -- At sub-brick #426 'not5_LL5#4_Coef' datum type is float:     -80.5103 to       74.3215
  -- At sub-brick #428 'not5_LL5#5_Coef' datum type is float:     -83.7845 to       76.9669
  -- At sub-brick #430 'not5_LL5#6_Coef' datum type is float:     -69.4753 to       76.8984
  -- At sub-brick #432 'not5_LL5#7_Coef' datum type is float:      -67.924 to       61.0146
  -- At sub-brick #434 'not5_LL5#8_Coef' datum type is float:     -67.4012 to       76.7596
  -- At sub-brick #436 'not5_LL5#9_Coef' datum type is float:     -71.3718 to       54.9496
  -- At sub-brick #438 'not5_LL5#10_Coef' datum type is float:      -57.654 to       64.9789
  -- At sub-brick #440 'not5_LL5#11_Coef' datum type is float:     -70.3451 to       74.7157
  -- At sub-brick #442 'not5_LL5#12_Coef' datum type is float:      -71.217 to        90.233
  -- At sub-brick #444 'not5_LL5#13_Coef' datum type is float:     -71.6169 to       58.2551
  -- At sub-brick #446 'not5_LL5#14_Coef' datum type is float:     -56.2692 to       100.694
  -- At sub-brick #448 'not5_LL5#15_Coef' datum type is float:     -65.0389 to       76.3429
  -- At sub-brick #450 'not5_LL5#16_Coef' datum type is float:     -73.6157 to       81.1147
  -- At sub-brick #452 'not5_LL5#17_Coef' datum type is float:     -67.8461 to       80.9208
  -- At sub-brick #454 'not5_LL5#18_Coef' datum type is float:     -61.3783 to       66.8849
  -- At sub-brick #456 'not5_LL5#19_Coef' datum type is float:     -74.3717 to       86.5165
  -- At sub-brick #458 'not5_LL5#20_Coef' datum type is float:     -62.4366 to       61.9594

So i think I’ll have to do some funky clunky stuff. But this should work for now.
I was looking through the code here:
https://afni.nimh.nih.gov/pub/dist/src/debugtrace.c
is there a way for end users to set ZMAX?

Hi-

I guess there might be some spaces in the output when using ...? Not sure.

This worked for me to build a list of indices (in tcsh, but the syntax should transfer directly to bash):


#!/bin/tcsh

set FILE     = STATS_DSET
set idx_list = ( )   # to be populated

# make a list of all the labels
set all_labels = `3dinfo -label  "${FILE}" | tr '|' '\n' | grep Coef`

# go through the labels and populate list of indices
foreach label ( ${all_labels} )
    set idx_list = ( ${idx_list} `3dinfo -label2index "${label}" "${FILE}"` )
end

echo ""
echo "++ All my labels:"
echo "   ${all_labels}"
echo "++ My final index list:"
echo "   ${idx_list}"

Hi Rick,

We are running into this truncation error as well. You alluded to a way to "increase the maximum length if it is important’.
Could you please share this secret? :slight_smile:

Thank you!
Shruti

Hi Shruti,

Sorry for being slow. Could you provide some details regarding what you are seeing? Is it just from 3dinfo with a long history, for example?

Thanks,

  • rick