I am using a ground truth object to store segmentation labels. I have a folder containing my images, the ground truth object, and the PixelMapLabels folder. I have moved this folder to a new directory and in order to get my matlab code to use the ground truth object in the new directory I need to change its file paths with the changeFilePaths(gTruth, alter_paths) function.
Below is my code:
datapath = '/scratch/qbi/uqhrile1';
training_datapath = strcat(datapath,'/training_dataset');
training_dataset = imageDatastore(strcat(training_datapath,'/images_rgb'));
load(strcat(training_datapath,'/pixel_maps/eye_segmentation_labels.mat'));
old_data_source = 'D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels';
new_data_source = strcat(training_datapath,'/labels');
old_pixellabel_path = 'D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\pixel_maps\PixelLabelData';
new_pixellabel_path = strcat(training_datapath,'/pixel_maps/PixelLabelData');
alter_paths = {[old_data_source new_data_source];[old_pixellabel_path new_pixellabel_path]};
unresolved_paths = changeFilePaths(gTruth,alter_paths)
Here is the output (I won't include all of it because it's a very long list of filenames):
[Warning: The data source points to one or more image files that cannot be
found. Update the DataSource filenames using <a
href="matlab:doc('changeFilePaths')">changeFilePaths</a> method.]
[> In groundTruth>checkImageFilenames (line 1375)
In groundTruth/checkIfSourceExists (line 1123)
In groundTruth.loadobj (line 988)
In segmentation_neural_network (line 21)]
unresolved_paths =
200x1 string array
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_106520_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_107415_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_107535_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_107590_segmentated.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_108070_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_108415_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_109390_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_110360_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_110380_segmented.tif"
"D:\20190618-f1\images_extracted_from_zebrafish_movies\20190618-f1_10-27-56\training_dataset\labels\frame_111345_segmented.tif"
Etcetera. I know that the issue is not the difference between backslash (\) and slash (/) - the reason why the old pathways use slash and the new pathways use backslash is because I am moving my code and dataset from Windows to Linux.
Can anyone tell me why all of the pathways I am trying to change are coming back as unresolved?