//THE PURPOSE OF THIS CLASS IS TO PROVIDE A METHOD TO UPDATE THE //IMAGE.DAT FILE WITH EVENT BOUNDARY INFORMATION //1 STEP 1 -> READ IN ALL THE IMAGE VALUES AND STORE THEM TO AN ARRAY //2 STEP 2 -> MARK ALL IMAGES THAT ARE EVENT BOUNDARIES //3 STEP 3 -> DELETE ORIGINAL IMAGE.DAT FILE //4 STEP 4 -> WRITE NEW IMAGE.DAT WITH EVENT BOUNDARY INFORMATION INCLUDED public static void update_image_dat(string local_folder, Segmentation_Image_Rep[] list_of_all_images, Segmentation_Event_Rep[] list_of_events) { //step 1 is covered as this application reads the list_of_all_images information earlier, so we just pass it into this method //now mark all images that are event boundaries mark_all_images_that_are_event_boundaries(list_of_all_images, list_of_events); //delete the original image.dat file delete_original_image_dat_file(local_folder); //write out the new image.dat file write_new_image_dat_file_with_bookmarks(local_folder, list_of_all_images); }
private static void mark_all_images_that_are_event_boundaries(Segmentation_Image_Rep[] image_list, Segmentation_Event_Rep[] list_of_events) { if (image_list.Length > 0 && list_of_events.Length > 0) { int boundary_counter = 0; for (int image_counter = 0; image_counter < image_list.Length; image_counter++) { //go through all the images //and then compare each one to see if it matches the time of the next boundary that we're expecting ... we look at the boundary end time so that the first image is not marked as a boundary if ((image_list[image_counter].get_image_time() == list_of_events[boundary_counter].get_endTime()) && (boundary_counter != list_of_events.Length - 1)) { //and we incrament the boundary_counter boundary_counter++; } //end if (image_list[image_counter].get_image_time() == list_of_events[boundary_counter].get_endTime()) image_list[image_counter].set_event_boundary(boundary_counter); } //end for (int image_counter = 0; image_counter < image_list.Length; image_counter++) } //end if (image_list.Length > 0 && list_of_events.Length > 0) }