1. train stage: run 'sample_select_interface.m', which will show a figure interface.
2. When finish selecting samples from one image, press 'enter' button and drag any size window on the image to finish; then, click 'Next Image' to jump to the next one in order to select new samples.
3. When all samples have been selected, click 'Finish & Train' button to start training process, which will save a 'filename+.tp_cluster' mat file.
4. test stage: run 'xcorr_seg_system_test_stage.m' script.
Note: change the test image directory and the mat file name generated, then start testing process.
5. The variable 'Final_Seg_Obj' contains the segmented cropped patches. The first row is the segmented single object with background intensities 0. The second row is the binary mask.
6. The variable 'SaveImgOut' show the segmented borders in the image.

Note: if you need more info about segmented objects, please let me know.