Cortical Flattening Notes
Notes on the actions of script
07_Local_dual_med_flat_catchR.csh.
file / program descriptions
Day One Speculations
"./rec131072_other_octants 0 2 3 4 5 6 FULLvertex.list 64K_tri0_${PIECE}oct.list disord.uif ord.uif > ${PIECE}oct_3D.ucf"
- "0 2 3 4 5 6" is read and parsed, but not used. These must be integers.
- "ord.uif" is written. This contains the an encoding of the obj's data in a two-dimensional data structure. For this call the vertex data is copied to the structure.
- "disord.uif" is not read or written
- "${PIECE}oct_3D.ucf" holds the data from the specified octant encoded to a ucf.
"./COLORS_rec131072_other_octants 0 2 3 4 5 6 FULLvertex.list 64K_tri0_${PIECE}oct.list disord.uif ord.uif > C${PIECE}oct_3D.ucf "
- "0 2 3 4 5 6" is read and parsed, but not used. These must be integers.
- "ord.uif" is written. This contains the an encoding of the obj's data in a two-dimensional data structure. For this call the vertex colors are copied to the structure.
- "disord.uif" is not read or written
- "64K_colors.txt" is required, though not mentioned in the command line statement
- "C${PIECE}oct_3D.ucf" holds the data from the specified octant encoded to a ucf.
- "DECord.uif" may encode the fractional part of the vertex coordinates
flatten script text, with inline annotations
#! /bin/csh
#NOTE: Change the directory where the subject is located. Change cases.
#NOTE: Must be run from the directory where subject cases live. Need 3 things in CORT directory...1)colored brain object 2)SHORTened RSP3 files for specific case and 3) Divided Lines (1, 5, 21; a & b)
#When done, view with seg and load up by typing: seg -line 3 DUALflat.uvl FLAT_SHORTRSP3*.ucf OR seg -line 3 DUALflat.uvl DUALFLAT_SHORTRSP3*.ucf
#You will have two flattened images in DUALflat.uvl
#When loading FLAT*.ucf, use LsurrR_BIGCord to view flattened lines
#When loading DUALFLAT*.ucf, use RsurrL_BIGCord to view flattened lines
#foreach x ( `cat medial_anal.list`)
#foreach x ( `cat new_medial_anal.list`)
foreach x ( /cxfs/schizo/family_study/10396_/10396)
set STUDY = ${x:h}
echo ${STUDY}
cd ${STUDY}/Right_CORT
Sequence Number 0
echo " Copying files..."
cp /data/ad/d/thompson/Z_DAVES_STUFF_FROM_TMPNET/6NEW_CORTICAL_MESH_CODE/pauls_AD64K_to_FULLvertex_list .
cp /data/ad/mass3/users/PAULS_SURFACE_CODE/SGI/FLATTENING/rec131072_other_octants .
cp /nethome/users/drex/models/64*list .
cp /data/ad/mass3/users/PAULS_SURFACE_CODE/SGI/FLATTENING/COLORS_rec131072_other_octants .
cp /data/ad/mass3/users/PAULS_SURFACE_CODE/SGI/FLATTENING/big64K_stream .
cp /data/ad/mass3/users/PAULS_SURFACE_CODE/SGI/FLATTENING/real_64K_curve_find .
cp /nethome/users/thompson/HEM_FLAT/BIGflat.uvl .
##################################################################
echo " Running perl..."
Sequence # 1
./pauls_AD64K_to_FULLvertex_list < {$STUDY}/Righ*CORT/*obj > FULLvertex.list
echo " Getting colors from object..."
## NOTE: must use gnu version of tail as SGI sucks and decided in their
## infinite wisdom to cut you off at 256K (since that is all their
## "faster" buffered mode of tail can handle) -- drex 4/18/00
head -n 196618 ${STUDY}/Righ*CORT/*obj | /usr/gnu/bin/tail -n 65538 | /usr/gnu/bin/tail -c +3 > 64K_colors.txt
echo " Unscrambling tiles to octant .ucfs..."
Sequence # 2
foreach PIECE ( 1 2 3 4 5 6 7 8 )
echo " $PIECE"
./rec131072_other_octants 0 2 3 4 5 6 FULLvertex.list 64K_tri0_${PIECE}oct.list disord.uif ord.uif > ${PIECE}oct_3D.ucf
end
echo " Starting texture descrambling to texture octant .ucfs..."
foreach PIECE ( 1 2 3 4 5 6 7 8 )
echo " $PIECE"
./COLORS_rec131072_other_octants 0 2 3 4 5 6 FULLvertex.list 64K_tri0_${PIECE}oct.list disord.uif ord.uif > C${PIECE}oct_3D.ucf
end
######
echo " Making Right Hem. position map..."
./big64K_stream 1 2 3 4 5 6 1oct_3D.ucf 2oct_3D.ucf 3oct_3D.ucf 4oct_3D.ucf 1oct_3D.ucf 1oct_3D.ucf 1oct_3D.ucf > 1st_oct_set.ucf
cp ord.uif ordR.uif
cp DECord.uif DECordR.uif
######
echo " Making Left Hem. position map..."
./big64K_stream 1 2 3 4 5 6 6oct_3D.ucf 5oct_3D.ucf 8oct_3D.ucf 7oct_3D.ucf 1oct_3D.ucf 1oct_3D.ucf 1oct_3D.ucf > 2nd_oct_set.ucf
cp ord.uif ordL.uif
cp DECord.uif DECordL.uif
######
echo " Making Right Hem. texture map..."
./big64K_stream 1 2 3 4 5 6 C1oct_3D.ucf C2oct_3D.ucf C3oct_3D.ucf C4oct_3D.ucf C1oct_3D.ucf C1oct_3D.ucf C1oct_3D.ucf > C1st_oct_set.ucf
cp ord.uif CordR.uif
# caution,a DEC file is meaningless and actually makes things worse for a texture map.
cp DECord.uif DECCordR.uif
######
echo " Making Left Hem. texture map..."
./big64K_stream 1 2 3 4 5 6 C6oct_3D.ucf C5oct_3D.ucf C8oct_3D.ucf C7oct_3D.ucf C1oct_3D.ucf C1oct_3D.ucf C1oct_3D.ucf > C2nd_oct_set.ucf
cp ord.uif CordL.uif
# caution,a DEC file is meaningless and actually makes things worse for a texture map.
cp DECord.uif DECCordL.uif
###########
echo " This will paste the right parts of the ordL into the ordR, producing BIGord"
~thompson/HEM_FLAT/paste_ordL_into_ordR 256 256 CordL.uif CordR.uif BIGCord.uif
~thompson/HEM_FLAT/paste_ordL_into_ordR 256 256 ordL.uif ordR.uif BIGord.uif
~thompson/HEM_FLAT/paste_ordL_into_ordR 256 256 DECordL.uif DECordR.uif BIGDECord.uif
######
echo " Flattening Right. hem. curves into LsurrR (will skip to L if there are none)..."
set wc_lines = `((ls SHORTRSP3_*R*.ucf > $$.tmp) >&! /dev/null); wc $$.tmp; /bin/rm -f $$.tmp`
@ num_lines = ${wc_lines[1]}
# catch any that fall off in directories called LsurrR_FELL_OFF, RsurrL_FELL_OFF
if ( ! -e LsurrR_FELL_OFF ) mkdir LsurrR_FELL_OFF
if ( ! -e RsurrL_FELL_OFF ) mkdir RsurrL_FELL_OFF
if ( ${num_lines} > 0 ) then
foreach line ( SHORTRSP3_*R*.ucf )
echo " ${line}"
#test for medial data
# ./real_64K_curve_find 1 2 3 4 5 6 1oct_3D.ucf 2oct_3D.ucf 3oct_3D.ucf 4oct_3D.ucf ${line} 1oct_3D.ucf 1oct_3D.ucf > FLAT_${line}
~thompson/HEM_FLAT/real_64K_curve_find_in_BIGimage_or_reject 1 2 3 4 5 6 6oct_3D.ucf 5oct_3D.ucf 8oct_3D.ucf 7oct_3D.ucf ${line} 1oct_3D.ucf 1oct_3D.ucf > FLAT_${line}
if ( -e $line:r.ucf_FELLOFF ) then
echo "Found it"
mv $line:r.ucf_FELLOFF LsurrR_FELL_OFF
echo "Removing the fallen off FLAT line.."
rm -f FLAT_{$line}
endif
end
endif
######
echo " Flattening Left hem. curves into LsurrR...(will skip if there are none)..."
set wc_lines = `((ls SHORTRSP3_*L*.ucf > $$.tmp) >&! /dev/null); wc $$.tmp; /bin/rm -f $$.tmp`
@ num_lines = ${wc_lines[1]}
# catch any that fall off in directories called LsurrR_FELL_OFF, RsurrL_FELL_OFF
if ( ! -e LsurrR_FELL_OFF ) mkdir LsurrR_FELL_OFF
if ( ! -e RsurrL_FELL_OFF ) mkdir RsurrL_FELL_OFF
if ( ${num_lines} > 0 ) then
foreach line (SHORTRSP3_*L*.ucf )
echo " ${line}"
# ./real_64K_curve_find 1 2 3 4 5 6 6oct_3D.ucf 5oct_3D.ucf 8oct_3D.ucf 7oct_3D.ucf ${line} 1oct_3D.ucf 1oct_3D.ucf > FLAT_${line}
# now we catch the ones that fall off;
~thompson/HEM_FLAT/real_64K_curve_find_in_BIGimage_or_reject 1 2 3 4 5 6 1oct_3D.ucf 2oct_3D.ucf 3oct_3D.ucf 4oct_3D.ucf ${line} 1oct_3D.ucf 1oct_3D.ucf > FLAT_${line}
if ( -e $line:r.ucf_FELLOFF ) then
echo "Found it"
mv $line:r.ucf_FELLOFF LsurrR_FELL_OFF
echo "Removing the fallen off FLAT line.."
rm -f FLAT_{$line}
endif
end
endif
####################################################################################################################################
############# for DUAL flattening only - PT ###############
echo " This will paste the right parts of the ordR into the ordL (note new order), producing BIGord"
# old ones: - now have the UVL refer to the surr names
cp BIGCord.uif LsurrR_BIGCord.uif
cp BIGord.uif LsurrR_BIGord.uif
cp BIGDECord.uif DECLsurrR_BIGord.uif
~thompson/HEM_FLAT/paste_ordL_into_ordR 256 256 CordR.uif CordL.uif BIGCord.uif
~thompson/HEM_FLAT/paste_ordL_into_ordR 256 256 ordR.uif ordL.uif BIGord.uif
~thompson/HEM_FLAT/paste_ordL_into_ordR 256 256 DECordR.uif DECordL.uif BIGDECord.uif
cp BIGCord.uif RsurrL_BIGCord.uif
cp BIGord.uif RsurrL_BIGord.uif
cp BIGDECord.uif DECRsurrL_BIGord.uif
cp ~thompson/HEM_FLAT/DUALflat.uvl .
# note BIGord.uif is hard coded so will now be the R surrounding the L ord. -
# proceed with flattening into the new map - most medial will fall off this one? Note this will be
# blended with the other one somehow
######
#--------------------
echo " DUAL Flattening of Right. hem. curves, into RsurrL (will skip to L if there are none)..."
set wc_lines = `((ls SHORTRSP3_*R*.ucf > $$.tmp) >&! /dev/null); wc $$.tmp; /bin/rm -f $$.tmp`
@ num_lines = ${wc_lines[1]}
# catch any that fall off in directories called LsurrR_FELL_OFF, RsurrL_FELL_OFF
if ( ! -e LsurrR_FELL_OFF ) mkdir LsurrR_FELL_OFF
if ( ! -e RsurrL_FELL_OFF ) mkdir RsurrL_FELL_OFF
if ( ${num_lines} > 0 ) then
foreach line ( SHORTRSP3_*R*.ucf )
echo " ${line}"
#test for medial data
# ./real_64K_curve_find 1 2 3 4 5 6 1oct_3D.ucf 2oct_3D.ucf 3oct_3D.ucf 4oct_3D.ucf ${line} 1oct_3D.ucf 1oct_3D.ucf > FLAT_${line}
~thompson/HEM_FLAT/real_64K_curve_find_in_BIGimage_or_reject 1 2 3 4 5 6 6oct_3D.ucf 5oct_3D.ucf 8oct_3D.ucf 7oct_3D.ucf ${line} 1oct_3D.ucf 1oct_3D.ucf > DUALFLAT_${line}
if ( -e $line:r.ucf_FELLOFF ) then
echo "Found it"
mv $line:r.ucf_FELLOFF RsurrL_FELL_OFF
echo "Removing the fallen off FLAT line.."
rm -f DUALFLAT_{$line}
endif
end
endif
######
echo " DUAL Flattening of Left hem. curves, into RsurrL...(will skip if there are none)..."
set wc_lines = `((ls SHORTRSP3_*L*.ucf > $$.tmp) >&! /dev/null); wc $$.tmp; /bin/rm -f $$.tmp`
@ num_lines = ${wc_lines[1]}
# catch any that fall off in directories called LsurrR_FELL_OFF, RsurrL_FELL_OFF
if ( ! -e LsurrR_FELL_OFF ) mkdir LsurrR_FELL_OFF
if ( ! -e RsurrL_FELL_OFF ) mkdir RsurrL_FELL_OFF
if ( ${num_lines} > 0 ) then
foreach line (SHORTRSP3_*L*.ucf )
echo " ${line}"
# ./real_64K_curve_find 1 2 3 4 5 6 6oct_3D.ucf 5oct_3D.ucf 8oct_3D.ucf 7oct_3D.ucf ${line} 1oct_3D.ucf 1oct_3D.ucf > FLAT_${line}
# now we catch the ones that fall off;
~thompson/HEM_FLAT/real_64K_curve_find_in_BIGimage_or_reject 1 2 3 4 5 6 1oct_3D.ucf 2oct_3D.ucf 3oct_3D.ucf 4oct_3D.ucf ${line} 1oct_3D.ucf 1oct_3D.ucf > DUALFLAT_${line}
if ( -e $line:r.ucf_FELLOFF ) then
echo "Found it"
mv $line:r.ucf_FELLOFF RsurrL_FELL_OFF
echo "Removing the fallen off FLAT line.."
rm -f DUALFLAT_{$line}
endif
end
endif
end
#-----------------------------
echo " FINISHED - use seg to view results..."
cd /cxfs/schizo/family_study/lists
end