#the final 3D version is expected:
#
#images stored in the current folder with GT masks in the GT folder

# extract two slices:
for i in 45 50; do ls *tif | serialCrop.sh _at${i}.ics 0 0 ${i} 500 588 1; done

# merge two mask slices
for i in `seq -w 00 96`; do echo $i; merge_images man_track${i}_at45.ics man_track${i}_at50.ics man_track${i}_atBOTH.ics; done

# merge two phantoms slices
for i in `seq -w 00 96`; do echo $i; merge_images scenePhantoms0${i}_cropped_at45.ics scenePhantoms0${i}_cropped_at50.ics ${i}_atBOTH.ics; done


# move phantoms to final folder
mv *BOTH* ../final/2D/


# iterative deleting of mask labels with RGB-based comparison
# create ST image of original
of_build3D ST_atBOTH.ics "" 2 _atBOTH.ics 0 99 1

#correct tracks
# prvotni procisteni, protoze zkopirovany tracks.txt nyni nesedi,
# protoze extrahovane slices nemusi vzdy obsahovat danou komponentu
# ulozeno jako _START
of_build3D STman_track_START.ics  man_track 2 _START.tif 0 96 1

# create ST image of new
of_build3D STman_track.ics man_track 2 .tif 0 96 1


# compose to see what was washed away (is in red and not in green)
of_compose STman_track_START.ics STman_track.ics STdifference.ics

